Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install wheel from a directory using Poetry

I am using a python package which has a complex build process, and hence it provides wheels for various platforms.

I am looking for a way to configurate poetry to be able to install the package using the right wheel (for each platform it will be ran on) given a path to a directory containing the wheels

This is possible with pip by using

pip install --no-index --find-links /path/to/wheels/ package_name

Note: Hacks are also welcome (e.g - wrapping the wheels in another python package / running code in some setup.py)

like image 281
Alonme Avatar asked Oct 21 '25 12:10

Alonme


2 Answers

As far as I can tell, Poetry does not have a feature comparable to pip's --find-links, as stated by this open feature request.

For such a use case, I would recommend to use simpleindex.

Also note Poetry's "Single Page Link Source" feature that might help.

like image 199
sinoroc Avatar answered Oct 23 '25 02:10

sinoroc


You can use pip with poetry as they both can point to the same virtual environment.

poetry shell
pip install --no-index --find-links /path/to/wheels/ package_name

However you cannot make any of these installs permanent (part of pyproject.toml)

As a workaround you can make "post-install steps" with pip part of Github Actions, Makefile, or any other install recipe.

like image 26
Mikko Ohtamaa Avatar answered Oct 23 '25 00:10

Mikko Ohtamaa