Skip to content

Commit

Permalink
Fix use of venv module
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamefire committed Oct 15, 2024
1 parent b01a52b commit 36d3a36
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions easybuild/scripts/findPythonDeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def get_dep_tree(package_spec, verbose):
venv_dir = os.path.join(tmp_dir, 'venv')
if verbose:
print('Creating virtualenv at ' + venv_dir)
run_cmd(['virtualenv', '--system-site-packages', venv_dir], action_desc='create virtualenv')
run_cmd([sys.executable, '-m', 'venv', '--system-site-packages', venv_dir], action_desc='create virtualenv')
if verbose:
print('Updating pip in virtualenv')
run_in_venv('pip install --upgrade pip', venv_dir, action_desc='update pip')
Expand Down Expand Up @@ -241,9 +241,8 @@ def main():
out = run_cmd(cmd, action_desc='Run in new environment', shell=True, executable='/bin/bash')
print(out)
else:
if not can_run('python', '-m', 'venv', '-h'):
print('Virtualenv not found or executable. ' +
'Make sure it is installed (e.g. in the currently loaded Python module)!')
if not can_run(sys.executable, '-m', 'venv', '-h'):
print("'venv' module not found. This should be available in Python 3.3+.")
sys.exit(1)
if 'PIP_PREFIX' in os.environ:
print("$PIP_PREFIX is set. Unsetting it as it doesn't work well with virtualenv.")
Expand Down

0 comments on commit 36d3a36

Please sign in to comment.