How to install wheels within setup.py

7k views Asked by At

I'm creating a project that has dependencies on packages from PyPI. Namely :

['comtypes', 'docx', 'qrcode', 'PyPDF2', 'pyqtgraph', 'PyQt5', 'numpy', 'PIL','opencv-python']

However, some of these (for example opencv-python) only contain wheel files on PyPI. https://pypi.python.org/simple/opencv-python/

From my understanding, setuptools is not compatible with .whl. Is there any way to install the dependencies from a setup.py, ideally without the use of pip?

2

There are 2 answers

2
Vibhutha Kumarage On

Download the .whl file and run

pip install <directory>/xxxx.whl

on the terminal/cmd/powershell

1
RACKGNOME On

I had this exact same problem. The issue was that I was trying to use

python setup.py develop

to install the dependencies. When you use this command it attempts to use easy-install to install the dependencies, and if the dependencies are wheel files, it will fail.

We want to use pip, so try the following command in the directory in which your setup.py file is located

pip install .

Your setup.py structure doesn't even need to change! Hope this helps mate.

Inspiration/Ref: easy_install tensorflow-gpu fails

Same question (basically): Can I use pip instead of easy_install for python setup.py install dependency resolution?