Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I specify library versions in setup.py?

In my setup.py file, I've specified a few libraries needed to run my project:

setup(     # ...     install_requires = [         'django-pipeline',         'south'     ] ) 

How can I specify required versions of these libraries?

like image 979
Naftuli Kay Avatar asked Nov 17 '11 03:11

Naftuli Kay


People also ask

How do I set Python version in setup py?

As the setup.py file is installed via pip (and pip itself is run by the python interpreter) it is not possible to specify which Python version to use in the setup.py file.

What is version in setup py?

The best technique is to define __version__ in your product code, then import it into setup.py from there. This gives you a value you can read in your running module, and have only one place to define it. The values in setup.py are not installed, and setup.py doesn't stick around after installation.

How do I change the Python package version?

How do I Install a Specific Version of a Python Package? To install a specific version of a Python package you can use pip: pip install YourPackage==YourVersion . For example, if you want to install an older version of Pandas you can do as follows: pip install pandas==1.1. 3 .

What is Setup_requires in setup py?

The items listed in setup_requires get implicitly installed whenever you execute the setup.py but one of the common ways that the setup.py is executed is via another tool, such as pip , who is already managing dependencies.


1 Answers

I'm not sure about buildout, however, for setuptools/distribute, you specify version info with the comparison operators (like ==, >=, or <=).

For example:

install_requires = ['django-pipeline==1.1.22', 'south>=0.7'] 
like image 75
Adam Wagner Avatar answered Sep 30 '22 16:09

Adam Wagner