Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/xmipp/bindings/python/xmipp_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,10 @@ def getCondaActivationCmd():
return condaActCmd

@staticmethod
def yieldInstallAllCmds(useGpu):
def yieldInstallAllCmds(useGpu, pathInstallation):
for name, env in CondaEnvManager.XMIPP_CONDA_ENVS.items():
yield CondaEnvManager.installEnvironCmd(
pathInstallation=pathInstallation,
name=name,
versionId=env.get('versionId', None),
requirementsFn=env['requirements'],
Expand Down Expand Up @@ -324,7 +325,7 @@ def getCurInstalledDep(dependency, defaultVersion=None, environ=None):
return dependency+'=='+defaultVersion if defaultVersion else dependency

@staticmethod
def installEnvironCmd(name: str,requirementsFn: str, versionId: int = None, gpu=False):
def installEnvironCmd(name: str,requirementsFn: str, versionId: int = None, gpu=False, pathInstallation: str = ''):
# Consider the gpu version if requested
if gpu:
root, ext = os.path.splitext(requirementsFn)
Expand All @@ -338,9 +339,14 @@ def installEnvironCmd(name: str,requirementsFn: str, versionId: int = None, gpu
else:
target = f'{name}.yml'

commands = []
commands.append('conda env create -f %s || conda env update -f %s' % (requirementsFn, requirementsFn))
commands.append('conda env export -f %s' % target)
commands = []
if not os.path.isfile(os.path.join(pathInstallation, target)):
commands.append(
'conda env create -f %s || conda remove --name %s --all -y && conda env create -f %s' % (
requirementsFn, name, requirementsFn))
commands.append('conda env export -f %s' % target)

#commands.append('conda env create -f %s || conda env update -f %s' % (requirementsFn, requirementsFn))
return ' && '.join(commands), target

def getModel(*modelPath, **kwargs):
Expand Down