diff --git a/.install/windows/install.nsi b/.install/windows/install.nsi index a81f04fa98..08eba00407 100644 --- a/.install/windows/install.nsi +++ b/.install/windows/install.nsi @@ -13,9 +13,9 @@ InstallDir $PROFILE\faceswap # Download sites !define wwwGit "https://github.com/git-for-windows/git/releases/download/v2.20.1.windows.1/Git-2.20.1-64-bit.exe" -# Latest miniconda appears to be broken when activating environment. Currently pinned to older version -#!define wwwConda "https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe" -!define wwwConda "https://repo.anaconda.com/miniconda/Miniconda3-4.5.12-Windows-x86_64.exe" +# Sometimes miniconda breaks. Uncomment/comment the following 2 lines to pin +!define wwwConda "https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe" +#!define wwwConda "https://repo.anaconda.com/miniconda/Miniconda3-4.5.12-Windows-x86_64.exe" !define wwwRepo "https://github.com/deepfakes/faceswap.git" @@ -383,14 +383,13 @@ Function CloneRepo FunctionEnd Function SetEnvironment - # Updating Conda breaks setup.py. Commented out in case this issue gets resolved in future -# DetailPrint "Initializing Conda..." -# SetDetailsPrint listonly -# ExecDos::exec /NOUNLOAD /ASYNC /DETAILED "$dirConda\scripts\activate.bat && conda update -y -n base -c defaults conda && conda deactivate" -# pop $0 -# ExecDos::wait $0 -# pop $0 -# SetDetailsPrint both + DetailPrint "Initializing Conda..." + SetDetailsPrint listonly + ExecDos::exec /NOUNLOAD /ASYNC /DETAILED "$\"$dirConda\scripts\activate.bat$\" && conda update -y -n base -c defaults conda && conda deactivate" + pop $0 + ExecDos::wait $0 + pop $0 + SetDetailsPrint both DetailPrint "Creating Conda Virtual Environment..." IfFileExists "$dirConda\envs\$envName" DeleteEnv CreateEnv diff --git a/lib/sysinfo.py b/lib/sysinfo.py index bef8061d8a..522a495949 100644 --- a/lib/sysinfo.py +++ b/lib/sysinfo.py @@ -153,6 +153,11 @@ def git_commits(self): commits = stdout.decode().splitlines() return ". ".join(commits) + @property + def cuda_keys_windows(self): + """ Return the OS Environ CUDA Keys for Windows """ + return [key for key in os.environ.keys() if key.lower().startswith("cuda_path_v")] + @property def cuda_version(self): """ Get the installed CUDA version """ @@ -237,8 +242,11 @@ def cudnn_checkfiles_linux(): def cudnn_checkfiles_windows(self): """ Return the checkfile locations for windows """ # TODO A more reliable way of getting the windows location - if not self._cuda_path: + if not self._cuda_path and not self.cuda_keys_windows: return list() + if not self._cuda_path: + self._cuda_path = os.environ[self.cuda_keys_windows[0]] + cudnn_checkfile = os.path.join(self._cuda_path, "include", "cudnn.h") return [cudnn_checkfile] @@ -295,15 +303,13 @@ def cuda_version_linux(self): def cuda_version_windows(self): """ Get CUDA version for Windows systems """ - cuda_keys = [key - for key in os.environ.keys() - if key.lower().startswith("cuda_path_v")] + cuda_keys = self.cuda_keys_windows if not cuda_keys: retval = "No global version found" if self.is_conda: retval += ". Check Conda packages for Conda Cuda" return retval - cudavers = [key.replace("CUDA_PATH_V", "").replace("_", ".") for key in cuda_keys] + cudavers = [key.lower().replace("cuda_path_v", "").replace("_", ".") for key in cuda_keys] return " ".join(cudavers) def full_info(self): diff --git a/setup.py b/setup.py index 842bbad020..6c6627d64b 100755 --- a/setup.py +++ b/setup.py @@ -627,12 +627,13 @@ def conda_installer(self, package, channel=None, verbose=False, conda_only=False condaexe.extend(["-c", channel]) condaexe.append(package) self.output.info("Installing {}".format(package)) + shell = self.env.os.version[0] == "Windows" try: if verbose: - run(condaexe, check=True) + run(condaexe, check=True, shell=shell) else: with open(os.devnull, "w") as devnull: - run(condaexe, stdout=devnull, stderr=devnull, check=True) + run(condaexe, stdout=devnull, stderr=devnull, check=True, shell=shell) except CalledProcessError: if not conda_only: self.output.info("{} not available in Conda. Installing with pip".format(package))