Pipenv: ModuleNotFoundError: No module named 'pipenv.vendor.packaging'

Created on 22 Jan 2019  ·  8Comments  ·  Source: pypa/pipenv

Be sure to check the existing issues (both open and closed!), and make sure you are running the latest version of Pipenv.

Check the diagnose documentation for common issues before posting! We may close your issue if it is very similar to one of them. Please be considerate, or be on your way.

Make sure to mention your debugging experience if the documented solution failed.

Issue description

pipenv uninstall --all-dev does not work.
It tells me ModuleNotFoundError: No module named 'pipenv.vendor.packaging'

Expected result

pipenv uninstall --all-dev works as expected

Describe what you expected.

Actual result

When possible, provide the verbose output (--verbose), especially for locking and dependencies resolving issues.

Steps to replicate

Provide the steps to replicate (which usually at least includes the commands and the Pipfile).

Please follow these steps to reproduce:

  1. create a new folder
  2. cd into new folder
  3. pipenv install
  4. pipenv uninstall --all-dev
  5. watch error

it should not give an error.

[kus@asus-vivobook scripts]$ cd ~/src/personal/
[kus@asus-vivobook personal]$ mkdir -p myrequest
[kus@asus-vivobook personal]$ cd myrequest/
[kus@asus-vivobook myrequest]$ ls -a
. ..
[kus@asus-vivobook myrequest]$ pipenv install
Creating a virtualenv for this project…
Pipfile: /home/kus/src/personal/myrequest/Pipfile
Using /usr/bin/python3 (3.7.2) to create virtualenv…
⠼ Creating virtual environment...Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/kus/.local/share/virtualenvs/myrequest-fayK9fOV/bin/python3
Also creating executable in /home/kus/.local/share/virtualenvs/myrequest-fayK9fOV/bin/python
Installing setuptools, pip, wheel...done.

✔ Successfully created virtual environment!
Virtualenv location: /home/kus/.local/share/virtualenvs/myrequest-fayK9fOV
Creating a Pipfile for this project…
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (a65489)!
Installing dependencies from Pipfile.lock (a65489)…
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/0 — 00:00:00
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
[kus@asus-vivobook myrequest]$ pipenv uninstall --all-dev
Traceback (most recent call last):
File "/usr/bin/pipenv", line 11, in
load_entry_point('pipenv==2018.11.26', 'console_scripts', 'pipenv')()
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
return self.main(args, *kwargs)
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, *ctx.params)
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(
args, *kwargs)
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, *
kwargs)
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(args, *kwargs)
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
return f(get_current_context(), args, *kwargs)
File "/usr/lib/python3.7/site-packages/pipenv/cli/command.py", line 301, in uninstall
ctx=ctx
File "/usr/lib/python3.7/site-packages/pipenv/core.py", line 2012, in do_uninstall
from .vendor.packaging.utils import canonicalize_name
ModuleNotFoundError: No module named 'pipenv.vendor.packaging'


Please run $ pipenv --support, and paste the results here. Don't put backticks (`) around it! The output already contains Markdown formatting.

If you're on macOS, run the following:

$ pipenv --support | pbcopy

If you're on Windows, run the following:

> pipenv --support | clip

If you're on Linux, run the following:

$ pipenv --support | xclip

$ pipenv --support

$ pipenv --support

Pipenv version: '2018.11.26'

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

Python location: '/usr/bin/python3'

Python installations found:

  • 3.7.2: /usr/bin/python3.7m
  • 3.7.2: /usr/bin/python3
  • 2.7.15: /usr/bin/python

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.7.2',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '4.19.15-300.fc29.x86_64',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP Mon Jan 14 16:32:35 UTC 2019',
 'python_full_version': '3.7.2',
 'python_version': '3.7',
 'sys_platform': 'linux'}

