0

I've been trying to install different versions compatible for the request module for Python 3.4 (I know the python version is outdated, but is the one available for the OS I'm currently using.)

Using the pip install requests==2.19.1 command worked without any problems.

The problem actually occurs when importing the requests module in the python shell. (also in a python script, the error appears)

The line I execute:

>>> import requests

The error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\user\project\lib\site-packages\requests\__init__.py", line 112, in <modu
le>
    from . import utils
  File "D:\user\project\lib\site-packages\requests\utils.py", line 24, in <module>
    from . import certs
  File "D:\user\project\lib\site-packages\requests\certs.py", line 15, in <module>
    from certifi import where
  File "D:\user\project\lib\site-packages\certifi\__init__.py", line 1, in <module>

    from .core import contents, where
  File "D:\user\project\lib\site-packages\certifi\core.py", line 9, in <module>
    from typing import Union
ImportError: No module named 'typing'

I checked that I'm using the same environment where the request package was installed.

2 Answers2

1

Before trying the pip install typing (which it worked with the requests 2.19.1 version) I tried downgrading the requests module version to 2.12.1 and worked without the need to install typing.

But also barissonmez answer worked!

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 01 '22 at 21:19
0

It looks like you are importing from the package 'typing' but you do not have it installed. Try installing the package:

pip install typing
Baris Sonmez
  • 477
  • 2
  • 8