0

I would like to install python 3.11.1 on Google Colab. However, when installing libraries I get the following error:

*Traceback (most recent call last):
  File "/usr/local/bin/pip3", line 5, in <module>
    from pip._internal.cli.main import main
  File "/usr/lib/python3/dist-packages/pip/__init__.py", line 22, in <module>
    from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
  File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 73, in <module>
    vendored("pkg_resources")
  File "/usr/lib/python3/dist-packages/pip/_vendor/__init__.py", line 33, in vendored
    __import__(modulename, globals(), locals(), level=0)
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 77, in <module>
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/_vendor/packaging/requirements.py", line 9, in <module>
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 674, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/extern/__init__.py", line 43, in load_module
  File "/usr/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/_vendor/pyparsing.py", line 943, in <module>
AttributeError: module 'collections' has no attribute 'MutableMapping'*

I've done the following setup:

!sudo apt-get update -y
!sudo apt-get install python3.11
!sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1
!sudo update-alternatives --config python3

Then selected the right version. After that, when I execute:

!python --version

I get the correct version:

Python 3.11.1

Then, I installed pip using:

!sudo apt install python3-pip

I've tried the following:

  1. Update the collections import collections import sys if sys.version_info.major == 3 and sys.version_info.minor >= 10: from collections.abc import MutableMapping else: from collections import MutableMapping

  2. Install these packages
    !sudo apt install python-pip !sudo apt-get update !sudo apt-get upgrade !sudo apt-get update

  3. Update the following packages:

    !pip install --upgrade pip wheel setuptools requests

My goal is to install these packages:

!pip install haversine
!pip install codecarbon[viz]
sinoroc
  • 18,409
  • 2
  • 39
  • 70
GoT GOt
  • 49
  • 1
  • 9

0 Answers0