Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

poetry export --format requirements.txt … export a commit hash of an installed repository instead of the initial used tag reference. #9268

Closed
guillaumededrie opened this issue Apr 3, 2024 · 3 comments
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@guillaumededrie
Copy link

guillaumededrie commented Apr 3, 2024

Description

Poetry is used to build a package that will be installed in a Docker image:

# Build
$ poetry build --format wheel
$ poetry export --format requirements.txt --output constraints.txt --without-hashes

# Export the .whl and constraints.txt file (multi-stage build)

# Install
$ pip install --no-cache-dir ./$APP_NAME*.whl --constraint constraints.txt

As of today, it was working well. But we've added a new package using this (as an example) poetry add git+https://github.com/me/new-package#1.6.0 (new-package = {git = "https://github.com/me/new-package", rev = "1.6.0"} is present in the [tool.poetry.dependencies] of the pyproject.toml) and when we tried to install the generated wheel by Poetry using an exported requirements.txt, we ended up with this error:

The conflict is caused by:
    my-app 1.0.0 depends on new-package 1.6.0 (from git+https://github.com/me/new-package@1.6.0)
    The user requested (constraint) new-package
To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

If we take a look at the constraints.txt file, we can see that line: new-package @ git+https://github.com/me/new-package@c3e22d63f50256f588bd1438eedcd761a1507a43 ; python_version >= "3.11" and python_version < "4.0", which doesn't match the initial git+https://github.com/me/new-package@1.6.0.

Workarounds

If we replace this line by new-package @ git+https://github.com/me/new-package@1.6.0 the problem disappear.

Poetry Installation Method

pip

Operating System

Debian Bookworm

Poetry Version

1.8.2

Poetry Configuration

cache-dir = "/root/.cache/pypoetry"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
keyring.enabled = true
solver.lazy-wheel = true
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs"  # /root/.cache/pypoetry/virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
warnings.export = true

Python Sysconfig

Platform: "linux-x86_64"
Python version: "3.12"
Current installation scheme: "posix_prefix"

Paths:
        data = "/usr/local"
        include = "/usr/local/include/python3.12"
        platinclude = "/usr/local/include/python3.12"
        platlib = "/usr/local/lib/python3.12/site-packages"
        platstdlib = "/usr/local/lib/python3.12"
        purelib = "/usr/local/lib/python3.12/site-packages"
        scripts = "/usr/local/bin"
        stdlib = "/usr/local/lib/python3.12"

Variables:
        ABIFLAGS = ""
        AC_APPLE_UNIVERSAL_BUILD = "0"
        AIX_BUILDDATE = "0"
        AIX_GENUINE_CPLUSPLUS = "0"
        ALIGNOF_LONG = "8"
        ALIGNOF_MAX_ALIGN_T = "16"
        ALIGNOF_SIZE_T = "8"
        ALT_SOABI = "0"
        ANDROID_API_LEVEL = "0"
        AR = "ar"
        ARFLAGS = "rcs"
        BASECFLAGS = "-fno-strict-overflow -Wsign-compare"
        BASECPPFLAGS = ""
        BASEMODLIBS = ""
        BINDIR = "/usr/local/bin"
        BINLIBDEST = "/usr/local/lib/python3.12"
        BLDLIBRARY = "-L. -lpython3.12"
        BLDSHARED = "gcc -shared"
        BOOTSTRAP_HEADERS = "\"
        BUILDEXE = ""
        BUILDPYTHON = "python"
        BUILD_GNU_TYPE = "x86_64-pc-linux-gnu"
        BUILD_SCRIPTS_DIR = "build/scripts-3.12"
        BYTESTR_DEPS = "\"
        CC = "gcc"

Example pyproject.toml

No response

Poetry Runtime Logs

NA
@guillaumededrie guillaumededrie added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Apr 3, 2024
@dimbleby
Copy link
Contributor

dimbleby commented Apr 3, 2024

wrong repository, should be https://github.com/python-poetry/poetry-export-plugin

you probably want to pip install with --no-dependencies

@guillaumededrie
Copy link
Author

Moved to python-poetry/poetry-plugin-export#276.

FYI, using pip install --no-cache-dir ./$APP_NAME*.whl --constraint constraints.txt --no-deps will not install any package dependencies and result with a non working app.

@guillaumededrie guillaumededrie closed this as not planned Won't fix, can't repro, duplicate, stale Apr 3, 2024
Copy link

github-actions bot commented May 4, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants