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

Python

Python Problem Overview


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?

Python Solutions


Solution 1 - Python

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 - Python

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNiek de KleinView Question on Stackoverflow
Solution 1 - PythonRobert T. McGibbonView Answer on Stackoverflow
Solution 2 - PythonYauhen YakimovichView Answer on Stackoverflow