Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install local wheel file with requirements.txt

Have a local package ABC-0.0.2-py3-none-any.whl. I want to install it in the different project through requrements.txt. e.g.

requirements.txt

ABC==0.0.2
Flask==1.1.2
flask-restplus==0.13.0
gunicorn==20.0.4

Is it possible to install the ABC package this way. ABC-0.0.2-py3-none-any.whl is included in source code. I had to pip install ABC-0.0.2-py3-none-any.whl separately.

like image 340
Rajan Sharma Avatar asked Jul 17 '20 15:07

Rajan Sharma


People also ask

How do I manually install a WHL file?

You can install the . whl file, using pip install filename . Though to use it in this form, it should be in the same directory as your command line, otherwise specify the complete filename, along with its address like pip install C:\Some\PAth\filename .

How do I install pip packages from requirements txt?

Use the pip install -r requirements. txt command to install all of the Python modules and packages listed in your requirements. txt file.

How do I install WHL file without pip?

whl files are just zip archives, so you can just extract their content and play with libraries path variable to make it work.


1 Answers

This is called a direct reference. Since version 19.3, pip support this in both command line and requirement files. Check out an example (under ###### A particular file ######) from the official documentation.

As to OP's question, simply put the local wheel's relative path, i.e., ./<my_wheel_dir>/<my_wheel.whl>, in requirement.txt, e.g.,

./local_wheels/ABC-0.0.2-py3-none-any.whl
Flask==1.1.2
flask-restplus==0.13.0
gunicorn==20.0.4
like image 66
chjch Avatar answered Oct 03 '22 14:10

chjch