poetry-core 1.0.1 release breaks installation poetry via pip
envgap__python-poetry__poetry-3650
Original GitHub issue ↗Opened 2021-02-05
01 / FAILURE SIGNATURE
As reported upstream
ImportError: cannot import name 'Dependency' from 'poetry.core.packages.package' (/path/to/venv/python3.8/site-packages/poetry/core/packages/package.py)
Not a benchmark task.
- No curated issue-specific recipe or verified environment fix is available.
02 / ENVIRONMENT RECIPE
- Base commit
Not freshly verified- Manifest
requirements.txt- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
python-poetry/poetry #3650 · read the original issue
<!--
Hi there! Thank you for discovering and submitting an issue.
Before you submit this; let's make sure of a few things.
Please make sure the following boxes are ticked if they are correct.
If not, please try and fulfill these first.
-->
<!-- Checked checkbox should look like this: [x] -->
- [x] I am on the [latest](https://github.com/python-poetry/poetry/releases/latest) Poetry version.
- [x] I have searched the [issues](https://github.com/python-poetry/poetry/issues) of this repo and believe that this is not a duplicate.
- [x] If an exception occurs when executing a command, I executed it again in debug mode (`-vvv` option).
<!--
Once those are done, if you're able to fill in the following list with your information,
it'd be very helpful to whoever handles the issue.
-->
- **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
1. Create virtual environment for test: `python3 -m venv /path/to/venv`
2. Install poetry within venv: `/path/to/venv/bin/python3 -m pip install poetry==1.1.4`
3. Attempt to get help: `/path/to/venv/bin/poetry --help`
4. 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 ea04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]
Issue-specific recipe and runtime smoke command require review against the complete issue and repository.
Legacy already_works is install-only; proposed control still requires runtime verification.