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

Document use of virtual environments #4872

Closed
jngrad opened this issue Mar 5, 2024 · 1 comment
Closed

Document use of virtual environments #4872

jngrad opened this issue Mar 5, 2024 · 1 comment

Comments

@jngrad
Copy link
Member

jngrad commented Mar 5, 2024

PEP 0668 changes the behavior of pip to avoid accidentally breaking system-wide packages. This is achieved by disallowing the installation of packages via pip, including pip install --user, when outside of a virtual environment. This new policy has been adopted in Ubuntu 23.04 and will affect all users who migrate from Ubuntu 22.04 LTS to Ubuntu 24.04 LTS next month.

Virtual environments solve a lot of pain points that afflicted ESPResSo users over the years:

  • getting the formatting and linting tools properly set up is difficult for new contributors, as we require a specific version that may conflict with the version requirements of other Python projects they contribute to, and the date at which we update the version requirements is unpredictable (we usually target Ubuntu LTS releases, but we often miss that target by several months)
  • getting a compatible Jupyter implementation typically requires installing packages that break the dependency tree of other Jupyter implementations; this was the case in 2023 when we moved from Jupyter Notebook (Classic) to JupyterLab on ICP workstations and could no longer use Jupyter Notebook
  • virtual environments can store the ESPResSo build folder in a .pth file, so that ESPResSo can be imported in Python without the need for the pypresso wrapper script, and without the need to touch the $PYTHONPATH (which would break module load and module purge in clusters); in fact many of our users still call pypresso on their simulation scripts even though it is not meant to be used in that way (but rather to help run debugging sessions: the script actually sets up paths to help find shared libraries of popular debuggers, and parses command line options; to be able to import espressomd, run make install)

Cluster users who module load ESPResSo instead of building it from sources should rely on the following syntax to re-use loaded Python packages instead of installing them again (and potentially breaking the dependency tree):

python3 -m venv --system-site-packages venv
source venv/bin/activate
python3 -m pip install -r requirements.txt
deactivate

For more details, see pm-blanco/pyMBE#12

@jngrad
Copy link
Member Author

jngrad commented Jun 14, 2024

Addressed by #4922.

@jngrad jngrad closed this as completed Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant