0

I have a typical project structure that looks as follows:

EngineEmulator        
    ship
        engine
            emulator
            mapping
            __init__.py
        tests
            emulator
            mapping
            __init__.py           
        setup.py
        MANIFEST.in
        setup.cfg
        README.rst

My setup.py looks as follows:

from setuptools import setup, find_packages
setup(
   name='Engine',
   version=1.0.0,
   description='Engine Project',      
   packages=find_packages(
   exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
   install_requires =['pycrypto', 
                      'kombu >=1.1.3'],
   author='Demo',
   author_email='[email protected]'
   license='MIT',
   classifiers=[
    'Topic :: Demo Engine',
    'Development Status:: 3 - Iteration',
    'Programming Language :: Python -2.6'
]

)

My setup.cfg looks as follows:

[egg_info]
tag_build = .dev
tag_svn_revision = 1

[rotate]
#keep last 15 eggs, clean up order
match = .egg
keep = 15   

And My MANIFEST.in looks as follows:

include README.rst
include setup.py
recursive-include engine *

When I run python setup.py bdist the tar file it generates does not include the setup.py file. When I run pip install it complains the setup.py is missing. However when I did python setup.py sdist, it generates the tar file that has the setup.py. Any idea why?

6
  • @NedDeily I have already all the components outlined in the link. I also get a built distribution that includes all the files except setup.py so when I run pip install <generated_tar> I end up with an error saying the setup.py file is missing. Commented Jul 28, 2014 at 0:21
  • A dumb bdist doesn't include a setup.py because it's not needed: setup.py is not installed as part of a Distutils bdist distribution, basically it describes how to make a bdist from an sdist.
    – Ned Deily
    Commented Jul 28, 2014 at 0:40
  • @NedDeily When I run pip install <generated Tar> on a target machine I get setup.py missing error. Googling led me to believe that pip cannot install if setup.py is missing. Commented Jul 28, 2014 at 0:44
  • Don't try to ship a dumb bdist for general installation with pip especially for a pure Python one. A dumb bdist only applies to a particular kind of Python installation, the kind you used to generate it. Use an sdist. Or use a smart bdist format like wheels.
    – Ned Deily
    Commented Jul 28, 2014 at 0:48

1 Answer 1

4

Pip does not install Distutils dumb bdist format distributions. A more general distribution format is the sdist format which generally can be "built" for installation with any Python instance. An sdist is what would typically be uploaded to PyPI, particularly for pure Python distributions, e.g. contain no C code that would require a compiler on the target system. Current versions of pip can also install wheels, a smart bdist format which can include pure Python distributions or impure ones targeted at specific platforms.

3
  • Thanks Ned. I do have a possibility of adding a c extensions later. For now I followed the step in here. When I run pip install in my site packages I only get a Engine-1.0.0-dist-info directory. No built sources are transferred. Any pointer what I might be doing wrong? Commented Jul 28, 2014 at 1:33
  • 1
    First, get a working sdist that installs properly: python setup.py sdist && pip install dist/Engine-1.0.0.dev-r0.tar.gz. Then try building a wheel with bdist_wheel: python setup.py bdist_wheel && pip install dist/Engine-1.0.0.dev_r0-py2-none-any.whl. After fixing the various typos in your setup.py file, I had no trouble building either and they both installed the engine package as expected. Make sure you have a current version of pip installed, too: pip -V -> pip 1.5.6.
    – Ned Deily
    Commented Jul 28, 2014 at 5:35
  • Thanks Ned. I had a lower version of pip as well as some other issues. Finally got it working. One thing that I discovered though bdist_wheel does not compile (self.compile=False in bdist_wheel.py, run()), so it does not generate .pyc files. I had to set the compile option to tru by creating a custom command class extending install_lib and setting the self.compile to True to install function before calling the install of the super. Commented Jul 29, 2014 at 3:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.