Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update PythonPackage easyblock to allow installation of Python packages with $PIP_REQUIRE_VIRTUALENV set + move temporary pip folder into build dir #3374

Merged
merged 3 commits into from
Jul 3, 2024
Merged
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
13 changes: 8 additions & 5 deletions easybuild/easyblocks/generic/pythonpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,14 @@ def __init__(self, *args, **kwargs):
self.use_setup_py = False
self.determine_install_command()

# avoid that pip (ab)uses $HOME/.cache/pip
# cfr. https://pip.pypa.io/en/stable/reference/pip_install/#caching
env.setvar('XDG_CACHE_HOME', os.path.join(self.builddir, 'xdg-cache-home'))
self.log.info("Using %s as pip cache directory", os.environ['XDG_CACHE_HOME'])
# Users or sites may require using a virtualenv for user installations
# We need to disable this to be able to install into the modules
env.setvar('PIP_REQUIRE_VIRTUALENV', 'false')

def determine_install_command(self):
"""
Determine install command to use.
Expand Down Expand Up @@ -452,11 +460,6 @@ def determine_install_command(self):
if pip_no_index or (pip_no_index is None and self.cfg.get('download_dep_fail')):
self.cfg.update('installopts', '--no-index')

# avoid that pip (ab)uses $HOME/.cache/pip
# cfr. https://pip.pypa.io/en/stable/reference/pip_install/#caching
env.setvar('XDG_CACHE_HOME', tempfile.gettempdir())
self.log.info("Using %s as pip cache directory", os.environ['XDG_CACHE_HOME'])

else:
self.use_setup_py = True
self.install_cmd = SETUP_PY_INSTALL_CMD
Expand Down
Loading