Poetry: Poetry resolves differently when fetching packages through a local devpi mirror

Created on 23 Nov 2018  路  6Comments  路  Source: python-poetry/poetry

Issue

Given the linked pyproject.toml, poetry will resolve differently (and incorrectly) when running against a local devpi mirror. Running poetry -vvv lock without custom package source against clean caches produces the following output:

Using virtualenv: /Users/bjoernpollex/Library/Caches/pypoetry/virtualenvs/poetry-futures-py3.6
Updating dependencies
Resolving dependencies...
   1: fact: poetry-futures is 0.1.0
   1: derived: poetry-futures
   1: fact: poetry-futures depends on isort (^4.3)
   1: selecting poetry-futures (0.1.0)
   1: derived: isort (^4.3)
PyPI: 5 packages found for isort >=4.3,<5.0
PyPI: Getting info for isort (4.3.4) from PyPI
PyPI: No dependencies found, downloading archives
PyPI: Downloading sdist: isort-4.3.4.tar.gz
   1: selecting isort (4.3.4)
   1: Version solving took 0.364 seconds.
   1: Tried 1 solutions.

Running with a local devpi mirror as a custom package source (uncomment the relevant lines in pyproject.toml, requires a local devpi-server running) gives this:

Using virtualenv: /Users/bjoernpollex/Library/Caches/pypoetry/virtualenvs/poetry-futures-py3.6
Updating dependencies
Resolving dependencies...
   1: fact: poetry-futures is 0.1.0
   1: derived: poetry-futures
   1: fact: poetry-futures depends on isort (^4.3)
   1: selecting poetry-futures (0.1.0)
   1: derived: isort (^4.3)
dev: 5 packages found for isort >=4.3,<5.0
dev: Downloading wheel: isort-4.3.4-py2-none-any.whl
dev: The cache for isort 4.3.4 is outdated. Refreshing.
dev: Downloading wheel: isort-4.3.4-py2-none-any.whl
   1: fact: isort (4.3.4) depends on futures (*)
   1: selecting isort (4.3.4)
   1: derived: futures (*)
dev: 22 packages found for futures *
dev: Downloading wheel: futures-3.2.0-py2-none-any.whl
dev: The cache for futures 3.2.0 is outdated. Refreshing.
dev: Downloading wheel: futures-3.2.0-py2-none-any.whl
   1: selecting futures (3.2.0)
   1: Version solving took 0.264 seconds.
   1: Tried 1 solutions.

For some reason, when running against the local mirror, poetry doesn't figure out that (1) futures is not needed for isort on Python 3, and (2) that futures 3.2.0 is not compatible with Python 3 (it will fail to install).

I would expect poetry to come to the same and correct solution in both cases.

stale

Most helpful comment

Commit 750e31d should fix the issue and will be released with next bugfix version some time next week.

All 6 comments

It also seems strange that it downloads a Python 2 wheel, maybe that's why it gets the bad dependency information.

So, I'm not sure if this is a problem on poetry's side, or if the package has bad metadata. Basically, the metadata in the Python 2 wheel lists the futures requirement twice, once with an environment qualifier, and once without:

    "run_requires": [
        {
            "requires": [
                "futures"
            ]
        },
        {
            "environment": "python_version==\"2.7\"",
            "requires": [
                "futures"
            ]
        }
    ],

The Python 3 wheel lists the requirement only with the environment qualifier.

I also have this problem. I have a local devpi mirror to speed up gitlab runner docker.

  - Installing futures (3.2.0)
    Installing from unsecure host: 192.168.0.114                                                                                                                                                                                                                
[EnvCommandError]                                                                                                                                                                                
Command ['pip', 'install', '--no-deps', '--trusted-host', '192.168.0.114', '--index-url', 'http://192.168.0.114:3141/root/pypi/+simple', 'futures==3.2.0'] errored with the following output:                                                                                                                                            
Looking in indexes: http://192.168.0.114:3141/root/pypi/+simple                                                                                                                                               
Collecting futures==3.2.0                                                                                                                                                                                     
  Could not find a version that satisfies the requirement futures==3.2.0 (from versions: 0.2.python3, 0.1, 0.2, 1.0, 2.0, 2.1, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5, 2.1.6, 2.2.0, 3.0.0, 3.0.1, 3.0.2, 3.0.3,   
3.0.4, 3.0.5, 3.1.0, 3.1.1)                                                                                                                                                                                   
No matching distribution found for futures==3.2.0 

Commit 750e31d should fix the issue and will be released with next bugfix version some time next week.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Closing this issue automatically because it has not had any activity since it has been marked as stale. If you think it is still relevant and should be addressed, feel free to open a new one.

Was this page helpful?
0 / 5 - 0 ratings