  # Tensorflow builds available from pypi
  _TENSORFLOW_REQUIREMENTS = {">=2.4.0,<2.5.0": ["11.0", "8.0"],
                              ">=2.5.0,<2.9.0": ["11.2", "8.1"]}
  # Packages that are explicitly required for setup.py
  _INSTALLER_REQUIREMENTS = ["pexpect>=4.8.0"]
  
  # Mapping of Python packages to their conda names if different from pip or in non-default channel
  _CONDA_MAPPING: Dict[str, Tuple[str, str]] = {
      # "opencv-python": ("opencv", "conda-forge"),  # Periodic issues with conda-forge opencv
      "fastcluster": ("fastcluster", "conda-forge"),
 
</s> remove         proc = pexpect.spawn(" ".join(command),
                             encoding=self._env.encoding,
                             codec_errors="replace",
                             timeout=None)
        last_line_cr = False
        while True:
            try:
                idx = proc.expect(["\r\n", "\r"])
                line = proc.before.rstrip()
                if line and idx == 0:
                    if last_line_cr:
                        last_line_cr = False
                        # Output last line of progress bar and go to next line
 </s> add     def _pywinpty_installer(self, command: List[str], package: str) -> int:
        """ Run an install command using pywinpty and log output.

        pywinpty is used so we can get unbuffered output to display updates

        Parameters
        ----------
        command: list
            The command to run
        package: str
            The package name that is being installed

        Returns
        -------
        int
            The return code from the subprocess
        """
        try:
            import winpty  # pylint:disable=import-outside-toplevel,import-error
            logger.info("Installing %s", package)
            cmd = which(command[0], path=os.environ.get('PATH', os.defpath))
            # For some reason with WinPTY we need to pass in the full command. Probably a bug
            cmdline = list2cmdline(command)
            logger.debug("argv: %s, cmd: '%s', cmdline: '%s'", command, cmd, cmdline)

            proc = winpty.PTY(
                100,
                24,
                backend=winpty.enums.Backend.WinPTY,  # ConPTY hangs and has lots of Ansi Escapes
                agent_config=winpty.enums.AgentConfig.WINPTY_FLAG_PLAIN_OUTPUT)  # Strip all Ansi

            if not proc.spawn(cmd, cmdline=cmdline):
                del proc
                raise RuntimeError("Failed to spawn winpty")

            pbar = re.compile(r"(?:eta\s[\d\W]+)|(?:\s+\|\s+\d+%)\Z")
            lines = []
            out = ""
            eof = False
            last_line_cr = False
            num_bytes = 1024
            while True:
                try:
                    from_pty = proc.read(num_bytes)
                except winpty.WinptyError as err:
                    if any(val in str(err) for val in ["EOF", "pipe has been ended"]):
                        # Get remaining bytes. On a comms error, the buffer remains unread so keep
                        # halving buffer amount until down to 1 when we know we have everything
                        if num_bytes == 1:
                            eof = True
                        from_pty = ""
                        num_bytes //= 2
                    else:
                        raise
                out += from_pty
                if "\n" in out:
                    lines.extend(out.split("\n"))
                    if out.endswith("\n") or eof:  # Ends on newline or is EOF
                        out = ""
                    else:  # roll over semi-consumed line to next read
                        out = lines[-1]
                        lines = lines[:-1]

                for line in lines:  # Dump the output to log
                    line = line.rstrip()
                    is_cr = bool(pbar.search(line))
                    if line and not is_cr:
                        if last_line_cr:
                            last_line_cr = False
                            if not self._is_gui:  # Go to next line
                                print("")
                        logger.verbose(line)  # type:ignore
                    elif line:
                        last_line_cr = True
                        logger.debug(line) </s> remove             self._conda_installer(pkg[0], channel=channel, conda_only=True)
 </s> add             self._from_conda(pkg[0], channel=channel, conda_only=True) </s> remove         if self.os_version[0] != "Windows":
            for inst in _INSTALLER_REQUIREMENTS:
                requirements.insert(0, inst)
 </s> add         for pkg, plat in _INSTALLER_REQUIREMENTS:
            if self.os_version[0] == plat or (plat[0] == "!" and self.os_version[0] != plat[1:]):
                requirements.insert(0, pkg) </s> remove         import pexpect  # pylint:disable=import-outside-toplevel,import-error
        logger.info("Installing %s", package)
 </s> add         try:
            import pexpect  # pylint:disable=import-outside-toplevel,import-error
            logger.info("Installing %s", package)
            logger.debug("argv: %s", command)

            proc = pexpect.spawn(" ".join(command),
                                 encoding=self._env.encoding,
                                 codec_errors="replace",
                                 timeout=None)
            last_line_cr = False
            while True:
                try:
                    idx = proc.expect(["\r\n", "\r"])
                    line = proc.before.rstrip()
                    if line and idx == 0:
                        if last_line_cr:
                            last_line_cr = False
                            # Output last line of progress bar and go to next line
                            if not self._is_gui:
                                print(line)
                        logger.verbose(line)  # type:ignore
                    elif line and idx == 1:
                        last_line_cr = True
                        logger.debug(line)
                        if not self._is_gui:
                            print(line, end="\r")
                except pexpect.EOF:
                    break
            proc.close()
            returncode = proc.exitstatus
            logger.debug("Package: %s, returncode: %s", package, returncode)
            return returncode
        except Exception as err:  # pylint:disable=broad-except
            logger.debug("Failed to install with pexpect. Falling back to subprocess. Error: %s",
                         str(err))
            return self._subproc_installer(command, package) </s> remove                 if self._conda_installer(pkg, channel=channel, conda_only=conda_only):
 </s> add                 if self._from_conda(pkg, channel=channel, conda_only=conda_only):
_INSTALLER_REQUIREMENTS = [("pexpect>=4.8.0", "!Windows"), ("pywinpty==2.0.2", "Windows")]
  # Tensorflow builds available from pypi
  _TENSORFLOW_REQUIREMENTS = {">=2.4.0,<2.5.0": ["11.0", "8.0"],
                              ">=2.5.0,<2.9.0": ["11.2", "8.1"]}
  # Packages that are explicitly required for setup.py
_INSTALLER_REQUIREMENTS = [("pexpect>=4.8.0", "!Windows"), ("pywinpty==2.0.2", "Windows")]
  
  # Mapping of Python packages to their conda names if different from pip or in non-default channel
  _CONDA_MAPPING: Dict[str, Tuple[str, str]] = {
      # "opencv-python": ("opencv", "conda-forge"),  # Periodic issues with conda-forge opencv
      "fastcluster": ("fastcluster", "conda-forge"),
keep keep keep keep replace keep keep keep keep keep
 Update setup.py
  - Realtime output for Windows
  - color logging for compatible Windows versions 
setup.py