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 shows astroid has two dependencies while pip says there's four #2728

Closed
3 tasks done
snejus opened this issue Jul 25, 2020 · 10 comments
Closed
3 tasks done

Poetry shows astroid has two dependencies while pip says there's four #2728

snejus opened this issue Jul 25, 2020 · 10 comments
Labels
kind/bug Something isn't working as expected
Milestone

Comments

@snejus
Copy link
Contributor

snejus commented Jul 25, 2020

  • 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 18.04.4 LTS x86_64

  • Python version: 3.6.11 (pyenv)

  • Poetry version: 1.1.0.b2

  • Link of a Gist with the contents of your pyproject.toml file: Same as in this issue

Issue

Tried running pylint, it failed because it's dependency astroid could not find its dependency wrapt installed. Found that poetry show astroid doesn't list wrapt as its dependency, while pip show does.

Step by step (these all got run sequentially):

Install a fresh venv (I destroyed it to check whether I can replicate this in a fresh one).

➜  mypackage IN-3484-functional-tests ✗ poetry install                                                                                 
Creating virtualenv service-mypackage-4v1lnku2-py3.6 in /home/snejus/.cache/pypoetry/virtualenvs
Installing dependencies from lock file

Package operations: 54 installs, 0 updates, 0 removals
  ...

  - Installing pydantic (1.6.1)
  - Installing pylint (2.5.3)
  - Installing pytest-cov (2.10.0)
  - Installing pytest-randomly (3.4.1)
  - Installing python-dateutil (2.8.1)
  - Installing safety (1.9.0)

Installing the current project: service-mypackage (4.4.0)                                                                       /1m-3.2s

try running pylint

➜  mypackage IN-3484-functional-tests ✗ poetry run pylint src/service/mypackage
Traceback (most recent call last):
  File "/home/snejus/.cache/pypoetry/virtualenvs/service-mypackage-4v1lnku2-py3.6/bin/pylint", line 8, in <module>
    sys.exit(run_pylint())
  File "/home/snejus/.cache/pypoetry/virtualenvs/service-mypackage-4v1lnku2-py3.6/lib/python3.6/site-packages/pylint/__init__.py", line 19,
    from pylint.lint import Run as PylintRun
  File "/home/snejus/.cache/pypoetry/virtualenvs/service-mypackage-4v1lnku2-py3.6/lib/python3.6/site-packages/pylint/lint/__init__.py", line
    from pylint.lint.check_parallel import check_parallel
  File "/home/snejus/.cache/pypoetry/virtualenvs/service-mypackage-4v1lnku2-py3.6/lib/python3.6/site-packages/pylint/lint/check_parallel.py"
    from pylint import reporters
  File "/home/snejus/.cache/pypoetry/virtualenvs/service-mypackage-4v1lnku2-py3.6/lib/python3.6/site-packages/pylint/reporters/__init__.py",
    from pylint import utils
  File "/home/snejus/.cache/pypoetry/virtualenvs/service-mypackage-4v1lnku2-py3.6/lib/python3.6/site-packages/pylint/utils/__init__.py", lin
    from pylint.utils.ast_walker import ASTWalker
  File "/home/snejus/.cache/pypoetry/virtualenvs/service-mypackage-4v1lnku2-py3.6/lib/python3.6/site-packages/pylint/utils/ast_walker.py", l
    from astroid import nodes
  File "/home/snejus/.cache/pypoetry/virtualenvs/service-mypackage-4v1lnku2-py3.6/lib/python3.6/site-packages/astroid/__init__.py", line 44,
    import wrapt
ModuleNotFoundError: No module named 'wrapt'                                                                                           /0.9s

poetry show

➜  mypackage IN-3484-functional-tests ✗ poetry show pylint
name         : pylint
version      : 2.5.3
description  : python code static checker

dependencies
 - astroid >=2.4.0,<=2.5
 - isort >=4.2.5,<5
 - mccabe >=0.6,<0.7
 - toml >=0.7.1
 - colorama *

➜  mypackage IN-3484-functional-tests ✗ poetry show astroid
name         : astroid
version      : 2.4.2
description  : An abstract syntax tree for Python with inference support.

dependencies
 - lazy-object-proxy >=1.4.0,<1.5.0
 - typed-ast >=1.4.0,<1.5

pip show

➜  mypackage IN-3484-functional-tests ✗ poetry run pip show astroid
Name: astroid
Version: 2.4.2
Summary: An abstract syntax tree for Python with inference support.
Home-page: https://github.com/PyCQA/astroid
Author: Python Code Quality Authority
Author-email: [email protected]
License: LGPL
Location: /home/snejus/.cache/pypoetry/virtualenvs/service-mypackage-4v1lnku2-py3.6/lib/python3.6/site-packages
Requires: wrapt, lazy-object-proxy, typed-ast, six
Required-by: pylint

Looks like poetry skipped wrapt and six.

and poetry version just for completeness

➜  mypackage IN-3484-functional-tests ✗ poetry self --version
Poetry version 1.1.0b2                                                                                                                 /0.9s
@snejus snejus added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jul 25, 2020
@snejus
Copy link
Contributor Author

