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

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?


Solution 1:

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

Solution 2:

try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup