Issue
I have a Python package that at first appears to install just fine, but when calling on one of the entry points raises a ModuleNotFoundException
. The module is otherwise found just fine with both import package
from the interactive interpreter as well as with python -m package.etc
. But if I try to call on the entry-point directly (flike python -m package.etc.main
) it will raise an AttributeError
saying that the module has no attribute __path__
.
I can see the package if I do pip list
.
The project is currently set up with the "template" pyproject.toml
and only setup.cfg
, but the behaviour is essentially the same (the traceback looks slightly different but the error is the same) when using setup.py
over pyproject.toml
, both with pip
but also if I invoke setup.py
directly. The structure of the project is:
package
├── __init__.py
├── cli
│ ├── __init__.py
│ ├── entry.py
├── file.py
I get the same behaviour if doing this in a virtual environment as when I do it with a userspace (--user
) install.
Modifying the environment variable ${PYTHONPATH}
fixes the issue, and installing the package in editable mode works just fine.
Solution
Turns out that the issue was that I had something like:
[options]
packages = find:
[options.packages.find]
include =
README.md
in my setup.cfg
, and it appears as if the declaration of include
was exclusive which led to the package not being included in the installation, which still worked when installed in editable mode (presumably because editable mode only sets up some sort of links or appends the source code directories to some path).
Answered By - ades
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.