2

When I am trying to run the following command:

$ pip

I get:

Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main
  File "/home/ssm-user/.local/lib/python2.7/site-packages/pip/__init__.py", line 1, in <module>
    from typing import List, Optional
ImportError: No module named typing

Does anyone knows how to solve the issue? Thanks!

Here are my python versions:

$ python2 -V
Python 2.7.12
$ python3 -V
Python 3.5.2
artorias
  • 31
  • 1
  • 1
  • 5
  • 1
    Welcome to StackOverflow! [`typing`](https://docs.python.org/3/library/typing.html) is part of the standard library, so it doesn't need to be installed. However, it wasn't added until Python 3.5, so it may not be available in all versions. – Alexander L. Hayes May 03 '21 at 19:33
  • What's the result of ```$ pip --version``` ? – H. Pope May 03 '21 at 19:33
  • A duplicate https://stackoverflow.com/questions/67278017/pip-command-line-importerror-no-module-named-typing. try `pip install typing` – Benjaminliupenrose May 03 '21 at 19:41
  • 1
    You need to downgrade `pip` for all your Pythons. See https://stackoverflow.com/a/65871131/7976758 . Your problem is different but the process of downgrading and URLs are the same. – phd May 03 '21 at 20:27
  • Thank you @phd for your response! – artorias May 03 '21 at 21:28

1 Answers1

1

Turns out the issue is the same as this. I followed the solution and downgraded pip and that solves the issue.

artorias
  • 31
  • 1
  • 1
  • 5