Skip to content

Equivalent of pip install --no-binary #365

Closed

Description

@spapanik
  • 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?

Activity

  1. jambonrose commented on Sep 9, 2018

    @jambonrose

    I would appreciate some clarity on this front as well. The currently recommended installation of psycopg2 is:

    python3 -m pip install psycopg2>=2.7,<2.8 --no-binary psycopg2
    

    What is the right way to install psycopg2 with Poetry?

    Thanks!

  2. rectalogic commented on Nov 16, 2018

    @rectalogic

    This seems to work:

    PIP_NO_BINARY="psycopg2" poetry install

  3. RevolutionTech commented on Mar 25, 2019

    @RevolutionTech

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

  4. janw commented on Oct 2, 2019

    @janw

    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.

  5. RevolutionTech commented on Oct 3, 2019

    @RevolutionTech

    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.

  6. b-long commented on Dec 27, 2019

    @b-long

    Related / duplicate: #1316 ?

  7. b-long commented on Dec 27, 2019

    @b-long

    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:

    1. Is this currently the best practice?
    2. Is there any method of configuring this via pyproject.toml, poetry.lock, or poetry.toml ?
    3. Are there any discussions in the Poetry namespace or https://github.com/pypa namespace to follow which might provide an answer to # 1 or # 2 ?
  8. spapanik commented on Feb 27, 2020

    @spapanik
    Author

    Related / duplicate: #1316 ?

    Yes, indeed

  9. jo7ueb commented on Oct 13, 2020

    @jo7ueb

    I'm watching this issue as opencv-python requires --no-binary option in my case.

  10. rendaw commented on Oct 19, 2020

    @rendaw

    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.

  11. rendaw commented on Oct 19, 2020

    @rendaw

    PIP_NO_BINARY environment variable no longer works since (1.10?) since file resolution is being resolved by Poetry itself no longer pip.

  12. adriantre commented on Jan 13, 2021

    @adriantre

    To install e.g. rasterio without wheels for GDAL, we need to provide the --no-binary flag. Current workaround is:

    poetry add rasterio
    poetry run pip install --force-reinstall rasterio --no-binary rasterio
    

    which feels like bad practice.

  13. simon-keith commented on Jan 21, 2021

    @simon-keith

    We have a similar issue when installing geopandas with the pygeos backend, where we need to do :

    pip install pygeos geopandas --no-binary pygeos,shapely
    
  14. kylebarron commented on Jan 21, 2021

    @kylebarron

    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
    
  15. sallamander commented on Feb 11, 2021

    @sallamander

    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?

  16. flyte commented on Mar 1, 2021

    @flyte

    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

    pip install <project>

    to

    pip install --no-binary pyyaml pyyaml
    pip install <project>

    sucks.

    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 🤷

  17. dazza-codes commented on Mar 6, 2021

    @dazza-codes
    Contributor

    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
    

    Or build the package and then pip install it:

    rm -rf dist/*
    poetry build
    python -m pip install \
          --no-compile \
          --force-reinstall \
          --no-binary fiona,pygeos,pyproj,shapely,rasterio,rtree \
          ./dist/*.tar.gz
    

    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.

  18. byoungb commented on Feb 7, 2022

    @byoungb

    Another solution that appears to work for me is to use the url option and provide the source tar url.

    cryptography = { url = "https://files.pythonhosted.org/packages/f9/4b/1cf8e281f7ae4046a59e5e39dd7471d46db9f61bb564fddbff9084c4334f/cryptography-36.0.1.tar.gz" }
    

    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.

  19. joshfriend commented on Feb 16, 2022

    @joshfriend

    This is how I would have liked to see an option to skip wheels:

    grpcio = { version = "^1.43.0", format = "sdist" }

    or maybe to more closely match the pip flags:

    grpcio = { version = "^1.43.0", no_binary = true }

    (grpc/grpc#28387)

  20. hhstore commented on Mar 7, 2023

    @hhstore

    poetry config:

    # Skip all binaries
    $ poetry config --local installer.no-binary :all:
    
    # Skip specific package binaries
    $ poetry config --local installer.no-binary httpx,uvicorn
    
    # Do not skip any binaries (default)
    $ poetry config --local installer.no-binary :none:
  21. github-actions commented on Feb 29, 2024

    @github-actions

    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.

  22. locked as resolved and limited conversation to collaborators on Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/configRelated to configuration managementkind/featureFeature requests/implementations

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions