[Distutils] install_requires setup.py install vs pip install

Tim Golden mail at timgolden.me.uk
Tue Mar 7 09:24:14 EST 2017


I have a setup.py which looks like this:

from setuptools import setup
setup(
     name='install_requires',
     py_modules = ["install_requires"],
     install_requires=['PyQt5'],
)

For the purposes of the discussion, there is an install_requires.py in 
the same directory.

I have created and activated a standard Python 3.5 venv on Windows:

py -3.5 -mvenv .venv
.venv\scripts\activate.bat
python -mpip install --upgrade pip

(I don't believe the Python version or the venv matter here, but 
including them for reproducibility).

If I pip install the module, the PyQt5 install dependency is found and 
installed:

(.venv) C:\work-in-progress\install_requires>pip install .
Processing c:\work-in-progress\install_requires
Collecting PyQt5 (from install-requires==0.0.0)
   Using cached PyQt5-5.8.1-5.8.0-cp35.cp36.cp37-none-win_amd64.whl
Collecting sip==4.19 (from PyQt5->install-requires==0.0.0)
   Using cached sip-4.19-cp35-none-win_amd64.whl
Installing collected packages: sip, PyQt5, install-requires
   Running setup.py install for install-requires ... done
Successfully installed PyQt5-5.8.1 install-requires-0.0.0 sip-4.19

If, instead, I setup.py install the module, I get the following messages:

Processing dependencies for install-requires==0.0.0
Searching for PyQt5
Reading https://pypi.python.org/simple/PyQt5/
No local packages or download links found for PyQt5
error: Could not find suitable distribution for Requirement.parse('PyQt5')

However, if I substitute instead "requests" or "simplejson" (both 
well-known packages) then setup.py install succeeds. My cursory 
inspection of https://pypi.python.org/simple/pyqt5/ doesn't reveal 
anything obviously different except for the complexity of the filenames.

I've searched around, including in the archives of this group, but can't 
find that this is a known issue. If I had to guess from the evidence, it 
would be that pip ships a more sophisticated parser of complex wheel 
filenames than setuptools.

Can anyone advise, please?

TJG



More information about the Distutils-SIG mailing list