Skip to content

Commit

Permalink
installer and setup.py updates
Browse files Browse the repository at this point in the history
  • Loading branch information
torzdf committed Jun 29, 2019
1 parent f5dd183 commit b45680e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
21 changes: 10 additions & 11 deletions .install/windows/install.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down Expand Up @@ -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
Expand Down
16 changes: 11 additions & 5 deletions lib/sysinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 """
Expand Down Expand Up @@ -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]

Expand Down Expand Up @@ -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):
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit b45680e

Please sign in to comment.