Python does not install the dependencies listed in install_requires from setuptools

I wrote a python module that depends on openpyxl. I want openpxyl to be installed as a dependency automatically using setuptools. I read that the correct way to do this is to include the following in the setup.py script:

setup(name='methpipe', version=find_version("lala", "__init__.py"), description='Utilities', author='Jonathan T', author_email=' jt@lala.com ', url='https://git.com...', packages=find_packages(), install_requires=[ 'openpxyl = 2.3.3', ], scripts=["bin/submit_run_full.py"], cmdclass=dict(install=my_install) ) 

So, I packed my module using python setup.py sdist , took the * .tar.gz file, unpacked it, and then ran python setup.py install , and openpyxl is NOT installed !!!

What am I doing wrong here?

+12
python pip setuptools
source share
3 answers

Try specifying your dependency in both install_requires and setup_requires .

Below is the setuptool documentation at https://pythonhosted.org/setuptools/setuptools.html

setup_requires

A line or list of lines indicating which other distributions should be present to start the installation of the script. setuptools will try to get them (even if you get to them using EasyInstall) before processing the rest of the setup script or commands. This argument is required if you are using distutils extensions as part of your build process; for example, extensions that process setup () arguments and turn them into EGG-INFO metadata files.

(Note: the projects listed in setup_requires will NOT be automatically installed on the system where the installation script is running. They are simply loaded into the /.eggs directory if they are not already locally available. If you want them to be installed, but also available when running the installation script, you must add them to install_requires and setup_requires.)

+2
source share

I notice when you use the override of 'install' with the key 'cmdclass'. The template below also left me with undetermined dependencies.

 Custom_Install(install): def run(self): # some custom commands install.run(self) 

Adding dependencies to setup_requires did not work for me, so in the end I just performed my own pip installation in the custom install command ..

 def pip_install(package_name): subprocess.call( [sys.executable, '-m', 'pip', 'install', package_name] ) 
0
source share

Building with sdist creates a source distribution, so I think regular dependencies don't come with your sources

0
source share

All Articles