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.

pipenv graph shows wrong version for Modules

See original GitHub issue

Issue description

I have a pipenv with two requirements:

dateutils = "==0.6.7"
argparse = "==1.4.0"

the requirements were installed correctly, I can see an argparse-1.4.0 folder in the pipenv folder but pipenv graph shows me that argparse version 1.1 would be installed.

Expected result

I would expect pipenv graph to show me argparse as version 1.4

Actual result

It showed up as argparse 1.1

Steps to replicate

Create an empty folder with this Pipfile:

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true

[packages]
dateutils = "==0.6.7"

I installed these packages and through PyCharm updated to argparse 1.4 pipenv install "argparse==1.4.0" does the same now there is a new line in the Pipenv: argparse = "==1.4.0" and 1.4 shows up in the lock file and in the folder, but not in pipenv graph.

when executing pipenv graph there is still argparse 1.1 showing up

$ pipenv --support

Pipenv version: '2020.11.15'

Pipenv location: '/usr/lib/python3.7/site-packages/pipenv'

Python location: '/usr/bin/python3.7'

Python installations found:

  • 3.9.3: /usr/bin/python3
  • 3.9.3: /usr/bin/python3.9
  • 3.7.10: /usr/bin/python3.7
  • 3.7.10: /usr/bin/python3.7m
  • 2.7.18: /usr/bin/python2.7
  • 2.7.18: /usr/bin/python2

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.7.10',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '5.9.16-1-MANJARO',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP PREEMPT Mon Dec 21 22:00:46 UTC 2020',
 'python_full_version': '3.7.10',
 'python_version': '3.7',
 'sys_platform': 'linux'}

System environment variables:

  • BROWSER
  • COLORFGBG
  • COLORTERM
  • DBUS_SESSION_BUS_ADDRESS
  • DESKTOP_SESSION
  • DISPLAY
  • EDITOR
  • GTK2_RC_FILES
  • GTK3_MODULES
  • GTK_MODULES
  • GTK_RC_FILES
  • HOME
  • KDE_APPLICATIONS_AS_SCOPE
  • KDE_FULL_SESSION
  • KDE_SESSION_UID
  • KDE_SESSION_VERSION
  • KONSOLE_DBUS_SERVICE
  • KONSOLE_DBUS_SESSION
  • KONSOLE_DBUS_WINDOW
  • KONSOLE_VERSION
  • LANG
  • LANGUAGE
  • LC_ADDRESS
  • LC_IDENTIFICATION
  • LC_MEASUREMENT
  • LC_MONETARY
  • LC_NAME
  • LC_NUMERIC
  • LC_PAPER
  • LC_TELEPHONE
  • LC_TIME
  • LOGNAME
  • MAIL
  • MOTD_SHOWN
  • OLDPWD
  • PAM_KWALLET5_LOGIN
  • PATH
  • PROFILEHOME
  • PWD
  • QT_AUTO_SCREEN_SCALE_FACTOR
  • QT_LINUX_ACCESSIBILITY_ALWAYS_ON
  • SESSION_MANAGER
  • SHELL
  • SHELL_SESSION_ID
  • SHLVL
  • TERM
  • USER
  • WINDOWID
  • XAUTHORITY
  • XCURSOR_SIZE
  • XCURSOR_THEME
  • XDG_CURRENT_DESKTOP
  • XDG_DATA_DIRS
  • XDG_RUNTIME_DIR
  • XDG_SEAT
  • XDG_SEAT_PATH
  • XDG_SESSION_CLASS
  • XDG_SESSION_DESKTOP
  • XDG_SESSION_ID
  • XDG_SESSION_PATH
  • XDG_SESSION_TYPE
  • XDG_VTNR
  • _
  • ZSH
  • PAGER
  • LESS
  • LSCOLORS
  • LS_COLORS
  • P9K_SSH
  • PS1
  • DRONE_SERVER
  • DRONE_TOKEN
  • P9K_TTY
  • _P9K_TTY
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PIP_SHIMS_BASE_MODULE
  • PIP_PYTHON_PATH
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /home/gerritg/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/var/lib/snapd/snap/bin
  • SHELL: /bin/zsh
  • EDITOR: /usr/bin/nano
  • LANG: en_US.UTF-8
  • PWD: /home/gerritg/pipenvtest

Contents of Pipfile (‘/home/gerritg/pipenvtest/Pipfile’):

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true

[packages]
dateutils = "==0.6.7"
argparse = "==1.4.0"

Contents of Pipfile.lock (‘/home/gerritg/pipenvtest/Pipfile.lock’):

{
    "_meta": {
        "hash": {
            "sha256": "89cfd98c4bc4c29ecab690d38febeb693a2c94dd40f85fac47a1b6e73fa7af32"
        },
        "pipfile-spec": 6,
        "requires": {},
        "sources": [
            {
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "argparse": {
            "hashes": [
                "sha256:62b089a55be1d8949cd2bc7e0df0bddb9e028faefc8c32038cc84862aefdd6e4",
                "sha256:c31647edb69fd3d465a847ea3157d37bed1f95f19760b11a47aa91c04b666314"
            ],
            "version": "==1.4.0"
        },
        "dateutils": {
            "hashes": [
                "sha256:98ba55b20306450768e06aa9dbcd75105384c2c39a3060702144ed518716cb49"
            ],
            "version": "==0.6.7"
        },
        "python-dateutil": {
            "hashes": [
                "sha256:73ebfe9dbf22e832286dafa60473e4cd239f8592f699aa5adaf10050e6e1823c",
                "sha256:75bb3f31ea686f1197762692a9ee6a7550b59fc6ca3a1f4b5d7e32fb98e2da2a"
            ],
            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
            "version": "==2.8.1"
        },
        "pytz": {
            "hashes": [
                "sha256:83a4a90894bf38e243cf052c8b58f381bfe9a7a483f6a9cab140bc7f702ac4da",
                "sha256:eb10ce3e7736052ed3623d49975ce333bcd712c7bb19a58b9e2089d4057d0798"
            ],
            "version": "==2021.1"
        },
        "six": {
            "hashes": [
                "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259",
                "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"
            ],
            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
            "version": "==1.15.0"
        }
    },
    "develop": {}
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
J-M0commented, May 29, 2021

TL;DR: Update to dateutils >= 0.6.12 and remove argparse from your Pipfile to make this behavior go away.

There are a lot of things interacting here that cause this strange behavior, but as far as I can tell this isn’t a bug in pipenv and you aren’t missing any dependencies.

  1. According to the setup.py file for dateutils 0.6.7, it depends on the argparse package unconditionally

  2. Since argparse is in the standard library, that is the version Python will use when you run import argparse

  3. If you run python -c 'import argparse; print(argparse.__version__) in a shell it will print 1.1

  4. The pipenv graph command is actually provided by the pipdeptree package

  5. pipdeptree uses pip to get the list of installed packages, but pip does not list argparse as installed even after a pip install argparse

  6. pipdeptree has a function to guess the version of a package when it can’t get it from pip

  7. Since argparse has a __version__ attribute, pipdeptree picks that up and displays it in the graph

All of this happens because dateutils didn’t constrain its dependency on argparse to only the python versions which actually need it. dateutils 0.6.12 now properly sets argparse; python_version < "2.7" as a dependency so upgrading to that will fix all of this.

0reactions
matteiuscommented, Mar 12, 2022

Please check if this is an issue in 2022.1.8 if so, please check again with branch vendor-pip-22.0.3-followup-changes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Frequently Encountered Pipenv Problems - Read the Docs
☤ My pyenv-installed Python is not found​​ Make sure you have PYENV_ROOT set correctly. Pipenv only supports CPython distributions, with version name like...
Read more >
There are incompatible versions in the resolved dependencies
The problem seems to be that graphene-django only has version 2.15.0 according to PyPI https://pypi.org/project/graphene-django/.
Read more >
Common Pipenv Errors and How to Solve Them: Why Won't it ...
Pipfile Management: Specifying Versions. The second most common reason locking fails is that we attempt to install a package that is a pre-release...
Read more >
Using Python's pip to Manage Your Projects' Dependencies
Use a specific package version for your project without affecting other projects. Python 3 has the built-in venv module for creating virtual ...
Read more >
Pipenv: Python Dev Workflow for Humans — pipenv 2018.7.1 ...
Give you insight into your dependency graph (e.g. $ pipenv graph ). ... Abort if the Pipfile.lock is out-of-date, or Python version is...
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