Proper way to do user package installation in a post-668 world?

I’d be hard-pressed to find it now. It came to a head in the days
when the RHEL package maintainers were “backporting” Py3K features
into Python 2.x because much of the system tooling and package
management was written in Python and they wanted to be able to take
advantage of some new functionality in the language without porting
everything. Not long after that they started rewriting a lot of it
in C, but by then the damage was done. I recall being pointed to a
KB article at the time, but as I don’t have a RHEL subscription now
I can’t access those, and they’re not indexed by public search
engines anyway.

1 Like

python -m venv --system-site-packages can be useful. Packages in a venv created by this command can easily import packages in the system environment, on the other hand, system packages won’t be affected by this venv. It just like a better pip install --user. For example:

$ python3.11 -m venv --system-site-packages ~/.local/share/global-venv
$ alias python=~/.local/share/global-venv/bin/python
$ alias pip="python -m pip"

$ sudo pacman -S ipython python-requests
$ pip install ipython
$ ipython  # ipython in the system environment
$ python -m IPython  # ipython in the global venv
$ python -c 'import requests'  # works well in the venv

$ pip show pip  # pip in the global venv
Name: pip
Version: 23.2.1
...
Location: ~/.local/share/global-venv/lib/python3.11/site-packages
...
$ unalias python
$ pip show pip  # pip in the system environment
Name: pip
Version: 23.2.1
...
Location: /usr/lib/python3.11/site-packages
...
2 Likes