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.

Poetry ignores platform constraint when using local path

See original GitHub issue

Issue

Hello, I’m attempting to setup poetry such that a couple of local libraries are only installed when using windows. However, the platform argument is failing in two ways. When I use platform and path arguments on ubuntu, like so:

gdal = {platform = "windows", path = "thirdparty/GDAL-3.1.2-cp37-cp37m-win32.whl"}

Even though I am not on windows, poetry keeps trying to install the library and failing because the install will only work on windows. As a workarounds I have tried:

gdal = {markers = "sys_platform == 'windows'", path = "thirdparty/GDAL-3.1.2-cp37-cp37m-win32.whl"}
gdal = {markers = "sys_platform != 'windows'", path = "thirdparty/GDAL-3.1.2-cp37-cp37m-win32.whl"}
gdal = {markers = "sys_platform == 'windows' and sys_platform != 'linux'", path = "thirdparty/GDAL-3.1.2-cp37-cp37m-win32.whl"}

But it keeps ignoring my platform requirement. I have a feeling the problem comes from the combination of path and platform markers.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
neersightedcommented, Sep 25, 2022

@billfreeman44 your issue is different – this issue is specifically for path dependencies, not URL dependencies. That being said, the following works as expected on every platform for me – I suspect your markers are just slightly off:

[[tool.poetry.dependencies.hdbscan]]
python = "3.9"
markers = "platform_python_implementation == 'CPython' and sys_platform == 'linux' and platform_machine == 'x86_64'"
url = "https://github.com/rxfork/hdbscan/releases/download/0.8.28/hdbscan-0.8.28-cp39-cp39-linux_x86_64.whl"

[[tool.poetry.dependencies.hdbscan]]
python = "3.9"
markers = "platform_python_implementation == 'CPython' and sys_platform == 'linux' and platform_machine == 'aarch64'"
url = "https://github.com/rxfork/hdbscan/releases/download/0.8.28/hdbscan-0.8.28-cp39-cp39-linux_aarch64.whl"

[[tool.poetry.dependencies.hdbscan]]
markers = "python_version != '3.9' or sys_platform != 'linux'"
version = "0.8.28"

If you need more help or advice, please start a Discussion, join Discord, or create a detailed issue report if you think there may be a bug.

0reactions
neersightedcommented, Oct 10, 2022

Thanks for the analysis @dimbleby – we’ve solved the original issue and the issue that I replied to. Your conclusions track for me and answer the version @espdev commented on. Closing as resolved/tracking @espdev’s version in #6710.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Defining metadata (meta.yaml) - Conda
Instead, Windows follows DLL search path rules or more natively supports relocatability using relative paths. Because of this, conda ignores most prefixes.
Read more >
Configuration Options - Renovate Docs
Older Composer versions will be run with --ignore-platform-reqs , which means that all platform constraints (including the PHP version) will be ignored by ......
Read more >
Repositories | Documentation | Poetry - Python dependency ...
Poetry treats repositories to which you publish packages as user specific and not project specific configuration unlike package sources. Poetry, today, only ...
Read more >
How can I specify dependencies on operating system in ...
Poetry will then ignore yourpackage when poetry install is used on other platforms, but not give any errors. If it is a hard...
Read more >
Ask HN: Why Poetry did not become a mainstream package ...
If I install something with pip, the newly installed package goes into ... keep your venv folder separate from the project, add platform...
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