"pipenv" fails with AttributeError after upgrading from ubuntu 20.04 to 22.04?
Asked Answered
G

2

9

I recently upgraded my distro version from ubuntu 20.04 to ubuntu 22.04 and now pipenv command does not work. Any solutions to fix this?

 > pipenv --help
Traceback (most recent call last):
  File "/usr/bin/pipenv", line 33, in <module>
    sys.exit(load_entry_point('pipenv==11.9.0', 'console_scripts', 'pipenv')())
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 696, in main
    with self.make_context(prog_name, args, **extra) as ctx:
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 621, in make_context
    self.parse_args(ctx, args)
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 1018, in parse_args
    rest = Command.parse_args(self, ctx, args)
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 875, in parse_args
    parser = self.make_parser(ctx)
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 821, in make_parser
    for param in self.get_params(ctx):
  File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 774, in get_params
    help_option = self.get_help_option(ctx)
  File "/usr/lib/python3/dist-packages/pipenv/cli.py", line 26, in get_help_option
    from .import core
  File "/usr/lib/python3/dist-packages/pipenv/core.py", line 21, in <module>
    import requests
  File "/usr/lib/python3/dist-packages/pipenv/vendor/requests/__init__.py", line 65, in <module>
    from . import utils
  File "/usr/lib/python3/dist-packages/pipenv/vendor/requests/utils.py", line 27, in <module>
    from .cookies import RequestsCookieJar, cookiejar_from_dict
  File "/usr/lib/python3/dist-packages/pipenv/vendor/requests/cookies.py", line 172, in <module>
    class RequestsCookieJar(cookielib.CookieJar, collections.MutableMapping):
AttributeError: module 'collections' has no attribute 'MutableMapping'
Garwin answered 27/4, 2022 at 12:36 Comment(4)
stackoverflow.com/…Steinman
this is a bug in the packaging of pipenv for jammy: bugs.launchpad.net/ubuntu/+source/pipenv/+bug/1970106Covenantor
I'd recommend installing a modern version in a virtualenv insteadCovenantor
Workaround: ` pip install pipenv `Matrix
G
16

I had installed pipenv from apt package manager which seems to be an old version.

So, remove the pipenv installed via apt

> sudo apt remove pipenv

And install it using pip to get the latest version

> pip install pipenv
Garwin answered 3/5, 2022 at 8:51 Comment(3)
Had the same problem after upgrading from ubuntu 20.04 to ubuntu 22.04 on Windows 11 and this solution helped solved the problem.Voletta
Did anybody file an bug report for debian ?Unpromising
Its this one : bugs.launchpad.net/ubuntu/+source/pipenv/+bug/1970106Unpromising
W
0

I was able to fix the same error by using

sudo apt install python3 pipenv
Weil answered 5/10, 2023 at 12:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.