简体   繁体   中英

Unable to install locally built python package

I recently noticed that I am unable to install my own Python packages. I was getting an error that indicated that a package containing Python modules was invalid. So, I updated my setup.py and removed some elements, this is what I have now:

from setuptools import setup

setup(
    name='project',
    version='0.3.0',
    packages=['project'],
    license='GPL',
    #zip_safe=False,
    #include_package_data=True,
    #package_data = { 'package': [ 'README.txt', '*.py' ] },

    install_requires=[
        'PyYAML >= 3.11',
        'logger >= 0.2.0',
    ],
    entry_points={
        'console_scripts': ['project = project:main']
    },
)

I removed some elements and called the project project. Essentially, within project, I had a package, libraries, with some Python modules. Prior to removing these lines:

#zip_safe=False,
        #include_package_data=True,
        #package_data = { 'package': [ 'README.txt', '*.py' ] },

... it was not working recently.

Oddly enough though, this setup.py was working as far as I could tell up until a month ago. That said, after commenting those items out and running python setup.py build, I no longer get the error about the package being invalid, but at the same token, I see that nothing gets installed when running pip install dist/project-0.0.1.tar.gz . Inside the file, built by python setup.py sdist , I do see all the files that I would expect to see. They just don't get installed, so I'm effectively missing all of the packages underneath the root folder (which is everything except init).

What am I missing here?

EDIT: The solution was:

packages=find_packages(),

The hackish solution for me was to do this:

packages=['project', 'project/libraries', 'project/system', 'project/services'],

For whatever reason, packages was no longer working recursively.

As soon as I did that, voila, it worked. I'll probably circle back to this later as I'm curious what changed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM