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

[Query] Dependency resolution failure across python versions #515

Closed
piyush-das opened this issue Aug 19, 2020 · 1 comment
Closed

[Query] Dependency resolution failure across python versions #515

piyush-das opened this issue Aug 19, 2020 · 1 comment

Comments

@piyush-das
Copy link

Issue

It appears that poetry's python specific package management doesn't translate properly to the export command Libraries for python3.6 are also getting exported which creating nox requirements for python3.7

Steps to reproduce

cookiecutter gh:cjolowicz/cookiecutter-hypermodern-python  --checkout="2020.8.15"
# Accept defaults
cd hypermodern-python
# We would be supporting both 3.6 and 3.7
pyenv local 3.6.9 3.7.7
# Lets use 3.7 for testing
poetry env use 3.6
poetry install
# Lets add the problematic module
poetry add rich

# Nox tests on 3.6
nox -rs tests-3.6 # Completes correctly

# Nox tests on 3.7
nox -rs tests-3.7 # Generates error

We get the following error:

ERROR: Could not find a version that satisfies the requirement dataclasses==0.7 (from -r .nox/tests-3-7/tmp/requirements.txt (line 10)) (from versions: 0.1, 0.2, 0.3, 0.4, 0.5, 0.6)
ERROR: No matching distribution found for dataclasses==0.7 (from -r .nox/tests-3-7/tmp/requirements.txt (line 10))
WARNING: You are using pip version 20.1.1; however, version 20.2.2 is available.
You should consider upgrading via the '/home/xyz/hypermodern-python/.nox/tests-3-7/bin/python -m pip install --upgrade pip' command.

The problem arrises due to dataclasses being exported in the requirements file for python3.7.

[[package]]
category = "main"
description = "A backport of the dataclasses module for Python 3.6"
name = "dataclasses"
optional = false
python-versions = ">=3.6, <3.7"
version = "0.7"

Even though the lock mentions that dataclasses should be installed only for python 3.6, why is that it gets exported for 3.7 ? Please let me know if I am missing something.

Thanks

@cjolowicz
Copy link
Owner

cjolowicz commented Sep 15, 2020

Thanks for the report.

I could reproduce this with the Poetry prerelease (1.1.0b2):

# docker build --build-arg PYTHON_VERSION=3.7 --build-arg POETRY_VERSION=1.1.0b2 .
ARG PYTHON_VERSION
FROM python:$PYTHON_VERSION
ARG POETRY_VERSION
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
ENV PATH $PATH:/root/.poetry/bin
RUN pip install cookiecutter
RUN cookiecutter gh:cjolowicz/cookiecutter-hypermodern-python  --checkout="2020.8.15" --no-input
WORKDIR hypermodern-python
RUN poetry add rich
RUN poetry export -f requirements.txt | grep dataclasses | grep python_version

There is already an upstream issue for this: python-poetry/poetry#2662

You can fix this by downgrading to the stable version of Poetry (1.0.10). Beware however that the env use command in the stable version is broken: python-poetry/poetry#2711.

I'm closing this because it is an upstream bug. Feel free to comment and continue the discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants