Require miniconda to be installed for conda. to work

We can no longer assume that sys.executable has conda
installed. Instead, we require that prefix has conda installed.
This requires miniconda to be installed into prefix.
This commit is contained in:
yuvipanda
2018-07-20 11:30:11 -07:00
parent 8ff0befe00
commit e97b81fe7a
2 changed files with 6 additions and 46 deletions

View File

@@ -77,25 +77,6 @@ def install_miniconda(installer_path, prefix):
subprocess.check_call(["chmod", "-R", "o-w", prefix])
def ensure_conda_env(prefix):
"""
Ensure a conda environment in the prefix
"""
conda_executable = [os.path.join(prefix, 'bin', 'python'), '-m', 'conda']
abspath = os.path.abspath(prefix)
try:
output = json.loads(
subprocess.check_output(conda_executable + ['create', '--json', '--prefix', abspath]).decode()
)
except subprocess.CalledProcessError as e:
output = json.loads(e.output.decode())
if 'error' in output and output['error'] == f'CondaValueError: prefix already exists: {abspath}':
return
raise
if 'success' in output and output['success'] == True:
return
def ensure_conda_packages(prefix, packages):
"""
Ensure packages (from conda-forge) are installed in the conda prefix.