System environment variables:

  • NVM_DIR
  • LS_COLORS
  • XDG_MENU_PREFIX
  • MODULES_RUN_QUARANTINE
  • LANG
  • GDM_LANG
  • HISTCONTROL
  • DISPLAY
  • HOSTNAME
  • OLDPWD
  • COLORTERM
  • NVM_CD_FLAGS
  • USERNAME
  • XDG_VTNR
  • SSH_AUTH_SOCK
  • XDG_SESSION_ID
  • MODULES_CMD
  • USER
  • ENV
  • DESKTOP_SESSION
  • GNOME_TERMINAL_SCREEN
  • PWD
  • HOME
  • SSH_AGENT_PID
  • XDG_SESSION_TYPE
  • BASH_ENV
  • XDG_DATA_DIRS
  • XDG_SESSION_DESKTOP
  • GJS_DEBUG_OUTPUT
  • LOADEDMODULES
  • MAIL
  • WINDOWPATH
  • TERM
  • SHELL
  • VTE_VERSION
  • QT_IM_MODULE
  • XMODIFIERS
  • NVM_BIN
  • XDG_CURRENT_DESKTOP
  • GNOME_TERMINAL_SERVICE
  • SHLVL
  • XDG_SEAT
  • MODULEPATH
  • GDMSESSION
  • LOGNAME
  • DBUS_SESSION_BUS_ADDRESS
  • XDG_RUNTIME_DIR
  • XAUTHORITY
  • MODULEPATH_modshare
  • PATH
  • MODULESHOME
  • HISTSIZE
  • GJS_DEBUG_TOPICS
  • SESSION_MANAGER
  • LESSOPEN
  • BASH_FUNC_module%%
  • BASH_FUNC__module_raw%%
  • BASH_FUNC_switchml%%
  • BASH_FUNC_scl%%
  • _
  • 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/kus/bin/flutter/bin:/home/kus/.symfony/bin:/home/kus/.local/bin:/home/kus/bin:/home/kus/bin/flutter/bin:/home/kus/.symfony/bin:/home/kus/.local/bin:/home/kus/bin:/home/kus/.cargo/bin:/home/kus/.nvm/versions/node/v11.7.0/bin:/home/kus/bin/flutter/bin:/home/kus/.symfony/bin:/home/kus/.local/bin:/home/kus/bin:/usr/share/Modules/bin:/home/kus/.cargo/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/kus/.composer/vendor/bin:/home/kus/.dotnet/tools
  • SHELL: /bin/bash
  • LANG: en_US.UTF-8
  • PWD: /home/kus/src/personal/scripts

Contents of Pipfile ('/home/kus/src/personal/scripts/Pipfile'):

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

[dev-packages]

[packages]
python-dotenv = "*"

[requires]
python_version = "3.7"

Contents of Pipfile.lock ('/home/kus/src/personal/scripts/Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "460c68ee01296bbb390236c2df5047ef06ac87f6ba3a4dde6adbdb8418313b84"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.7"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "python-dotenv": {
            "hashes": [
                "sha256:a84569d0e00d178bc5b957f7ff208bf49287cbf61857c31c258c4a91f571527b",
                "sha256:c9b1ddd3cdbe75c7d462cb84674d87130f4b948f090f02c7d7144779afb99ae0"
            ],
            "index": "pypi",
            "version": "==0.10.1"
        }
    },
    "develop": {}
}

[kus@asus-vivobook scripts]$ pipenv run python pinpoint.py
Creating a virtualenv for this project…
Pipfile: /home/kus/src/personal/scripts/Pipfile
Using /usr/bin/python3.7m (3.7.2) to create virtualenv…
⠧ Creating virtual environment...Using base prefix '/usr'
New python executable in /home/kus/.local/share/virtualenvs/scripts-Vch89g9b/bin/python3.7m
Also creating executable in /home/kus/.local/share/virtualenvs/scripts-Vch89g9b/bin/python
Installing setuptools, pip, wheel...done.
Running virtualenv with interpreter /usr/bin/python3.7m

✔ Successfully created virtual environment!
Virtualenv location: /home/kus/.local/share/virtualenvs/scripts-Vch89g9b
/home/kus/.local/share/virtualenvs/scripts-Vch89g9b/bin/python: can't open file 'pinpoint.py': [Errno 2] No such file or directory
[kus@asus-vivobook scripts]$ pipenv uninstall --all-dev
Traceback (most recent call last):
File "/usr/bin/pipenv", line 11, in
load_entry_point('pipenv==2018.11.26', 'console_scripts', 'pipenv')()
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
return self.main(args, *kwargs)
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, *ctx.params)
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(
args, *kwargs)
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, *
kwargs)
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(args, *kwargs)
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
return f(get_current_context(), args, *kwargs)
File "/usr/lib/python3.7/site-packages/pipenv/cli/command.py", line 301, in uninstall
ctx=ctx
File "/usr/lib/python3.7/site-packages/pipenv/core.py", line 2012, in do_uninstall
from .vendor.packaging.utils import canonicalize_name
ModuleNotFoundError: No module named 'pipenv.vendor.packaging'

Most helpful comment

I have a Fedora fix ready with a grep check for this to not happen again.

All 8 comments

tried it on a second machine.

