I am trying to package some data alongside the scripts within a package of mine: https://pypi.org/project/taxon2wikipedia/0.0.4/
The source distribution seems to contain the files that I need, but when trying to use the package I get the error message:
FileNotFoundError: [Errno 2] No such file or directory: '~/my_venv/lib/python3.8/site-packages/taxon2wikipedia/dicts/phrase_start_dict.json'
The "data" and "dicts" folders are not there in "site-packages/taxon2wikipedia", but are present in the package when I manually download it? Any suggestions on why it might be happening?
Thanks!
I already have a MANIFEST.in file with recursive-include src *.rq *.py *.jinja *json
, and even changing it to other similar options, it did not work.
I am using a pyproject.toml configuration and a mock setup.py to run setuptools.setup()
.
I run python3 -m build
to build the package. Maybe the problem lies there?
This is the source repository by the way: https://github.com/lubianat/taxon2wikipedia
The files in PyPI are all correct, but don't seem to be downloaded when I pip install the package.
Why does "pip install" not include my package_data files?
It seems to be some problem with how pip installs the package. The solution is different as in my case the files seem to be at the correct directory.
I came across this blog post which helped me solve the issue:
https://jwodder.github.io/kbits/posts/pypkg-data/
In the end, I was missing
[options.package_data] * = *.json *.jinja *.rq
from my setuf.cfg