amazing carrot soup
amazing carrot soup

Reputation: 265

unable to import requests after installing in virtual environment python 2.7 pycharm

so I navigate to my virtual environment.

Activate it

do pip install requests

it installs

i go to a file and then import requests

then get this error:

No module named request less... (Ctrl+F1) 
This inspection detects names that should resolve but don't. Due to dynamic dispatch and duck typing, this is possible in a limited but useful number of cases. Top-level and class-level items are supported better than instance items.

i did pip install again just to see and I get this:

pip install requests
Requirement already satisfied: requests in ./lib/python2.7/site-packages
Requirement already satisfied: certifi>=2017.4.17 in ./lib/python2.7/site-packages (from requests)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./lib/python2.7/site-packages (from requests)
Requirement already satisfied: idna<2.7,>=2.5 in ./lib/python2.7/site-packages (from requests)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in ./lib/python2.7/site-packages (from requests)

Im using pycharm and in a django project. I dont think either of those matter but just in case.

Upvotes: 0

Views: 1028

Answers (1)

amazing carrot soup
amazing carrot soup

Reputation: 265

The answer was that my pycharm software was set to the global install of python not my virtual env instance. I had to set up pycharm to use that env instance, by following the instructions here:

http://exponential.io/blog/2015/02/10/configure-pycharm-to-use-virtualenv/

Upvotes: 1

Related Questions