Package: python3-pip
Version: 20.3.4-4
Severity: normal

Dear maintainers,

consider the following minimal Python project with setuptools packaging
and a "pyproject.toml" file (see PEP 518 and [1]):

> tree myproject
myproject
|-- myproject
|   `-- __init__.py
|-- pyproject.toml
|-- setup.cfg
`-- setup.py

Performing an editable system-wide install of this (i.e. running
`pip install -e` outside a venv) results in a successful pip invocation,
but a non-importable module:

> python3
>>> import myproject
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'myproject'

Everything works fine when a venv *or* a non-editable install is used
instead.

The reason for this is that the target files end up in
"/usr/lib/python3.9/site-packages", which is not part of the default
Debian Python module paths [2]:

> ls /usr/lib/python3.9/site-packages
easy-install.pth  myproject.egg-link

Having a PEP 518 package enables pip build isolation by default, which
appears to cause the issue.
One can work around it by using `pip install --no-build-isolation -e`.

In that case, the target files are created in
"/usr/local/lib/python3.9/dist-packages" instead.

Best,
Felix

[1] https://setuptools.pypa.io/en/latest/build_meta.html
[2] 
https://salsa.debian.org/cpython-team/python3-defaults/-/blob/master/policy/interpreter.rst

Reply via email to