Editable install does not work with --prefix
See original GitHub issueEnvironment
- pip version: 20.0.1
- Python version: 3.8.1
- OS: macOS
Description
Editable installs fail when using a custom --prefix
. Independently, install
appears to attempt to uninstall synonymous packages on the PYTHONPATH
when installing to a different prefix, though this might be intentional.
Expected behavior That editable installs would work for arbitrary prefixes.
How to Reproduce
$ mkdir -p "$PWD/foo/lib/python3.8/site-packages"
$ env PYTHONPATH="$PWD/foo/lib/python3.8/site-packages" python -m pip install --prefix "$PWD/foo" -e git+https://github.com/pypa/pip#egg=pip
Output
Obtaining pip from git+https://github.com/pypa/pip#egg=pip
Cloning https://github.com/pypa/pip to ./venv/src/pip
Running command git clone -q https://github.com/pypa/pip /Users/layday/Desktop/venv/src/pip
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.0.1
Uninstalling pip-20.0.1:
Successfully uninstalled pip-20.0.1
Running setup.py develop for pip
ERROR: Command errored out with exit status 1:
command: /Users/layday/Desktop/venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/Users/layday/Desktop/venv/src/pip/setup.py'"'"'; __file__='"'"'/Users/layday/Desktop/venv/src/pip/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --prefix /Users/layday/Desktop/foo/lib/python3.8/site-packages
cwd: /Users/layday/Desktop/venv/src/pip/
Complete output (33 lines):
running develop
Checking .pth file support in /Users/layday/Desktop/foo/lib/python3.8/site-packages/lib/python3.8/site-packages
/Users/layday/Desktop/venv/bin/python -E -c pass
TEST FAILED: /Users/layday/Desktop/foo/lib/python3.8/site-packages/lib/python3.8/site-packages does NOT support .pth files
error: bad install directory or PYTHONPATH
You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from. The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/Users/layday/Desktop/foo/lib/python3.8/site-packages/lib/python3.8/site-packages
and your PYTHONPATH environment variable currently contains:
'/private/var/folders/18/r2nky_v137d3fwhtx0644m940000gn/T/pip-build-env-vjsgcmks/site'
Here are some of your options for correcting the problem:
* You can choose a different installation directory, i.e., one that is
on PYTHONPATH or supports .pth files
* You can add the installation directory to the PYTHONPATH environment
variable. (It must then also be on PYTHONPATH whenever you run
Python and want to use the package(s) you are installing.)
* You can set up the installation directory to support ".pth" files by
using one of the approaches described here:
https://setuptools.readthedocs.io/en/latest/easy_install.html#custom-installation-locations
Please make the appropriate changes for your system and try again.
----------------------------------------
Rolling back uninstall of pip
Moving to /Users/layday/Desktop/venv/bin/pip
from /private/var/folders/18/r2nky_v137d3fwhtx0644m940000gn/T/pip-uninstall-xp6y4cgw/pip
Moving to /Users/layday/Desktop/venv/bin/pip3
from /private/var/folders/18/r2nky_v137d3fwhtx0644m940000gn/T/pip-uninstall-xp6y4cgw/pip3
Moving to /Users/layday/Desktop/venv/bin/pip3.8
from /private/var/folders/18/r2nky_v137d3fwhtx0644m940000gn/T/pip-uninstall-xp6y4cgw/pip3.8
Moving to /Users/layday/Desktop/venv/lib/python3.8/site-packages/pip-20.0.1.dist-info/
from /Users/layday/Desktop/venv/lib/python3.8/site-packages/~ip-20.0.1.dist-info
Moving to /Users/layday/Desktop/venv/lib/python3.8/site-packages/pip/
from /Users/layday/Desktop/venv/lib/python3.8/site-packages/~ip
ERROR: Command errored out with exit status 1: /Users/layday/Desktop/venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/Users/layday/Desktop/venv/src/pip/setup.py'"'"'; __file__='"'"'/Users/layday/Desktop/venv/src/pip/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps --prefix /Users/layday/Desktop/foo/lib/python3.8/site-packages Check the logs for full command output.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:9 (8 by maintainers)
Top Results From Across the Web
python - pip install --editable cause "running develop, error in ...
The string develop in the error output points to a Development Mode of setuptools . This is because of the --editable option in...
Read more >pip install — pip 10.0.0.dev0 documentation
pip requires a working VCS command on your path: git, hg, svn, or bzr. VCS projects can be installed in editable mode (using...
Read more >Packaging and distributing projects
When installed as editable, a project can be edited in-place without reinstallation: changes to Python source files in projects installed as editable will...
Read more >pip install --editable . fails - Google Groups
C:\programming\leo-editor>pip install --editable . ... Using legacy 'setup.py install' for pyshortcuts, since package 'wheel' is not installed.
Read more >Changelog - pip documentation v22.3.1
Fix an error when trying to uninstall packages installed as editable from a network drive. (#9452). Fix pip install issues using a proxy...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I bisected it to 744b8cf96eb3c3d4504048621c9406dd648fb71f.
I don’t think this is relevant anymore, closing.