Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does "pip install" not include my package_data files?

I can't figure out why when I run pip install ../path_to_my_proj/ (from a virtualenv) none of the data files are copied across to the sitepackage/myproj/ folder. The python packages are copied across correctly.

python version 3.4.4

My project directory is like this:

├── myproj
│   ├── __init__.py
│   ├── module1.py
│   └── module2.py
├── data_files
|    ├── subfolder1
│    |   ├── datafile.dll
│    |   └── datafile2.dll
|    └── subfolder2
│        ├── datafile3.dll
│        └── datafile4.dll
|
├── MANIFEST.in
└── setup.py

And my MANIFEST.in looks like

recursive-include data_files *
include README.md

my setup looks like:

setup(
    name='myproj',
    version='0.1.1',
    install_requires=['requirement'],
    packages=['myproj'],
    include_package_data=True,
)  
like image 456
Luke McAuley Avatar asked Mar 14 '17 16:03

Luke McAuley


People also ask

Does pip install all dependencies?

The pip install <package> command always looks for the latest version of the package and installs it. It also searches for dependencies listed in the package metadata and installs them to ensure that the package has all the requirements that it needs.

Where does pip install download files?

The pip command has options for installing, upgrading and deleting packages, and can be run from the Windows command line. By default, pip installs packages located in the Python Package Index (PyPI), but can also install from other indexes.

Why pip install is not working?

A “pip: command not found” error occurs when you fail to properly install the package installer for Python (pip) needed to run Python on your computer. To fix it, you will either need to re-install Python and check the box to add Python to your PATH or install pip on your command line.

How do you see all packages that I pip installed?

If you want to list all the Python packages installed in an environment, pip list command is what you are looking for. The command will return all the packages installed, along with their specific version and location.


1 Answers

I encountered the same problem and asked about it on https://gitter.im/pypa/setuptools. The result? You just can't do that. data_files must live under myproj.

You can fake it by putting an empty __init__.py in data_files, but then it will get put into PYTHONHOME\Lib\site-packages along side myproj at same level, polluting the name space.

like image 148
matt wilkie Avatar answered Oct 04 '22 07:10

matt wilkie