Picking wrong platform installing a dependency with multiple constraints
See original GitHub issue- I am on the 1.0.5 Poetry version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).
- OS version and name: Ubuntu 18.04
- Poetry version: 1.0.5
- Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/leon19/42bf22ddc791e0500c614d461c32a486
Issue
Markers are not working properly with multiple constraints dependencies as stated in the docs
I am trying to install a dependency from an URL based on the platform, different URLs for every platform (markers = "sys_platform == 'linux'"
) and poetry is picking the URL from the platform darwin
when I’m under a linux
platform
I have not tested yet what happens on a Darwin platform. Will update the issue when I do
Update:
If I reverse the order of the dependencies, the first line the darwin url, it works on Linux. The same behaviour applies on Darwin
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:27 (4 by maintainers)
Top Results From Across the Web
Cabal install error with conflicting constraints - Stack Overflow
So right now I'm trying to run cabal install --lib bytestring , seems simple enough. But every time I run this I get...
Read more >Adding and Updating Software in Oracle® Solaris 11.3
A constraint package specifies which versions of packages can be installed. These version constraints help keep the system in a supportable state across ......
Read more >Dependency specification | Documentation | Poetry - Python ...
Version constraints Caret requirements Caret requirements allow SemVer compatible updates to a ... For instance, if we previously ran poetry add requests@^2.
Read more >Dependency Resolution - pip documentation v22.3.1
pip is capable of determining and installing the dependencies of packages. The process of determining which version of a dependency to install is...
Read more >Upgrading versions of transitive dependencies
Direct dependencies vs dependency constraints ... A component may have two different kinds of dependencies: ... It's quite common that issues with dependency...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@leon19 try chaging it to the following (this is only a partial workaround - see below).
This will work if you are on a linux environment. I did notice that the generated lockfile will only contain the first specified url (in this case command will succeed since I was working on a linux machine and linux platform was specified first). If I were to change the order, it will fail again. However, when building the wheel generated the correct metadata.
From what I can tell, when
markers
are explicitly used the constraints get populated differently.Issue 1: This pertains to the use of “url”. When duplicate dependencies are being merged, url and markers are ignored resulting in only the first entry to be used (in this case the linux url). Ideally, the dependency graph should be branched due to the existance of the platform marker and the url should be considered when merging duplicates.
Additionally, during investigation, I had a quick look at how this was being processed. It did raise a few questions (which might be separate issue(s) to be dealt with).
When markers are explicitly provided (eg:
markers = "sys_platform == 'win32'", python = ">=3.6"
);Issue 2: the python version specified is ignored if
markers
are explicitly specified (unsure if this is expected behaviour). https://github.com/python-poetry/poetry/blob/ae6d64ded40bea9019f7e1de229cd0b360d65e70/poetry/packages/package.py#L349-L359Issue 3: sole use of markers causes solver to be stuck in an infinite loop. As an example, this works.
However, this causes an infinite loop.
@finswimmer would be good to get your thoughts on the above.
I tried several combinations and none worked. Among the things I tried were the following things:
I tried both and similar variations of the two above with poetry 1.1.0, 1.1.1, 1.1.2, 1.1.3 and 1.1.4
In all cases, the first entry was always used no matter what platform I was on. So on Linux it downloaded the windows wheel. And On Windows, if you changed the order, it took the instructions for linux / mac os.
Could be clarified how exactly this should work and with what poetry versions in specific. So far it failed with all versions, so I’m slightly confused why this issue has been marked as resolved.