poetry: poetry-core 1.0.1 release breaks installation poetry via pip
- I am on the latest Poetry version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).
- OS version and name:
ubuntu-latest
at GHA - Poetry version: 1.1.4
Issue
Unfortunately, poetry-core==1.0.1
release breaks poetry
, when installed via pip.
Steps to reproduce
- Create virtual environment for test:
python3 -m venv /path/to/venv
- Install poetry within venv:
/path/to/venv/bin/python3 -m pip install poetry==1.1.4
- Attempt to get help:
/path/to/venv/bin/poetry --help
- Results in error below,
Traceback (most recent call last):
File "bin/poetry", line 5, in <module>
from poetry.console import main
File "/path/to/venv/lib/python3.8/site-packages/poetry/console/__init__.py", line 1, in <module>
from .application import Application
File "/path/to/venv/lib/python3.8/site-packages/poetry/console/application.py", line 7, in <module>
from .commands.about import AboutCommand
File "/path/to/venv/lib/python3.8/site-packages/poetry/console/commands/__init__.py", line 4, in <module>
from .check import CheckCommand
File "/path/to/venv/lib/python3.8/site-packages/poetry/console/commands/check.py", line 2, in <module>
from poetry.factory import Factory
File "/path/to/venv/lib/python3.8/site-packages/poetry/factory.py", line 16, in <module>
from .packages.locker import Locker
File "/path/to/venv/lib/python3.8/site-packages/poetry/packages/__init__.py", line 2, in <module>
from .locker import Locker
File "/path/to/venv/lib/python3.8/site-packages/poetry/packages/locker.py", line 28, in <module>
from poetry.core.packages.package import Dependency
ImportError: cannot import name 'Dependency' from 'poetry.core.packages.package' (/path/to/venv/python3.8/site-packages/poetry/core/packages/package.py)
How to fix
Install poetry-core==1.0.0
version, when installing poetry via pip.
Reason
poetry.core.packages.package
is not a source of Dependency
class, it only imports it for type checking: https://github.com/python-poetry/poetry-core/blob/master/poetry/core/packages/package.py#L27
ps. Yes, I understand, that installing poetry via pip is not an official installation method. But at a moment it is an easiest way to install poetry at GitHub Actions
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 63
- Comments: 30 (1 by maintainers)
Commits related to this issue
- Workaround for https://github.com/python-poetry/poetry/issues/3650 — committed to mood-mapping-muppets/repo by frankier 3 years ago
- poetry-core 1.0.1 is currently broken Let's pin it to 1.0.0 for now, and revert this commit once it is fixed. See also: https://github.com/python-poetry/poetry/issues/3650 — committed to cloudigrade/cloudigrade by werwty 3 years ago
- Pin poetry-core version Workaround for python-poetry/poetry#3650 — committed to reservoirdb/reservoirdb-python by returnString 3 years ago
- poetry-core 1.0.1 is currently broken (#794) * poetry-core 1.0.1 is currently broken Let's pin it to 1.0.0 for now, and revert this commit once it is fixed. See also: https://github.com/python-... — committed to cloudigrade/cloudigrade by werwty 3 years ago
- fix(poetry): pin poetry-core==1.0.0 Workaround for https://github.com/python-poetry/poetry/issues/3650 — committed to renovatebot/renovate by rarkins 3 years ago
- Pin older poetry to work around https://github.com/python-poetry/poetry/issues/3650 — committed to camerahub/camerahub by djjudas21 3 years ago
- Force poetry-core 1.0.0 Avoiding https://github.com/python-poetry/poetry/issues/3650 — committed to bneijt/autotrash by bneijt 3 years ago
- Force poetry-core 1.0.0 Avoiding https://github.com/python-poetry/poetry/issues/3650 — committed to bneijt/autotrash by bneijt 3 years ago
- Force poetry-core 1.0.0 Avoiding https://github.com/python-poetry/poetry/issues/3650 — committed to bneijt/autotrash by bneijt 3 years ago
So many Friday releases in danger because of it.
It would be good if poetry had some integration tests … To avoid these errors.
Fantastic! Confirmed in Docker that
pip3 install poetry; poetry --help
works.Thank you @sinoroc and all!
you can lock poetry-core version as you install poetry 1.1.4
pip install poetry-core==1.0.0 poetry==1.1.4
Still no new poetry-core version in pypi, so this is not fixed yet.
Installing poetry works for me, but
poetry config virtualenvs.create false
breaks the hell our of my Docker build with the same error above.I would checkout 1.0.0, tag 1.0.2, and push.
Then 1.0.3 can be a patched 1.0.1. It’s ugly but might be the fastest fix (overall).
Maybe
poetry new
should be doing==
instead of>=
for the poetry-core dependency.Semantic versioning afaiu says that you can’t do this in a patch version. In fact, I don’t even think this is valid in a minor.
1.0.0
is a promise.I’m sorry that poetry
1.0.0
had a wart, but people are supposed to live with their warts and properly honor semantic versioning if they choose to use it.Ideally that means releasing a
1.0.2
which patchespoetry-core
to behave just like1.0.0
. It isn’t really enough to just fixpoetry
itself.I hope everyone has a good weekend. (I need to fix one more spot where we hit this.)
Version locking poetry to 1.0.0 avoids this error. Not great, but it got our builds working again.
pip3 install poetry==1.0.0