Search code examples
pythondistutilssdist

Running sDist to build a package and install creates empty Build Directory


created a setup file. with the following code where setup.py is

import sys
from distutils.core import setup

setup(
    name='SomePackage',
    author='dave',
    version='0.1.0',
    author_email='dave',
    packages=['apples',],
    license='LICENSE.txt',
    url="None",
    include_package_data=True,
    description='i love apples',
    long_description=open('README.txt').read(),
    install_requires=[
        "matplotlib >= 2.0.0",
        "numpy >= 1.11.3",
        "openpyxl >= 2.4.1",
        "openturns >= 1.9",
        "pandas >= 0.19.2",
        "pip >= 9.0.1",
        "pyodbc >= 4.0.17",
        "pyqt >= 5.6.0",
        "pywin32 >= 220.0.0",
        "pywinauto >= 0.6.3",
        "qt >= 5.6.2",
        "scipy >= 0.18.1",
        "statistics >= 1.0.3.5",
        "tqdm >= 4.15.0",
        "xlwings >= 0.10.2",
    ], )

when running python setup.py sdist, the result creates a dist folder with a zip file (I am on windows). when opening this file the apples package and all the sub folders are within it. the directory tree for apples is as follows

note in the screenshot, the Files indicates they are in the Apples folder.

enter image description here

however when I deploy to another machine by

  1. unzipping zip file
  2. cd to dir
  3. python setup.py install
  4. a build folder is created in site-packages/apples
  5. within the build folder which gets copied to the site-packages folder is just two files (init.py and version.py), leaving out the sub dirs of core and slice

enter image description here


Solution

  • You need to list all packages and subpackges:

    packages=['apples', 'apples.core', 'apples.slice',],
    

    or

    from setuptools import find_packages
    …
    packages = find_packages(),