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

Export to requirements file is not installable with pip when dependency is both marked as optional and required through markers #208

Closed
4 tasks done
gusmith-ambiata opened this issue Jun 1, 2023 · 0 comments · Fixed by #209

Comments

@gusmith-ambiata
Copy link

gusmith-ambiata commented Jun 1, 2023

  • Poetry version: 1.5.1

  • Python version: 3.11.3

  • OS version and name: macOS 13.3.1 (a) and on python:3.11.3-slim docker image

  • pyproject.toml: https://gist.github.com/gusmith-ambiata/8b81da1302fa3c497be5e065bd79327d

  • 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

Sorry if I'm not overly clear as it is my first time having to describe an issue in poetry.
It may be somewhere similar to python-poetry/poetry#5506 but also different...

With the pyproject.toml (just installing typer with poetry add typer[all]), poetry update and poetry install works really well, no issues.

However, when exporting the poetry.lock file to a requirement file, this file cannot be installed on a Mac because of the colorama requirement.

From what I understand,:

  • typer[all] depends on click
  • typer[all] depends on colorama and is defined in the lock file as a dependency without being optional (poetry.lock line)

The dependency tree looks like:

$ poetry show -t
typer 0.9.0 Typer, build great CLIs. Easy to code. Based on Python type hints.
├── click >=7.1.1,<9.0.0
│   └── colorama *
├── colorama >=0.4.3,<0.5.0
├── rich >=10.11.0,<14.0.0
│   ├── markdown-it-py >=2.2.0,<3.0.0
│   │   └── mdurl >=0.1,<1.0
│   └── pygments >=2.13.0,<3.0.0
├── shellingham >=1.3.0,<2.0.0
└── typing-extensions >=3.7.4.3

So poetry install does the right thing and install colorama, but when exported, it adds the platform_system marker instead of marking it as required in all platform as typer requires.

For completion, when running pip install -r requirements.txt with the exported file, the output is:

$ pip install -r requirements.txt
Ignoring colorama: markers 'python_version >= "3.11" and python_version < "4.0" and platform_system == "Windows"' don't match your environment
Collecting click==8.1.3
  Using cached click-8.1.3-py3-none-any.whl (96 kB)
Collecting markdown-it-py==2.2.0
  Using cached markdown_it_py-2.2.0-py3-none-any.whl (84 kB)
Collecting mdurl==0.1.2
  Using cached mdurl-0.1.2-py3-none-any.whl (10.0 kB)
Collecting pygments==2.15.1
  Using cached Pygments-2.15.1-py3-none-any.whl (1.1 MB)
Collecting rich==13.4.1
  Downloading rich-13.4.1-py3-none-any.whl (239 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 239.4/239.4 kB 2.0 MB/s eta 0:00:00
Collecting shellingham==1.5.0.post1
  Using cached shellingham-1.5.0.post1-py2.py3-none-any.whl (9.4 kB)
Collecting typer[all]==0.9.0
  Using cached typer-0.9.0-py3-none-any.whl (45 kB)
Collecting typing-extensions==4.6.2
  Using cached typing_extensions-4.6.2-py3-none-any.whl (31 kB)
Collecting colorama<0.5.0,>=0.4.3
ERROR: In --require-hashes mode, all requirements must have their versions pinned with ==. These do not:
    colorama<0.5.0,>=0.4.3 from https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl (from typer[all]==0.9.0->-r requirements.txt (line 22))
@gusmith-ambiata gusmith-ambiata changed the title Export to requirements file fails when dependency is both marked as optional and required through markers Export to requirements file is not installable with pip when dependency is both marked as optional and required through markers Jun 1, 2023
@finswimmer finswimmer transferred this issue from python-poetry/poetry Jun 1, 2023
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

Successfully merging a pull request may close this issue.

1 participant