-1

I've gone through all the instructions I could find on the net about updating and installing pip/virtualenv etc. I did apt updates and even purged and re-installed python-pip, but it still keeps throwing this error when I run pip:

pi@raspberrypi:/usr/bin $ pip
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 9, in <module>
    load_entry_point('pip==21.1.1', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 356, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2476, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2190, in load
    ['__name__'])
  File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 1, in <module>
    from typing import List, Optional
ImportError: No module named typing

pi@raspberrypi:/usr/bin $ pip list
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 9, in <module>
    load_entry_point('pip==21.1.1', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 356, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2476, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2190, in load
    ['__name__'])
  File "/usr/local/lib/python2.7/dist-packages/pip/__init__.py", line 1, in <module>
    from typing import List, Optional
ImportError: No module named typing

I'm just trying to setup virtualenv and pip so I can setup an environment to run a python script that requires some modules.

I can't even do pip install typing because it gives me the same error. Is there a fix for this or a way to start from scratch?


Updates from questions:

Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
pi@raspberrypi:/usr/bin $ sudo apt install python-typing
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-typing

Update for os version:

pi@raspberrypi:/usr/bin $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
9
  • 4
    You are using an outdated of Python 2.7. Unless you are working with legacy code (and have no control over the code) you should be using Python3 and pip3. I just tried it an typing appears to be all ready installed in Pi3. – Steve Robillard May 3 at 23:18
  • 1
    Try sudo apt install python-typing – Steve Robillard May 3 at 23:35
  • 2
    Which OS + version do you run? – Dirk May 4 at 2:43
  • 1
    Not seeing updates – Steve Robillard May 4 at 15:57
  • 1
    Given the outdated version of Raspbian you are using, I suggest setting a new SD card from scratch and copying your code to the new card. – Steve Robillard May 4 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.