Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Install pre-requisites with setup.py

I have pure python package that relies on 3 other python packages: I'm using distutils.core.setup to do the installation.

This is my code from setup.py:

from distutils.core import setup

setup(
    name='mypackage',
    version='0.2',
    scripts=['myscript'],
    packages=['mypackage'],
    install_requires=[
        'netifaces > 0.5',
        'IPy > 0.75',
        'yaml > 3.10'])

I specified the modules I need with install_requires, but it seems to have no effect when I run

python ./setup.py install

How can I ensure that the modules that mypackage depends on are installed?

like image 861
Sumanth Vepa Avatar asked Nov 01 '22 07:11

Sumanth Vepa


1 Answers

distutils has no functionality for downloading, or even verifying, prerequisites; its install_requires is only there for documentation.

If you want that, you need the third-party library setuptools.

Most people already have setuptools, and hopefully pip, and will be using them to install your package anyway (assuming you plan to distribute over PyPI), but if you include the setuptools bootstrap, it will take care of installing setuptools if needed to install those dependencies.

like image 184
abarnert Avatar answered Nov 15 '22 03:11

abarnert