I can't properly install the project package_fiddler to my virtual environment.
I have figured out that MANIFEST.in is responsible for putting the non-.py files in Package_fiddler-0.0.0.tar.gz that is generated when executing python setup.py sdist.
Then I did:
(virt_envir)$ pip install dist/Package_fiddler-0.0.0.tar.gz
But this did not install the data files nor the package to /home/username/.virtualenvs/virt_envir/local/lib/python2.7/site-packages.
I have tried many configurations of the setup arguments package_data, include_package_data and data_files but I seem to have used the wrong configuration each time.
Which configuration of package_data and/or include_package_data and/or data_files will properly install package_fiddler to my virtual environment?
Project tree
. ├── MANIFEST.in ├── package_fiddler │ ├── data │ │ ├── example.html │ │ └── stylesheets │ │ └── example.css │ └── __init__.py ├── README.rst └── setup.py setup.py
from setuptools import setup setup( name='Package_fiddler', entry_points={ 'console_scripts': ['package_fiddler = package_fiddler:main', ],}, long_description=open('README.rst').read(), packages=['package_fiddler',]) MANIFEST.in
include README.rst recursive-include package_fiddler/data * Configuration1
Adding:
package_data={"": ['package_fiddler/data/*',]} Configuration2
Adding:
package_data={"": ['*.html', '*.css', '*.rst']} Configuration3
Adding:
include_package_data=True Configuration4
Adding:
package_data={"": ['package_fiddler/data',]} Removing:
packages=['package_fiddler',] Configuration5 (Chris's suggestion)
Adding:
package_data={"data": ['package_fiddler/data',]} Removing:
packages=['package_fiddler',] Configuration 6
Adding:
package_data={"": ['package_fiddler/data/*',]} Removing:
packages=['package_fiddler',] These configurations all result in no files at all being installed on /home/username/.virtualenvs/virt_envir/local/lib/python2.7/site-packages.
Note to Toshio Kuratomi: In my original post I used the simplest tree structure where this problem occurs for clarity but in reality my tree looks more like the tree below. For that tree, strangely if I only put an __init__.py in stylesheets somehow all the data files in the texts folder are also installed correctly!!! This baffles me.
Tree 2 (This installs all data files properly somehow!!)
. ├── MANIFEST.in ├── package_fiddler │ │── stylesheets | | ├── __init__.py | | ├── example.css | | └── other | | └── example2.css | |__ texts | | ├── example.txt | | └── other | | └── example2.txt │ └── __init__.py ├── README.rst └── setup.py
import tarfile tar = tarfile. open("sample. gz", "r:gz") for name in ["file1", "file2", "file3"]: tar. add(name) tar.
To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.
Found a solution that worked for me here.
Using setuptools==2.0.2 I did:
setuptools.setup( ... packages=setuptools.find_packages(), include_package_data=True, # use MANIFEST.in during install ... )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With