some pip editable installs don't work with PEP 518 build isolation
See original GitHub issue> mkdir /tmp/simple_pep518_project-1.0
> printf 'from setuptools import setup; setup(name="simple_pep518_project", version="1.0")\n' >/tmp/simple_pep518_project-1.0/setup.py
> printf '[build-system]\nrequires = ["setuptools", "wheel"]\n' >/tmp/simple_pep518_project-1.0/pyproject.toml
> pip install --prefix /tmp/pyprefix -e /tmp/simple_pep518_project-1.0
Obtaining file:///tmp/simple_pep518_project-1.0
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Installing collected packages: simple-pep518-project
Running setup.py develop for simple-pep518-project
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/simple_pep518_project-1.0/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=/tmp/pyprefix:
running develop
Checking .pth file support in /tmp/pyprefix/lib/python3.6/site-packages
/usr/bin/python -E -c pass
TEST FAILED: /tmp/pyprefix/lib/python3.6/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:
/tmp/pyprefix/lib/python3.6/site-packages
and your PYTHONPATH environment variable currently contains:
'/tmp/pip-build-env-q4e8bpkm/lib/python3.6/site-packages'
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.
----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/simple_pep518_project-1.0/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=/tmp/pyprefix" failed with error code 1 in /tmp/simple_pep518_project-1.0/
> pip install --user -e /tmp/simple_pep518_project-1.0
Obtaining file:///tmp/simple_pep518_project-1.0
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Installing collected packages: simple-pep518-project
Running setup.py develop for simple-pep518-project
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/simple_pep518_project-1.0/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 --user --prefix=:
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --help
error: option --user not recognized
----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/simple_pep518_project-1.0/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 --user --prefix=" failed with error code 1 in /tmp/simple_pep518_project-1.0/
This is because of pip’s build isolation when PEP 518 support is enabled and easy_install’s behavior of:
- conflating the python environment used during installation with the target environment, erroneously assuming that the package target directory must be in
PYTHONPATH
. - disabling support for the
--user
option if the user site is disabled:
> python easy_install.py -h | grep -- --user
--user install in user site-package
> python -s easy_install.py -h | grep -- --user
> python -s easy_install.py --user setuptools
usage: easy_install.py [options] requirement_or_url ...
or: easy_install.py --help
error: option --user not recognized
With easy_install being deprecated, and pip being perfectly happy to install to a target directory not in PYTHONPATH
, I think:
- the
--user
option should always be available (with maybe a warning if the user site is disabled) - the error above when installing to a directory not in
PYTHONPATH
should be turned to a warning
For reference, related pip issue: https://github.com/pypa/pip/issues/5317
Issue Analytics
- State:
- Created 5 years ago
- Reactions:10
- Comments:12 (9 by maintainers)
Top Results From Across the Web
PEP 518 and editable mode: don't install already-satisfied ...
A solution would be to have pip keep its build venv around to reuse it later instead of creating a new temp venv...
Read more >pip install - pip documentation v22.3.1
Disable isolation when building a modern source distribution. Build dependencies specified by PEP 518 must be already installed if this option is used....
Read more >what does no-build-isolation do? - python - Stack Overflow
It means pip won't install the dependencies, so you have to install the dependencies if any by yourself first or the command will...
Read more >pip install - pip documentation v21.1.dev0
This section is only about installation order of runtime dependencies, and does not apply to build dependencies (those are specified using PEP 518)....
Read more >pip-install command man page - python3-pip | ManKier
Disable isolation when building a modern source distribution. Build dependencies specified by PEP 518 must be already installed if this option is used....
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
Unfortunately, yes: you’ll have to manually install the required build dependencies and use
--no-build-isolation
to work around the issue.Well, if my PR were to be accepted, we wouldn’t need a workaround anymore. 😇 On a serious note, I would be very interested in feedback, since this is an issue that is affecting me currently.