mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user