51

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='jrh@example.com',
    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?

Taylor D. Edmiston
  • 12,088
  • 6
  • 56
  • 76
Niek de Klein
  • 8,524
  • 20
  • 72
  • 143
  • Possible answer at http://stackoverflow.com/questions/8295644 He said switching to Python 2.7.2 fixed the problem. – enderskill Mar 21 '12 at 18:36

2 Answers2

72

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
Robert T. McGibbon
  • 5,075
  • 3
  • 37
  • 45
  • 6
    Even better, you can import from `setuptools`, and if that raises an `ImportError` import from `distutils.core` instead. – Jim Garrison Jun 15 '13 at 10:20
33
try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup
Yauhen Yakimovich
  • 13,635
  • 8
  • 60
  • 67
  • 1
    I tried this when installing jip for jython and found that it doesn't work. This piece of code you mention is exactly the code at the top of the setup.py and I get the warning message method by Niek. – Eamonn Kenny Jan 26 '18 at 14:08