Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install wheels within setup.py

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?

like image 255
Ronikos Avatar asked Dec 17 '16 12:12

Ronikos


2 Answers

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?

like image 158
RACKGNOME Avatar answered Oct 13 '22 09:10

RACKGNOME


Download the .whl file and run

pip install <directory>/xxxx.whl

on the terminal/cmd/powershell

like image 27
Vibhutha Kumarage Avatar answered Oct 13 '22 11:10

Vibhutha Kumarage