pipenv: AttributeError: module 'collections' has no attribute 'MutableMapping'

I have a problem when using pipenv in ubuntu os. Cannot use command pipenv, even for checking version

Searched for similar questions but not satisfied.

Ubuntu

Distributor ID: Ubuntu Description: Ubuntu 22.04.1 LTS Release: 22.04 Codename: jammy

Python

Python 3.10.6

Pipenv

pipenv version (11.9.0-1.1).


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'

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

Do not install pipenv from apt, it’s way too old. Install from pypi.

Downgrading the requests package to 2.13.0 and trying to import requests with python3.10 will produce the above error.

Another package presumptuously downgraded your requests package for its own needs, and now it’s incompatible with whatever you’re using it for now. Force it back up to date with something like:

pip3 install --user -Iv requests==2.28.1

i,m using chatterbot, and im coding my bot and this erro appeared: module ‘collections’ has no attribute ‘MutableMapping’

@sentientmachine that version is from 2017 – you should be on requests==2.28.1

@sentientmachine Especially applicable seeing as how your comment has nothing to do with this issue–the Ubuntu maintainers haven’t bothered updating the apt repository in years, and we do not recommend user install from apt. That is where the source of this error originated from. If you could provide specific examples of how the contract is changing that you are unhappy with I would be happy to address. As far as some recent regressions, yeah there were a number of features from Hacktoberfets/October that caused some edge cases, many of which are already addressed. The ones that aren’t are a priority for our two maintainers, myself and Oz. We both took on this project 1-year ago today and have made major strides towards its maintainability. There have been bumps along the way, that we are very proactive to responding to.