Skip to content
Advertisement

ImportError: cannot import name ‘gen’ from ‘tornado’ (unknown location)

I am trying to reinstall pip in my Mac. However, I am still running into the following error. I tried to fix it by deleting pip, but even when I try to reinstall it, the same problem keeps occurring.

  python3 get-pip.py 
Traceback (most recent call last):
  File "get-pip.py", line 24298, in <module>
    main()
  File "get-pip.py", line 139, in main
    bootstrap(tmpdir=tmpdir)
  File "get-pip.py", line 115, in bootstrap
    monkeypatch_for_cert(tmpdir)
  File "get-pip.py", line 96, in monkeypatch_for_cert
    from pip._internal.commands.install import InstallCommand
  File "/var/folders/l1/1bh_mwmx7f18zxjcj0fpysm00000gn/T/tmpeubjpxiw/pip.zip/pip/_internal/commands/__init__.py", line 9, in <module>
  File "/var/folders/l1/1bh_mwmx7f18zxjcj0fpysm00000gn/T/tmpeubjpxiw/pip.zip/pip/_internal/cli/base_command.py", line 12, in <module>
  File "/var/folders/l1/1bh_mwmx7f18zxjcj0fpysm00000gn/T/tmpeubjpxiw/pip.zip/pip/_internal/cli/cmdoptions.py", line 23, in <module>
  File "/var/folders/l1/1bh_mwmx7f18zxjcj0fpysm00000gn/T/tmpeubjpxiw/pip.zip/pip/_internal/cli/parser.py", line 12, in <module>
  File "/var/folders/l1/1bh_mwmx7f18zxjcj0fpysm00000gn/T/tmpeubjpxiw/pip.zip/pip/_internal/configuration.py", line 27, in <module>
  File "/var/folders/l1/1bh_mwmx7f18zxjcj0fpysm00000gn/T/tmpeubjpxiw/pip.zip/pip/_internal/utils/misc.py", line 38, in <module>
  File "/var/folders/l1/1bh_mwmx7f18zxjcj0fpysm00000gn/T/tmpeubjpxiw/pip.zip/pip/_vendor/tenacity/__init__.py", line 523, in <module>
  File "/var/folders/l1/1bh_mwmx7f18zxjcj0fpysm00000gn/T/tmpeubjpxiw/pip.zip/pip/_vendor/tenacity/tornadoweb.py", line 23, in <module>
ImportError: cannot import name 'gen' from 'tornado' (unknown location)

Maybe anyone has a solution on how to fix this problem.

Advertisement

Answer

I had the same problem, so I uninstalled Python and reinstalled. However, the issue with pip continued.

So, I came up with an additional solution:

  1. Uninstall Python
  2. Go to the folder that had the python installation. You will see that files remain in the folder; delete all the files in that folder.
  3. Reinstall Python
  4. Check if your environment variable was set
Advertisement