Adding 'install_requires' to setup.py when making a python package

Question:

To make a python package, in setup.py, I have the following:

setup(
    name='TowelStuff',
    version='0.1.0',
    author='J. Random Hacker',
    author_email='[email protected]',
    packages=['towelstuff', 'towelstuff.test'],
    scripts=['bin/stowe-towels.py','bin/wash-towels.py'],
    url='http://pypi.python.org/pypi/TowelStuff/',
    license='LICENSE.txt',
    description='Useful towel-related stuff.',
    long_description=open('README.txt').read(),
    install_requires=[
        "Django >= 1.1.1",
        "caldav == 0.1.4",
    ],
)

So I remade that with my own package description and information. When I build it though I get the following warning:

distutils/dist.py:267: UserWarning: Unknown distribution option:

Does install_requires work only on certain versions?

Asked By: Niek de Klein

||

Answers:

You need to be using setuptools instead of distutils.

Near the top of your script, try replacing

from distutils.core import setup

with

from setuptools import setup
Answered By: Robert T. McGibbon
try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup
Answered By: Yauhen Yakimovich
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.