2

I read a lot of answers on this question, but no solution works for me.

Project layout:

generators_data\
    en_family_names.txt
    en_female_names.txt
__init__.py
generators.py
setup.py

I want include "generators_data" with it's content into installation. My setup.py:

from distutils.core import setup

setup(name='generators',
      version='1.0',
      package_data={'generators': ['generators_data/*']}
      )

I tried

python setup.py install

got

running install
running build
running install_egg_info
Removing c:\Python27\Lib\site-packages\generators-1.0-py2.7.egg-info
Writing c:\Python27\Lib\site-packages\generators-1.0-py2.7.egg-info

but generators_data directory doesn't appear in "c:\Python27\Lib\site-packages\". Why?

1 Answer 1

2

The code you posted contains two issues: setup.py should be sibling to the package you want to distribute, not inside it, and you need to list packages in setup.py.

Try with this this layout:

generators/       # project root, the directory you get from git clone or equivalent
    setup.py
    generators/   # Python package
        __init__.py
        # other modules
        generators_data/
            names.txt

And this setup.py:

setup(name='generators',
      version='1.0',
      packages=['generators'],
      package_data={'generators': ['generators_data/*']},
)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.