I wrote a script to call an API and ran it successfully last week. This week, it won\'t run. I get back the following error message:
Traceback (most recent call
Either urllib3 is not imported or not installed.
To import, use
import urllib3
at the top of the file. To install write:
pip install urllib3
into terminal.
It could be that you did not activate the environment variable correctly. To activate the environment variable, write
source env/bin/activate
into terminal. Here env
is the environment variable name.
For me in PyCharm I had to put import urllib3
at the top of the file as mentioned earlier then PyCharm gave the option to import. Even after installing it with pip
Few minutes back, I faced the same issue. And this was because, I used virtual environment. I believe that due to venv directory, the pip installed might have stopped working.
Fortunately, I have setup downloaded in my directory. I ran the setup and chose the option to repair, and now, everything works fine.
set you environment by writing source env/bin/activate if env not found write virtualenv env first then source env/bin/activate , then check pip freeze if urllib3 not found there then reinstall urllib3, hope it helps.
pip install urllib3
The reason it broke is that I had installed an incompatible version of urllib3
as a transient dependency of awscli
. You'll see such conflicts when you rerun the install.