You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the issues of this repo and believe that this is not a duplicate.
I have searched the documentation and believe that my question is not covered.
Question
How can I specify that I don't want the binary package to be installed, ie. the equivalent of pip install --no-binary?
Reacted by Kepi, Ryan Schuetzler, Will Gordon, Bennett Rogers, Aris Chow, b-long, Ryan Kaneshiro, Bertrand Croq, Arvid, 이정민(Jeong-Min Lee) / Merchant and 53 more
Is there a solution with Poetry that involves a change to the pyproject.toml or something similar?
The team I work on is trying to install psycopg2 with --no-binary, and although I appreciate that your solution works well @rectalogic, it would be ideal if the solution wasn't co-ordinating that all developers on the team add an environment variable whenever executing poetry install (or update their local ~./bashrc, etc.).
I agree with @RevolutionTech that this should be an option for dependencies in pyproject.toml, a no-binary flag. If this is still something to be done, I'd be happy to come up with an implementation.
Reacted by Andrew Pinkham, Stephanos Kuma, 이정민(Jeong-Min Lee) / Merchant, Matt DiCarlo, Andrii Oriekhov, sergioluka, Chris Chow, Ezra Eisbrenner, Arvid, sbreidbach-edr and 21 more
In the interest of full transparency I should mention that this is no longer an urgent need for the team I work on since modern versions of psycopg2 do not install the binary version by default anyways.
That said, I still think that this would be a really great feature, and I am sure there are other packages besides psycopg2 where this presents a problem.
I ran into an issue with the neuralcoref library (github, pypi) which was solved by changing my workflow to PIP_NO_BINARY="neuralcoref" poetry install .
A few questions:
Is this currently the best practice?
Is there any method of configuring this via pyproject.toml, poetry.lock, or poetry.toml ?
This is not a duplicate of #1316 since this issue, as an install override, doesn't drag in the question of config files/lock file specifications, platform string matching, etc. There will always be systems that have nonstandard system libraries, patches, feature flags turned on/off that cause wheel incompatibility, where it doesn't make sense to force everyone to use source packages.
Another example, gevent==1.4.0 wheel doesn't work with new versions of Python 3.7 (Debian) due to binary incompatibility. Installing from source works, but PIP_NO_BINARY or other environment variables don't work. Manual fix is to pip remove gevent then install it manually with --no-binary after setting up the venv.
Reacted by Kyle Barron, Maurizio Tomasi, Fabien and Son Sumin
Reinstalling with pip --force-reinstall after poetry install is an interesting workaround. It's probably ideal to grab the version from the Poetry lockfile so that you're installing the same package version:
poetry add rasterio
rasterio_version=$(poetry show rasterio | grep version | cut -d ':' -f 2)
poetry run pip install --force-reinstall rasterio=="$rasterio_version" --no-binary rasterio
Reacted by Adrian Tofting, iksm_mski, Phillip Verheyden, Steffen Müller, Adrian Torchiana, Andrew Duberstein, Drew Silcock, Alain Schaller, rkeulemans, Dan O'Donovan and 1 more
Has anybody figured out how to get this into a poetry.lock and / or pyproject.toml file? The --force-reinstall works, but it'd be nice to be able to just do a poetry install from the toml or lock file and have that work.
Are there any plans to support this in the future if it's not already supported in some way?
Reacted by Chip Franzen, Adrian Tofting, Diogo Neto, Eterna2, Morteza Morshedi, ChristianCoenen, Gareth Simons, Danilo Imparato and Son Sumin
None of these workarounds work when your project is published to PyPI and the user installs it with pip.
Our project is intended to run on small systems like Raspberry Pi, one of which (Zero W) is still being produced with a 32bit CPU. PyYAML doesn't include 32 bit binaries, so we need to make sure the source package is installed instead of the 64bit wheel.
Is there currently a workaround that will suit this use case? Changing the instructions from
EDIT: PyYAML was only failing to install because we were using --pre to install the pre-release version of the project, even though pip was downloading and using the exact same PyYAML .tar.gz package with and without --pre 🤷
One option to try is to take full advantage of the dependency analysis that poetry provides to manage compatible versions and then export the lock file to a requirements.txt file, e.g.
poetry export --without-hashes --format requirements.txt --output requirements.txt
# it can help to remove editable flags:
sed -i -e 's/^-e //g' requirements.txt
python -m pip install \
--force-reinstall \
--no-binary pygeos,shapely,rasterio,pyproj \
-r requirements.txt
The first approach can leverage the poetry.lock content since poetry export uses it (AFAIK). The second approach could take longer for pip to resolve the dependency tree, and possibly not as well as poetry.
In this approach, poetry might not install anything, pip does it all. In this approach, the env-var options should work when a build environment already provides shared libs that should be used for the python bindings.
Reacted by Kristoffer Bakkejord, Simon Mutch and Mason Lin
It is not ideal, and a bit more work to maintain, but in my case it works.
Background:
I am running on AWS's aarch64, which for some reason the wheel created for aarch64 is not working... but everything works fine if it is built from source.
Reacted by Wakana Nogami, ChristianCoenen, Thibault Ducret, Zak Henry, James Webster, Thomas Meschede, Pietro De Nicolao, Joey Asperger, Tristan Schrader, Artem Innokentiev and 23 more
# Skip all binaries
$ poetryconfig --localinstaller.no-binary:all:
# Skip specific package binaries
$ poetryconfig --localinstaller.no-binaryhttpx,uvicorn# Do not skip any binaries (default)
$ poetryconfig --localinstaller.no-binary:none:
Reacted by Francesco Frassinelli, Osvaldo Santana Neto, Philip Orlando, Xiaowen Li, Linus Groh, berlin4apk, Iván Moreno, Jeff Picard, Phuong Nguyen, Timothy Makobu and 3 more
Reacted by Philipp Middendorf and Son Sumin
Reacted by Maor Kadosh, Jeff Picard, Lawrence Adams and Son Sumin
Activity
jambonrose commentedon Sep 9, 2018
I would appreciate some clarity on this front as well. The currently recommended installation of
psycopg2is:What is the right way to install
psycopg2with Poetry?Thanks!
rectalogic commentedon Nov 16, 2018
This seems to work:
PIP_NO_BINARY="psycopg2" poetry installRevolutionTech commentedon Mar 25, 2019
Is there a solution with Poetry that involves a change to the
pyproject.tomlor something similar?The team I work on is trying to install
psycopg2with--no-binary, and although I appreciate that your solution works well @rectalogic, it would be ideal if the solution wasn't co-ordinating that all developers on the team add an environment variable whenever executingpoetry install(or update their local~./bashrc, etc.).janw commentedon Oct 2, 2019
I agree with @RevolutionTech that this should be an option for dependencies in
pyproject.toml, ano-binaryflag. If this is still something to be done, I'd be happy to come up with an implementation.RevolutionTech commentedon Oct 3, 2019
In the interest of full transparency I should mention that this is no longer an urgent need for the team I work on since modern versions of
psycopg2do not install the binary version by default anyways.That said, I still think that this would be a really great feature, and I am sure there are other packages besides
psycopg2where this presents a problem.b-long commentedon Dec 27, 2019
Related / duplicate: #1316 ?
b-long commentedon Dec 27, 2019
I ran into an issue with the
neuralcoreflibrary (github, pypi) which was solved by changing my workflow toPIP_NO_BINARY="neuralcoref" poetry install.A few questions:
spapanik commentedon Feb 27, 2020
Yes, indeed
jo7ueb commentedon Oct 13, 2020
I'm watching this issue as
opencv-pythonrequires --no-binary option in my case.rendaw commentedon Oct 19, 2020
This is not a duplicate of #1316 since this issue, as an install override, doesn't drag in the question of config files/lock file specifications, platform string matching, etc. There will always be systems that have nonstandard system libraries, patches, feature flags turned on/off that cause wheel incompatibility, where it doesn't make sense to force everyone to use source packages.
Another example,
gevent==1.4.0wheel doesn't work with new versions of Python 3.7 (Debian) due to binary incompatibility. Installing from source works, butPIP_NO_BINARYor other environment variables don't work. Manual fix is topip remove geventthen install it manually with--no-binaryafter setting up the venv.rendaw commentedon Oct 19, 2020
PIP_NO_BINARYenvironment variable no longer works since (1.10?) since file resolution is being resolved by Poetry itself no longer pip.adriantre commentedon Jan 13, 2021
To install e.g. rasterio without wheels for GDAL, we need to provide the
--no-binaryflag. Current workaround is:which feels like bad practice.
simon-keith commentedon Jan 21, 2021
We have a similar issue when installing geopandas with the pygeos backend, where we need to do :
kylebarron commentedon Jan 21, 2021
Reinstalling with
pip --force-reinstallafterpoetry installis an interesting workaround. It's probably ideal to grab the version from the Poetry lockfile so that you're installing the same package version:sallamander commentedon Feb 11, 2021
Has anybody figured out how to get this into a
poetry.lockand / orpyproject.tomlfile? The--force-reinstallworks, but it'd be nice to be able to just do apoetry installfrom the toml or lock file and have that work.Are there any plans to support this in the future if it's not already supported in some way?
flyte commentedon Mar 1, 2021
None of these workarounds work when your project is published to PyPI and the user installs it with pip.
Our project is intended to run on small systems like Raspberry Pi, one of which (Zero W) is still being produced with a 32bit CPU. PyYAML doesn't include 32 bit binaries, so we need to make sure the source package is installed instead of the 64bit wheel.
Is there currently a workaround that will suit this use case? Changing the instructions from
to
sucks.
EDIT: PyYAML was only failing to install because we were using
--preto install the pre-release version of the project, even though pip was downloading and using the exact same PyYAML.tar.gzpackage with and without--pre🤷dazza-codes commentedon Mar 6, 2021
One option to try is to take full advantage of the dependency analysis that poetry provides to manage compatible versions and then export the lock file to a requirements.txt file, e.g.
Or build the package and then pip install it:
The first approach can leverage the
poetry.lockcontent sincepoetry exportuses it (AFAIK). The second approach could take longer for pip to resolve the dependency tree, and possibly not as well as poetry.In this approach, poetry might not install anything, pip does it all. In this approach, the env-var options should work when a build environment already provides shared libs that should be used for the python bindings.
byoungb commentedon Feb 7, 2022
Another solution that appears to work for me is to use the
urloption and provide the source tar url.It is not ideal, and a bit more work to maintain, but in my case it works.
Background:
I am running on AWS's aarch64, which for some reason the wheel created for aarch64 is not working... but everything works fine if it is built from source.
joshfriend commentedon Feb 16, 2022
This is how I would have liked to see an option to skip wheels:
or maybe to more closely match the pip flags:
(grpc/grpc#28387)
hhstore commentedon Mar 7, 2023
poetry config:
github-actions commentedon Feb 29, 2024
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.