[kus@mcny ~]$ mkdir -p ~/src/newfolder
[kus@mcny ~]$ cd ~/src/newfolder
[kus@mcny newfolder]$ pipenv install
Creating a virtualenv for this project…
Pipfile: /home/kus/src/newfolder/Pipfile
Using /usr/bin/python3 (3.7.2) to create virtualenv…
⠹ Creating virtual environment...Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/kus/.local/share/virtualenvs/newfolder-XtsC3NV3/bin/python3
Also creating executable in /home/kus/.local/share/virtualenvs/newfolder-XtsC3NV3/bin/python
Installing setuptools, pip, wheel...done.

✔ Successfully created virtual environment!
Virtualenv location: /home/kus/.local/share/virtualenvs/newfolder-XtsC3NV3
Creating a Pipfile for this project…
Pipfile.lock not found, creating…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (a65489)!
Installing dependencies from Pipfile.lock (a65489)…
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/0 — 00:00:00
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
[kus@mcny newfolder]$ pipenv uninstall --all-dev
Traceback (most recent call last):
File "/usr/bin/pipenv", line 11, in
load_entry_point('pipenv==2018.11.26', 'console_scripts', 'pipenv')()
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
return self.main(args, *kwargs)
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, *ctx.params)
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(
args, *kwargs)
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, *
kwargs)
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
return callback(args, *kwargs)
File "/usr/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
return f(get_current_context(), args, *kwargs)
File "/usr/lib/python3.7/site-packages/pipenv/cli/command.py", line 301, in uninstall
ctx=ctx
File "/usr/lib/python3.7/site-packages/pipenv/core.py", line 2012, in do_uninstall
from .vendor.packaging.utils import canonicalize_name
ModuleNotFoundError: No module named 'pipenv.vendor.packaging'
[kus@mcny newfolder]$ pipenv --support

$ pipenv --support

Pipenv version: '2018.11.26'

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

Python location: '/usr/bin/python3'

Python installations found:

  • 3.7.2: /usr/bin/python3
  • 3.7.2: /usr/bin/python3.7m

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.7.2',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '4.19.15-300.fc29.x86_64',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP Mon Jan 14 16:32:35 UTC 2019',
 'python_full_version': '3.7.2',
 'python_version': '3.7',
 'sys_platform': 'linux'}

System environment variables:

  • LS_COLORS
  • SSH_CONNECTION
  • LANG
  • HISTCONTROL
  • HOSTNAME
  • XDG_SESSION_ID
  • USER
  • SELINUX_ROLE_REQUESTED
  • PWD
  • HOME
  • SSH_CLIENT
  • SELINUX_LEVEL_REQUESTED
  • SSH_TTY
  • MAIL
  • TERM
  • SHELL
  • XMODIFIERS
  • SELINUX_USE_CURRENT_RANGE
  • SHLVL
  • LOGNAME
  • DBUS_SESSION_BUS_ADDRESS
  • XDG_RUNTIME_DIR
  • PATH
  • HISTSIZE
  • LESSOPEN
  • _
  • OLDPWD
  • 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/kus/.local/bin:/home/kus/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
  • SHELL: /bin/bash
  • LANG: en_US.UTF-8
  • PWD: /home/kus/src/newfolder

Contents of Pipfile ('/home/kus/src/newfolder/Pipfile'):

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

[dev-packages]

[packages]

[requires]
python_version = "3.7"

Contents of Pipfile.lock ('/home/kus/src/newfolder/Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "7e7ef69da7248742e869378f8421880cf8f0017f96d94d086813baa518a65489"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.7"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {},
    "develop": {}
}


[kus@mcny newfolder]$ exit
logout

how did you install pipenv? what linux distribution are you using? looks to me like some attempt at distro unpackaging gone wrong here.

fedora 29 with dnf install pipenv

nice, at least there's hope of it getting fixed then

in the meantime you can pip install --user pipenv and hopefully fedora has that on your path by default.

/cc @hroncok sorry for the inconsistent references :(

Ouch. On it.

I have a Fedora fix ready with a grep check for this to not happen again.

@hroncok I'd somehow missed (or managed to forget) that you had a system level pipenv package together. Once this is fixed, I'll ditch my user install and switch to yours :)

Not an upstream bug though, so we can close this one.

Sure thing.

@9034725985 please use https://bugz.fedoraproject.org/pipenv for Fedora bugs next time. I'll gladly forward the report to upstream if i think it's an upstream bug.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jerzyk picture jerzyk  ·  3Comments

ipmb picture ipmb  ·  3Comments

xi picture xi  ·  3Comments

leileigong picture leileigong  ·  3Comments

marc-fez picture marc-fez  ·  3Comments