If a user have cache/pip installs in ~/Library, relocatable python may not create the right framework
erikng opened this issue · 2 comments
When building a relocatable python, a user might see
Requirement already satisfied: setuptools in /Users/erikg/Library/Python/3.9/lib/python/site-packages (49.2.1)
Processing /private/tmp/tmppluiasm6/pip-20.2.3-py2.py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-20.2.3
Upgrading pip installation...
WARNING: The directory '/Users/erikg/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
This happens when a user has installed the same Python version as relocatable python and installed modules with --user
Attempting to work around this by specifying --root
doesn't work due to a long standing bug with pip: pypa/pip#3063
After talking to @gregneagle , the best solution is likely to implement a WARNING to users when they are in this state.
The conditionals to look for will be:
- ~/Library/Python/%VERSION%"
- ~/Library/Caches/pip
The latter may not matter since it's just a cache.
Closing due to merged PR
How can that be possible when pip / ensure_pip are called with python -s
(disabling the user-site directory)? Might it be that the code should set PYTHONNOUSERSITE=1
in the environment instead to ensure sub-processes are also properly isolated?