question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue
  • 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: code-quality@python.org
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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
abncommented, Sep 23, 2020

This was resolved with 1.1.0b3.

2reactions
abncommented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

2:Unspecified error) The function is not implemented. Rebuild ...
The issue is stated clearly in a text file in your opencv-python dist-packages named METADATA. It states;. There are four different packages ( ......
Read more >
A Poetic Apology. Or Why Should You Use Poetry to Manage…
Proper dependency resolution is the top required feature of any package manager worthy of respect yet pip only implemented that feature by late...
Read more >
Why Is Poetry Essential to the Modern Python Stack?
To get there, we need a great Python dependency manager that makes adding direct dependencies to your project easy and handles resolving and ......
Read more >
words.txt - Duke Computer Science
... asterisk asterisks asteroid asteroidal asteroids asters asthma aston astonish astonished astonishes astonishing astonishingly astonishment astor astoria ...
Read more >
US Summer Reading and Assignments
If you are in AOS 1 semester, complete 1 assignment; 2 semesters, ... The author has said elsewhere that while the book brings...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found