0

I don't manage to make the editable mode pip install -e . for a local installation of my project. After the installation, when I import a constructor from a module of my package within in python shell instance running outside my project directory, I got an import error. Here is reproducible example to understand my problem.

What am I missing ?

note : without the editable mode, everything works

Example

setuptools_test/
__| pyproject.toml
__| setuptools_test/
______| __init__.py
______| base.py
_______ module/
__________| __init__.py
__________| base.py
setuptools_test/pyproject.toml
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "setuptools_test"
version = "0.0.1"
dependencies = [
    "requests",
    'importlib-metadata; python_version>="3.11"',
]
setuptools_test/setuptools_test/__init__.py
from .base import FirstClass
setuptools_test/setuptools_test/base.py
class FirstClass: ...
setuptools_test/setuptools_test/module/__init__.py
from .base import SecondClass
setuptools_test/setuptools_test/module/base.py
from setuptools_test import FirstClass

class SecondClass(FirstClass): ...

Problem Then, in setuptools_test/, after running python -m pip install -e ., outside setuptools_test/, I got :

>>> from setuptools_test.module import SecondClass
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../setuptools_test/setuptools_test/module/__init__.py", line 1, in <module>
    from .base import SecondClass
  File ".../setuptools_test/setuptools_test/module/base.py", line 1, in <module>
    from setuptools_test import FirstClass
ImportError: cannot import name 'FirstClass' from 'setuptools_test' (unknown location)

But, without the editable mode, it works.

Versions installed

ubuntu 22.04.4, python 3.11 installed with apt pip 25.2

version from `python -m pip freeze --all``

autocommand==2.2.2
backports.tarfile==1.2.0
build==1.3.0
certifi==2025.8.3
charset-normalizer==3.4.3
idna==3.10
importlib_metadata==8.7.0
jaraco.context==6.0.1
jaraco.functools==4.3.0
jaraco.text==4.0.0
more-itertools==10.7.0
packaging==25.0
pip==22.0.2
platformdirs==4.4.0
pyproject_hooks==1.2.0
requests==2.32.5
setuptools==80.9.0
setuptools_test @ file:///.../setuptools_test
urllib3==2.5.0
wheel==0.45.1
zipp==3.23.0
``
1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Aug 27 at 12:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.