poetry-plugin-export icon indicating copy to clipboard operation
poetry-plugin-export copied to clipboard

Export fails due to urllib3 version mismatch

Open loleg opened this issue 1 year ago • 10 comments

I'm using version 1.5.0 of this plugin.

$ poetry --version   
Poetry (version 1.5.1)

$ poetry export -f requirements.txt --without-hashes -o requirements/prod.txt 

The `urllib3` package has the following compatible candidates `[Package('urllib3', '1.26.17')]`;  
but, the exporter dependency walker previously elected `urllib3 (2.0.6)` which is not compatible 
with the dependency `urllib3 (>=1.25.4,<1.27)`. Please contribute to `poetry-plugin-export` to 
solve this problem.

$ poetry self add urllib3   
Using version ^2.0.6 for urllib3

Updating dependencies
Resolving dependencies... (0.0s)

Because poetry-instance depends on poetry (1.5.1) which depends on urllib3 (>=1.26.0,<2.0.0), 
urllib3 is required. So, because poetry-instance depends on urllib3 (^2.0.6), version solving failed.

Not quite sure how I could contribute..

loleg avatar Oct 10 '23 10:10 loleg

I've seen this across multiple versions of Poetry: 1.3.2, 1.4.2, 1.5.1, and 1.6.1.

jmuddle-via avatar Oct 12 '23 09:10 jmuddle-via

It appears to be related to #183

jmuddle-via avatar Oct 12 '23 09:10 jmuddle-via

I have a similar problem, I guess. I'm using Poetry version 1.4.2, which had been depending on poetry-plugin-export 1.5.0 until 2 days ago. Then I started to get the following error:

#9 12.84 virtualenv 20.24.6 requires platformdirs<4,>=3.9.1, but you'll have platformdirs 2.6.2 which is incompatible.
#9 12.84 poetry-plugin-export 1.6.0 requires poetry<2.0.0,>=1.6.0, but you'll have poetry 1.4.2 which is incompatible.
#9 12.84 poetry-plugin-export 1.6.0 requires poetry-core<2.0.0,>=1.7.0, but you'll have poetry-core 1.5.2 which is incompatible.
#9 12.84 Successfully installed SecretStorage-3.3.3 attrs-23.1.0 build-0.10.0 cachecontrol-0.12.14 cffi-1.16.0 cleo-2.1.0 crashtest-0.4.1 cryptography-41.0.5 distlib-0.3.7 dulwich-0.21.6 filelock-3.13.1 html5lib-1.1 importlib-metadata-6.8.0 importlib-resources-6.1.0 installer-0.7.0 jaraco.classes-3.3.0 jeepney-0.8.0 jsonschema-4.19.2 jsonschema-specifications-2023.7.1 keyring-23.13.1 lockfile-0.12.2 more-itertools-10.1.0 msgpack-1.0.7 packaging-23.2 pexpect-4.8.0 pkginfo-1.9.6 pkgutil-resolve-name-1.3.10 platformdirs-2.6.2 poetry-1.4.2 poetry-core-1.5.2 poetry-plugin-export-1.6.0 ptyprocess-0.7.0 pycparser-2.21 pyproject-hooks-1.0.0 rapidfuzz-3.5.1 referencing-0.30.2 requests-toolbelt-0.10.1 rpds-py-0.10.6 shellingham-1.5.4 tomli-2.0.1 tomlkit-0.12.1 trove-classifiers-2023.10.18 urllib3-1.26.18 virtualenv-20.24.6 webencodings-0.5.1 zipp-3.17.0
#9 13.01 WARNING: You are using pip version 20.2.4; however, version 23.3.1 is available.
#9 13.01 You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.
#9 DONE 13.2s

#11 [4/8] COPY . /app
#11 DONE 0.0s

#12 [5/8] WORKDIR /app
#12 DONE 0.0s

#13 [6/8] RUN eval $(ssh-agent -s) && mkdir -p ~/.ssh && chmod 0600 ~/.ssh &...
#13 0.278 Agent pid 8
#13 0.304 # gitlab.trendyol.com:22 SSH-2.0-OpenSSH_7.4
#13 0.314 # gitlab.trendyol.com:22 SSH-2.0-OpenSSH_7.4
#13 0.322 # gitlab.trendyol.com:22 SSH-2.0-OpenSSH_7.4
#13 0.330 # gitlab.trendyol.com:22 SSH-2.0-OpenSSH_7.4
#13 0.337 # gitlab.trendyol.com:22 SSH-2.0-OpenSSH_7.4
#13 DONE 0.4s

