On both Ubuntu 16.04 and Windows 7 (pip 18.1, python 2.7.15) , I am encountering an issue where I have package data
that makes its way into the tar.gz file, but they do not get installed to my scripts directory when I install with pip. My scripts directory on windows is \Python27\Scripts
. I also checked in site-packages
and the file doesn't show up there. I want to have a textfile appear alongside the python scripts when installed via pip, and I think that using data_files
does not achieve this (according to
setup.py not installing data files ?
My package structure has all files (hello.py, MANIFEST.IN, setup.py
)in the one root folder called fakeapp
. I would like to keep this structure as the project that I actually am trying to fix has this structure.
I have looked up many answers and tried:
- adding an empty
__init__.py
to the root of the repo and this didn't fix it. - I've tried adding and removing
include_package_files=True
to no avail - I've tried specifying
package_data={'':['texto.txt']}
as well as
addinginclude texto.txt
toMANIFEST.in
to no avail. - This answer: suggests to use bdist, which also didn't work.
I'm sure that this is a duplicate question but I have not been able to get any solution to work.
So here's my test case: setup.py
from setuptools import setup
setup(
author='hi',
author_email='hi@hi.com',
description="test",
scripts=['hello.py',],
license='MIT',
name='hi',
version='v2018.12.02',
include_package_data=True
)
hello.py:
#!/usr/bin/env python
def main():
print('hello world!')
if __name__ == '__main__':
main()
MANIFEST.in:
include texto.txt
I created a tar.gz in dist/ with
python setup.py sdist
and my texto.txt is in that tarball.
and then i installed with
pip install dist\hi-2018.12.2.tar.gz
and only hello.py
makes its way into C:\Python2.7\Scripts
What am I doing wrong?
Directory tree :
│ hello.py
│ MANIFEST.in
│ setup.py
│ texto.txt
│
├───dist
│ hi-2018.12.2.tar.gz
│
└───hi.egg-info
dependency_links.txt
PKG-INFO
SOURCES.txt
top_level.txt