snejus commented Jul 25, 2020

poetry update -vvv

...
PyPI: 3 packages found for astroid >=2.4.0,<=2.5
   1: fact: astroid (2.4.2) depends on lazy-object-proxy (>=1.4.0,<1.5.0)
   1: fact: astroid (2.4.2) depends on typed-ast (>=1.4.0,<1.5)
   1: selecting astroid (2.4.2)
   1: derived: lazy-object-proxy (>=1.4.0,<1.5.0)
...

@abn
Copy link
Member

abn commented Jul 25, 2020

Try poetry show -a astroid.

@snejus
Copy link
Contributor Author

snejus commented Jul 25, 2020

➜  mypackage IN-3484-functional-tests ✗ poetry show -a astroid                                                                                                                                                                                                                       
name         : astroid
version      : 2.4.2
description  : An abstract syntax tree for Python with inference support.

dependencies
 - lazy-object-proxy >=1.4.0,<1.5.0
 - typed-ast >=1.4.0,<1.5  

Seems to show the same.

Have meanwhile reverted back to 1.1.0a1 and ran poetry update -vvv to see the differences. The only one was that wrapt didn't get installed by 1.1.0b2.
six did get installed - though that's probably because it's required by other packages

➜  mypackage IN-3484-functional-tests ✗ poetry show six                                                                                                                                                                                                                              
name         : six
version      : 1.15.0
description  : Python 2 and 3 compatibility utilities

dependencies
¯\_(ツ)_/¯

required by
 - fixedwidth *
 - isodate *
 - packaging *
 - python-dateutil >=1.5
 - zeep >=1.9.0  

So it seems that the problem is specific to astroid.

@abn
Copy link
Member

abn commented Jul 25, 2020

It might have to do with something in your environment. I am unable to reproduce this using 1.1.0b2. Providing a minimal pyproject.toml might be helpful.

$ poetry debug 

Poetry
Version: 1.1.0b2
Python:  3.8.3

Virtualenv
Python:         3.6.11
Implementation: CPython
Path:           /path/to/venv
Valid:          True

System
Platform: linux
OS:       posix
Python:   /usr

$ poetry show astroid
name         : astroid
version      : 2.4.2
description  : An abstract syntax tree for Python with inference support.

dependencies
 - lazy-object-proxy >=1.4.0,<1.5.0
 - six >=1.12,<2.0
 - wrapt >=1.11,<2.0
 - typed-ast >=1.4.0,<1.5

This was using the following:

[tool.poetry]
name = "temp"
version = "0.1.0"
description = ""
authors = ["Foo Bar <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.6"
astroid = "^2.4.2"

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

@mett
Copy link

mett commented Aug 5, 2020

I'm seeing the same thing. Only I'm seeing even less dependencies, that could be because 3.8 though.

§ poetry debug

Poetry
Version: 1.1.0b2
Python:  3.7.5

Virtualenv
Python:         3.8.2
Implementation: CPython
Path:           /path/to/venv
Valid:          True

System
Platform: linux
OS:       posix
Python:   /usr/local
§ poetry show astroid
name         : astroid
version      : 2.4.2
description  : An abstract syntax tree for Python with inference support.

dependencies
 - lazy-object-proxy >=1.4.0,<1.5.0

@geckon
Copy link

geckon commented Aug 9, 2020

I'm also having this issue.

$ poetry debug

Poetry
Version: 1.1.0b2
Python:  3.8.4

Virtualenv
Python:         3.8.4
Implementation: CPython
Path:           /path/to/env
Valid:          True

System
Platform: linux
OS:       posix
Python:   /usr
$ poetry show -a astroid
name         : astroid
version      : 2.4.2
description  : An abstract syntax tree for Python with inference support.

dependencies
 - lazy-object-proxy >=1.4.0,<1.5.0
 - typed-ast >=1.4.0,<1.5

When I try and run pylint, I'm getting: ModuleNotFoundError: No module named 'wrapt'

@abn
Copy link
Member

abn commented Aug 9, 2020

The root cause of this issue is the parsing of package requirements for astroid.

https://github.com/PyCQA/astroid/blob/25384d4bebf0187b6704c818c7df64945793362c/astroid/__pkginfo__.py#L29-L31

My comment above was with poetry development installation using a development branch with poetry-core@master, hence why it works.

The parsing issue was resolved with python-poetry/poetry-core#55 and python-poetry/poetry-core#56.

@abn abn added status/waiting-on-core Requires changes to poetry-core first and removed status/triage This issue needs to be triaged labels Aug 9, 2020
@geckon
Copy link

geckon commented Aug 9, 2020

Cool, thanks @abn. When can we expect the next preview version please?

@abn
Copy link
Member

abn commented Sep 23, 2020

This was resolved with 1.1.0b3.

@abn abn closed this as completed Sep 23, 2020
@abn abn removed the status/waiting-on-core Requires changes to poetry-core first label Sep 23, 2020
Copy link

github-actions bot commented Mar 3, 2024

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 Mar 3, 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
Projects
None yet
Development

No branches or pull requests

4 participants