#14 [7/8] RUN poetry export -f requirements.txt --without-hashes --without-u...
#14 1.298 /usr/lib/python3/dist-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.26.18) or chardet (3.0.4) doesn't match a supported version!
#14 1.298   warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
#14 1.298 
#14 1.298 to_pep_508() got an unexpected keyword argument 'resolved'
#14 ERROR: executor failed running [/bin/bash -c poetry export -f requirements.txt --without-hashes --without-urls --without dev --output requirements.txt]: runc did not terminate sucessfully
------
 > [7/8] RUN poetry export -f requirements.txt --without-hashes --without-urls --without dev --output requirements.txt:
------
failed to solve with frontend dockerfile.v0: failed to solve with frontend gateway.v0: rpc error: code = Unknown desc = failed to build LLB: executor failed running [/bin/bash -c poetry export -f requirements.txt --without-hashes --without-urls --without dev --output requirements.txt]: runc did not terminate sucessfully

It seems that two days ago, a new version of poetry-plugin-export was released. Since Poetry depends poetry-plugin-export<2.0.0,>=1.3.0, it install the new version of 1.6.0 that is not compatible with other dependencies.

I solved the problem by installing specifically poetry-plugin-export==1.5.0 before installing poetry==1.4.2

farukcankaya avatar Nov 01 '23 14:11 farukcankaya

I see this same issue my my personal project.

$ poetry export -f requirements.txt --output requirements.txt --without-hashes

The `urllib3` package has the following compatible candidates `[Package('urllib3', '1.26.18')]`;  but, the exporter dependency walker previously elected `urllib3 (2.0.7)` which is not compatible with the dependency `urllib3 (>=1.25.4,<1.27)`. Please contribute to `poetry-plugin-export` to solve this problem.
$ poetry --version
Poetry (version 1.7.1)

mikemadden42 avatar Nov 19 '23 19:11 mikemadden42

poetry-plugin-export==1.5.0

This is not working for me. Has anyone found a workaround for this?

fmagno avatar Dec 07 '23 15:12 fmagno

The below solution worked for me:

  1. Manually updated the version of urllib3 in the poetry.lock file image

  2. Running this in the terminal $ poetry export -f requirements.txt --output requirements.txt --without-hashes

pcha457 avatar Dec 11 '23 02:12 pcha457

I've temporarily fixed this for myself by requiring urllib3 = "<2" in pyproject.toml

agsimmons avatar Dec 22 '23 15:12 agsimmons

I've temporarily fixed this for myself by requiring urllib3 = "<2" in pyproject.toml

This worked for me. Thanks!

robertpro avatar Jan 04 '24 16:01 robertpro

Got this error:

The `scipy` package has the following compatible candidates `[Package('scipy', '1.8.1', source_type='legacy', source_url='http://local.dc.local:8081/repository/pypigr/simple', source_reference='local.dc.local')]`;  but, the exporter dependency walker previously elected `scipy (1.10.1)` which is not compatible with the dependency `scipy (>=1.3,<1.9)`. Please contribute to `poetry-plugin-export` to solve this problem.

Not sure if that related, but some of the errors are the same Any workaround or solution?

david-nano avatar Mar 10 '24 09:03 david-nano

added the following to my pyproject.toml

urllib3 = ">=1.26,<2"

fixes it but it's deffo super ugly...

FYI: the problems only seems to happen inside my docker container when exporting the requirements.txt file; the dockerfile looks lomething like this (sort of pseudo code):

FROM python AS base

# do some common config

FROM base AS build

WORKDIR /build

RUN pip install poetry
RUN poetry poetry self add poetry-plugin-export

COPY ./pyproject.toml .
COPY ./poetry.lock .

RUN poetry export --format requirements.txt --output requirements.txt

FROM base as runtime

WORKDIR /run

COPY --from build /build/requirements.txt /run/requirements.txt

# ...

ltrojan-ths avatar Apr 10 '24 10:04 ltrojan-ths