This is the first time I'm creating a python package. I follow all the instructions in this text, which was very well written and I was able to replicate every step without any issue.
Thus, I created a local directory with the following structure:
mypackage/
mypackage/
__init__.py
mypackage.py
LICENSE.txt
README.md
setup.cfg
setup.py
Next, I follow these steps:
- Push the directory to github
- Create a new release
- Update setup.py file
- run
python setup.py sdist
- run
twine upload dist/*
And proceed to install my package using pip
. It works finely
However, when I tried to import it I got the following error:
FileNotFoundError: [Errno 2] File counties_1872_1991.csv does not exist: 'counties_1872_1991.csv'
Then I search for a while and found this two questions (here and here). Folowing the instructions in the answers to each question, I did:
- Create a MANIFEST.in file and add the line
include counties_1872_1991.csv
- Edit the
setup.py
file and addpackage_data={'cartpy': ['counties_1872_1991.csv']},include_package_data=True
to the function setup
Unfortunately, this didn't work for me and I cannot say what I am doing wrong here. I thought is something related to absolute and relative paths, then I tried every possible combination but it didn't work either.
How can I include the csv file in my package?