Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing from wheels. #76

Closed
Tracked by #28 ...
grabear opened this issue Apr 30, 2018 · 19 comments
Closed
Tracked by #28 ...

Installing from wheels. #76

grabear opened this issue Apr 30, 2018 · 19 comments

Comments

@grabear
Copy link

grabear commented Apr 30, 2018

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?

@sdispater
Copy link
Member

Yes, you actually can, like so:

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

@grabear
Copy link
Author

grabear commented Apr 30, 2018

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.

@sdispater
Copy link
Member

What do you want to know exactly?

@grabear
Copy link
Author

grabear commented Apr 30, 2018

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?

@grabear
Copy link
Author

grabear commented Apr 30, 2018

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).

@sdispater
Copy link
Member

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)

@maxcountryman
Copy link

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.

@lucianojoublanc-da
Copy link

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

This results in

[TypeError]
'NoneType' object is not iterable

with poetry 1.0.0b1

@ketozhang
Copy link

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

poetry add ./path/to/package.whl

@grabear
Copy link
Author

grabear commented May 22, 2020

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

@LyonsDo
Copy link

LyonsDo commented Jul 29, 2020

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

@hectorpatino
Copy link

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.

@abn
Copy link
Member

abn commented Sep 23, 2020

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

@pgenevski
Copy link

@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).

@zachliu
Copy link

zachliu commented Sep 1, 2021

in case someone is on the same boat:

I'm using Poetry 1.1.4 and i did

[tool.poetry.dependencies]
apache-airflow = {path = "apache_airflow-2.1.3-py3-none-any.whl"}

it works

@AimHighDS
Copy link

First try,
poetry add d:\libs\mysqlclient-1.4.6-cp39-cp39-win32.whl but. it's not worked.

so, appended below into pyproject.toml file

[tool.poetry.dependencies] mysqlclient = {path = "./.venv/Lib/mysqlclient-1.4.6-cp39-cp39-win32.whl"}

and, updated packages

(ats-kw32-py3.9) D:\pjt_py\ats_kw32>poetry update mysqlclient

Updating dependencies
Resolving dependencies... (0.3s)

Writing lock file

Package operations: 1 install, 0 updates, 0 removals

• Installing mysqlclient (1.4.6 D:/pjt_py/ats_kw32/.venv/Lib/mysqlclient-1.4.6-cp39-cp39-win32.whl)
`

after result, it worked fine.

(ats-kw32-py3.9) D:\pjt_py\ats_kw32>poetry show
mysqlclient 1.4.6 .venv/Lib/mysqlclient-1.4.6-cp39-cp39-win32.whl Python interface to MySQL
SQLAlchemy 1.4.41 Database Abstraction Library

@jwrth
Copy link

jwrth commented Nov 24, 2023

Hi all,

I have a question regarding providing wheels for different OS in pyproject.toml. The solution my-package = { file = "path/to/wheel.whl" } worked well for me. I am using it because one package that I need for my project makes problems when trying to install it via pip on Windows. Therefore, I provide the Windows wheel in pyproject.toml.

However, if I now try to install my package on a different OS, it throws an error because the wheel is for Windows only. Is it possible to make the installation from a wheel optional (so that it only uses this option if the installation is done on a certain platform? Or is it possible to provide multiple wheels and it just tests all of them until one works?

Thanks a lot in advance for your help!

@T145
Copy link

T145 commented Jan 8, 2024

I'm trying to do this on Windows:

xformers = [ # Best solution since the Anaconda repo only has Linux versions
    {platform = "linux", url = "https://download.pytorch.org/whl/cu121/xformers-0.0.23.post1-cp310-cp310-manylinux2014_x86_64.whl"},
    {platform = "win64", url = "https://download.pytorch.org/whl/cu121/xformers-0.0.23.post1-cp310-cp310-win_amd64.whl"}
]

But nothing happens. I've tried changing the platform to windows and that doesn't work either. Any ideas?

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests