Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

python

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?

like image 643
Niek de Klein Avatar asked Mar 21 '12 18:03

Niek de Klein


People also ask

How do I create a Python package using setup py?

Installing Python Packages with Setup.py To install a package that includes a setup.py file, open a command or terminal window and: cd into the root directory where setup.py is located. Enter: python setup.py install.

What should setup py contain?

The setup.py file may be the most significant file that should be placed at the root of the Python project directory. It primarily serves two purposes: It includes choices and metadata about the program, such as the package name, version, author, license, minimal dependencies, entry points, data files, and so on.

How do I set dependencies in Python?

There are two ways to specify dependencies for Cloud Functions written in Python: using the pip package manager's requirements. txt file or packaging local dependencies alongside your function. Dependency specification using the Pipfile/Pipfile.

Do I need requirements txt if I have setup py?

If your package is developed only by yourself (i.e. on a single machine) but you are planning to redistribute it, then setup.py / setup. cfg should be enough. If you package is developed on multiple machines and you also need to redistribute it, you will need both the requirements. txt and setup.py / setup.


1 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 
like image 106
Robert T. McGibbon Avatar answered Oct 06 '22 02:10

Robert T. McGibbon