question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for pip install --build-options / --global-options / --install-options

See original GitHub issue
  • 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

There are some packages that in order to be installed you need to pass additional options to setup.py. There is support for this in pip. E.g. to install GDAL on Ubuntu 18.04 you need to install gdal-bin and libgdal-dev using apt and then to issue:

pip install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version`

The question is, does poetry support this? Is there a way to specify these options in pyproject.toml? If not, how do you suggest handling this case in a project that depends on such packages?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:49
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
pakalcommented, May 27, 2019

I confirm that without such options, some packages like Pillow, rcssmin etc. can be a pain to install, especially when they try to build optional C extensions on environments where it’s not possible. Having these pip-like options to be put in the listing of dependencies would be a great feature.

5reactions
higherorderfunctorcommented, Nov 5, 2019

I did some preliminary exploring. Assuming each dependency is installed via a different call to PIP, then those args would need to be passed at this line. https://github.com/sdispater/poetry/blob/b218969107e49dc57e65dbc0d349e83cbe1f44a8/poetry/installation/pip_installer.py#L115

There are two paths that define *args that can be found here and here: https://github.com/sdispater/poetry/blob/b218969107e49dc57e65dbc0d349e83cbe1f44a8/poetry/installation/pip_installer.py#L41 https://github.com/sdispater/poetry/blob/b218969107e49dc57e65dbc0d349e83cbe1f44a8/poetry/installation/pip_installer.py#L182

The entry point for these paths is here and here. I am assuming those options would need to be extracted from the package argument and included in *args: https://github.com/sdispater/poetry/blob/b218969107e49dc57e65dbc0d349e83cbe1f44a8/poetry/installation/pip_installer.py#L30 https://github.com/sdispater/poetry/blob/b218969107e49dc57e65dbc0d349e83cbe1f44a8/poetry/installation/pip_installer.py#L170

The toml schema for dependencies is here which I assume needs to be aware of the two options: https://github.com/sdispater/poetry/blob/b218969107e49dc57e65dbc0d349e83cbe1f44a8/poetry/json/schemas/poetry-schema.json#L193

The dependency definition that I assume is passed to the install commands above is located here which would need to be aware of the options: https://github.com/sdispater/poetry/blob/b218969107e49dc57e65dbc0d349e83cbe1f44a8/poetry/packages/dependency.py#L21

Dependencies are built here which looks to parse the options out of the toml file and build the dependency definition which would need to be updated: https://github.com/sdispater/poetry/blob/b218969107e49dc57e65dbc0d349e83cbe1f44a8/poetry/packages/package.py#L264

I haven’t fully traced the life-cycle of a Dependency to the PipInstaller. It looks like Dependencies are stored on the package here (I don’t think any code change would be needed here): https://github.com/sdispater/poetry/blob/master/poetry/packages/package.py#L68

Dependencies look to be “converted” to packages here (no code change needed I can see): https://github.com/sdispater/poetry/blob/b218969107e49dc57e65dbc0d349e83cbe1f44a8/poetry/installation/installer.py#L495

More maybe needed… such as ensuring those options are exposed post-build.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pip install - pip documentation v22.3.1
Description#. Install packages from: PyPI (and other indexes) using requirement specifiers. VCS project urls. Local project directories.
Read more >
Syntax errors on "pip install openexr": Wrong compiler?
I have the Buildtools 2019 installed and added the 2017 ones but it doesn't help. I guess I have to specify the compiler...
Read more >
Solved: YDK installation help - Cisco Community
Solved: Hello, I am new to YDK and attempting to install the kit on a CentOS 7 system using the getting started guide...
Read more >
cmdoptions.py
_internal.locations import USER_CACHE_DIR, src_prefix from pip. ... of wheels due to the use of --build-options ' '/ --global-options / --install-options.
Read more >
pip install — pip 10.0.0.dev0 documentation
pip install [options ] <requirement specifier> [package-index-options] ... pip also supports installing from “requirements files”, which provide an easy way ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found