I have problems importing two local (self-written) packages from my file system that I previously installed using pip.
I'm using a virtualenv, which I also verified to be activated, i.e. python
and pip
point to the virtualenv.
The two different packages are organized in a single repo as follows:
├── .venv
│ �� └── ...
├── folder_a
│ ├── package_a
│ │ ├── __init__.py
│ │ ├── a.py
│ │ └── subpackage_same_name
│ │ └── ...
│ ├── pyproject.toml
│ ├── requirements.txt
│ └── setup.cfg
├── folder_b
│ ├── package_b
│ │ ├── __init__.py
│ │ ├── subpackage_b_exclusive
│ │ │ └── ...
│ │ ├── b.py
│ │ └── subpackage_same_name
│ │ └── ...
│ ├── pyproject.toml
│ ├── requirements.txt
│ ├── setup.cfg
│ └── tests
│ └── ...
I install both packages from the root of the above tree (with activated virtualenv) using the following commands:
pip install ./folder_a
and
pip install ./folder_b
.
The installation is successful and the packages are shown in pip list
.
However, when I try to import package_a
in a.py
I get a ModuleNotFoundError: No module named 'package_a'
.
I can't figure out the problem here, is it the location of the virtualenv (notice the .venv
in the tree) relative to the package definitions?
Am I overseeing something?
Any help is appreciated!