Python Forum
'urllib3' Module not found when import 'requests'
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'urllib3' Module not found when import 'requests'
#1
Hello guys :)
I'm using python 3.9 on linux(ParrotOS).
While practicing python, I installed and imported 'requests' module.
When I'm trying to use it, I get this error msg:

Error:
Traceback (most recent call last): File "/home/osboxes/Desktop/Python/code.py", line 1, in <module> import requests File "/usr/lib/python3.9/requests/__init__.py", line 43, in <module> import urllib3 ModuleNotFoundError: No module named 'urllib3'
I tried to pip3 install this 'urllib3' but it is already installed..
Quote:pip3 install urllib3
Requirement already satisfied: urllib3 in /usr/lib/python3/dist-packages (1.25.11)

I will appreciate some help here,
Thanks!
Reply
#2
You should not have a requests folder under root python 3.9.
Rename or remove it as when import requests it will try to read from it.
If you do pip show requests so should the last destination folder always be site-packages or dist-packages (a Debian-specific convention).
Reply
#3
(Jan-06-2021, 02:31 PM)snippsat Wrote: You should not have a requests folder under root python 3.9.
Rename or remove it as when import requests it will try to read from it.
If you do pip show requests so should the last destination folder always be site-packages or dist-packages (a Debian-specific convention).

Thanks for the reply.
I renamed the folder, and now the error is:
Error:
Traceback (most recent call last): File "/home/osboxes/PycharmProjects/pythonProject/main.py", line 1, in <module> import requests ModuleNotFoundError: No module named 'requests'
when I try to install it, it is already installed:
Quote:$pip3 install requests
Requirement already satisfied: requests in /usr/local/lib/python3.9/dist-packages (2.25.1)
Reply
#4
As you use Pycharm look at Configure a Python interpreter and point it to /usr/local/lib/python3.9.
Also teste from command like type python or python3 and see that Python 3.9 interactive mode start and see that import work there.
Reply
#5
(Jan-06-2021, 03:19 PM)snippsat Wrote: As you use Pycharm look at Configure a Python interpreter and point it to /usr/local/lib/python3.9.
Also teste from command like type python or python3 and see that Python 3.9 interactive mode start and see that import work there.

/usr/local/lib/python3.9 is a folder, I couldnt set it as an interpreter.
And there is nothing in this folder but 'dist-packages' folder.
Reply
#6
(Jan-06-2021, 05:34 PM)spanz Wrote: usr/local/lib/python3.9 is a folder, I couldnt set it as an interpreter.
Looking at link i,so most point to the binary when choose target interpreter then is /usr/local/lib/python3.9/python
I do not use PyCharm myself.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Import requests/beautifulsoup problem Jokadaro_ 3 124 Dec-05-2021, 01:22 PM
Last Post: Jokadaro_
  No Module found in other directory than source code [SOLVED] AlphaInc 1 233 Nov-10-2021, 04:34 PM
Last Post: AlphaInc
  Import a module for use in type hint? Milosz 0 156 Nov-08-2021, 06:49 PM
Last Post: Milosz
  Can't install nor import delorean module Tek 3 402 Oct-27-2021, 03:32 AM
Last Post: Tek
  import module with syntax error Skaperen 7 1,022 Jun-22-2021, 10:38 AM
Last Post: Skaperen
  Help with requests module 0xB9 3 951 Mar-14-2021, 06:49 AM
Last Post: buran
  KafkaUtils module not found on spark 3 pyspark aupres 2 2,084 Feb-17-2021, 09:40 AM
Last Post: Larz60+
  no module named finbert found ErnestTBass 4 1,761 Dec-05-2020, 06:09 PM
Last Post: andrianas
  module not found, is ok? 3Pinter 3 932 Nov-24-2020, 05:32 PM
Last Post: bowlofred
  How can I found how many numbers are there in a Collatz Sequence that I found? cananb 2 977 Nov-23-2020, 05:15 PM
Last Post: cananb

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020