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 install two version of pandas library at the same time #8407

Closed
4 tasks done
Markovvn1w opened this issue Sep 5, 2023 · 6 comments
Closed
4 tasks done

Poetry install two version of pandas library at the same time #8407

Markovvn1w opened this issue Sep 5, 2023 · 6 comments
Labels
kind/bug Something isn't working as expected status/duplicate Duplicate issues

Comments

@Markovvn1w
Copy link

  • Poetry version: 1.6.1
  • Python version: 3.9.17
  • OS version and name: Ubuntu 22.04 and docker image (python:3.9)[https://hub.docker.com/_/python]
  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

When installing a package with special dependencies and extras, poetry fails and decides to install two versions of pandas library at the same time (causing the library to fail).

Steps to Reproduce

  1. Use clear ubuntu with python 3.9 (or docker image python:3.9)
  2. Install poetry 1.6.1
  3. Create new project:
    poetry new test && cd test && python -m venv .venv && source .venv/bin/activate
  4. Create new nested package with setup.py:
    mkdir mypackage
    echo 'from setuptools import setup;setup(name="mypackage",install_requires="pandas>=1.0",extras_require={"all": "pandas<1.6.0"})' > mypackage/setup.py
  5. Install created package to the poetry project:
    poetry add ./mypackage/ --extras all
  6. Wait for poetry to install two versions of pandas at the same time:
    image
  7. Check that there are indeed two versions of pandas installed: poetry show
    image
  8. Check that pandas is broken: python -c "import pandas" (Each time there is a different error. if one library is downloaded much faster than the second, there is no error at all):
    image

Expected behavior

When installing the mypackage nested package with extras=all, the pandas library has two restrictions: pandas>=1.0 and pandas<1.6.0. So I expect poetry to install the latest possible version of pandas (1.5.3)

@Markovvn1w Markovvn1w added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Sep 5, 2023
@Markovvn1w
Copy link
Author

Maybe related to #4703?

@dimbleby
Copy link
Contributor

dimbleby commented Sep 5, 2023

this is a bizarre use of extras, which are intended for... well, extra requirements. Not for limiting existing requirements.

clearly the result is not great but the right advice is still: don't do that

(and as a result I guess this is unlikely to be high up anyone's list)

@Markovvn1w
Copy link
Author

This was a minimal reproducible example. The most common example uses two extras, where one extras requires pandas<1.6.0 and the other pandas>=1.0. If you install each extras separately, everything is fine. However, when installing them together poetry installs two versions of pandas again.

Use the following setup.py to get this example:

from setuptools import setup
setup(name="mypackage",extras_require={"all": "pandas<1.6.0", "something": "pandas>=1.0"})

Use both extras to install nested package:

poetry add ./mypackage/ --extras all --extras something

@Markovvn1w
Copy link
Author

Markovvn1w commented Sep 5, 2023

However, if dependencies are added via intermediate packages, poetry works correctly. For example, the statsmodels package depends on pandas>=1.0. If we replace pandas>=1.0 with statsmodels in our nested package, poetry will correctly install only one version of pandas (1.5.3).
image

However, if statsmodels had extras with a restriction to pandas<1.6.0, then poerty would again install two versions at the same time. But I am not sure such package exists) So I guess the problem is very specific and affects very few people.

@radoering
Copy link
Member

Might be a duplicate of #8380. Please try if the PR that resolves that issue also resolves your issue.

@radoering radoering added status/duplicate Duplicate issues and removed status/triage This issue needs to be triaged labels Nov 3, 2023
@radoering radoering closed this as not planned Won't fix, can't repro, duplicate, stale Nov 3, 2023
Copy link

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 Feb 29, 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/duplicate Duplicate issues
Projects
None yet
Development

No branches or pull requests

3 participants