Poetry: Installing from wheels.

Created on 30 Apr 2018  路  14Comments  路  Source: python-poetry/poetry

I want to use pre-compiled binaries for windows, so I've installed a wheel from https://www.lfd.uci.edu/~gohlke/pythonlibs/#rpy2.

Can I set up poetry to install the wheel file that I've downloaded or can I point poetry to the website for installation?

Most helpful comment

Yes, you actually can, like so:

[tool.poetry.dependencies]
my-package = { file = "path/to/wheel.whl" }

All 14 comments

Yes, you actually can, like so:

[tool.poetry.dependencies]
my-package = { file = "path/to/wheel.whl" }

Thanks a ton. I thought there had to be a way to do it manually. Could you give me a link to explain the .toml functionality or briefly explain it? I've read over the PEP, but I can't find any good tutorials.

What do you want to know exactly?

Everything. I want to know how it works. Is it like a .ini file? How can I figure out what headers to use to get special functionality? Is there a good tutorial on how to use .toml files for creating python packages?

I just get random articles when I query it on google.

Should I be looking at flit? https://github.com/takluyver/flit

I just tried googling it again and I got some better results (my previous query must have been different).

The PEP defining the pyproject.toml file is purposely broad. A good article about its purpose: https://snarky.ca/clarifying-pep-518/

The idea is that tools (like poetry) can define namespaced sections in the pyproject.toml file to provide custom features (tool.poetry for instance).

At this point, what is defined in these sections are up to the tools and is not specified in any PEP.

So, poetry has its own specification and it's own sections. You can actually check out the documentation (https://poetry.eustace.io/docs/pyproject/) or the JSON Schema used for validation (https://github.com/sdispater/poetry/blob/master/poetry/json/schemas/poetry-schema.json)

I'm running into an issue with wheels--I have prodigy defined in my pyproject.toml as:

[tool.poetry.dependencies]卢
...
prodigy = {file = "packages/prodigy-1.6.1-cp35.cp36.cp37-cp35m.cp36m.cp37m-linux_x86_64.whl"}
...

(Previously I was using path instead of file.)

This used to work fine, but as of Poetry 0.12.6 I'm seeing this error:

[EnvCommandError]
Command ['/Users/max/Library/Caches/pypoetry/virtualenvs/biblioteca-py3.7/bin/pip', 'install', '--no-deps', '-e', '/U
sers/max/Documents/projects/biblioteca/packages/prodigy-1.6.1-cp35.cp36.cp37-cp35m.cp36m.cp37m-linux_x86_64.whl'] err
ored with the following output:
/Users/max/Documents/projects/biblioteca/packages/prodigy-1.6.1-cp35.cp36.cp37-cp35m.cp36m.cp37m-linux_x86_64.whl sho
uld either be a path to a local project or a VCS url beginning with svn+, git+, hg+, or bzr+
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[tool.poetry.dependencies]
my-package = { file = "path/to/wheel.whl" }

This results in

[TypeError]
'NoneType' object is not iterable

with poetry 1.0.0b1

To update the solution, poetry add works see https://python-poetry.org/docs/cli/#add

poetry add ./path/to/package.whl

Yes @ketozhang! Whenever they implemented that I celebrated lol.

Just been through all that with xdg which conflicts with pyxdg. What finally worked was to download pyxdg-0.26-py2.py3-none-any.whl and install it with pip install. Poetry then ADDed python-xdg.whl. And, after two hours fiddling, from xdg import user_config_dir finally worked

Im having an issue with installing a wheel with poetry. I follow the instructions available on https://python-poetry.org/docs/cli/#add

OS

win 10 Home Edition

Python version:

3.8.3

Wheel package

GDAL-3.1.3-cp38-cp38-win_amd64.whl available on https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal

i downloaded and wrote
poetry add GDAL-3.1.3-cp38-cp38-win_amd64.whl
[ValueError] Could not find a matching version of package GDAL-3.1.3-cp38-win_amd64.whl

followed instructions on #1409
(.venv) C:\Users\Asus\Desktop\BASURA\learning_typer>poetry add -vvv GDAL-3.1.3-cp38-cp38-win_amd64.whl Using virtualenv: C:\Users\Asus\Desktop\BASURA\learning_typer\.venv PyPI: No packages found for GDAL-3.1.3-cp38-cp38-win_amd64.whl * [ValueError] Could not find a matching version of package GDAL-3.1.3-cp38-cp38-win_amd64.whl

i also read #646 but im stuck. i Would appreciate some help.

@hectorpatino try poetry add ./GDAL-3.1.3-cp38-cp38-win_amd64.whl

@hectorpatino & others who may want to install GDAL or another binary wheel from a URL. Be aware that some web servers may block downloads based on e.g. the User-Agent header. So, even if you are able to download the file manually from the link, you may still encounter problems with the poetry URL dependency, e.g. "404 Client Error: Not Found for url".

A possible workaround is to download the wheels and host them on your own server/index (plays nicely with the original provider too).

Was this page helpful?
0 / 5 - 0 ratings