Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCharm doesn't recognise installed module

I'm having trouble with using 'requests' module on my Mac. I use python34 and I installed 'requests' module via pip. I can verify this via running installation again and it'll show me that module is already installed.

15:49:29|mymac [~]:pip install requests Requirement already satisfied (use --upgrade to upgrade): requests in /opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages 

Although I can import 'requests' module via interactive Python interpreter, trying to execute 'import requests' in PyCharm yields error 'No module named requests'. I checked my PyCharm Python interpreter settings and (I believe) it's set to same python34 as used in my environment. However, I can't see 'requests' module listed in PyCharm either.

PyCharm Python interpreter settings

It's obvious that I'm missing something here. Can you guys advise where should I look or what should I fix in order to get this module working? I was living under impression that when I install module via pip in my environment, PyCharm will detect these changes. However, it seems something is broken on my side ...

like image 749
Matthew Lowe Avatar asked Jul 05 '15 21:07

Matthew Lowe


People also ask

Why can't I import libraries in PyCharm?

Try installing/importing a package from the system terminal (outside of PyCharm) using the same interpreter/environment. In case you are using a virtualenv/conda environment as your Project Interpreter in PyCharm, it is enough to activate that environment in the system terminal and then do the test.

How do I import a module into PyCharm?

Type the name of the package and hit Alt-Enter , then choose Install and Import package . PyCharm will do both: you'll see a notification during the installation, then the import will be generated in the right way, according to your project styles.

Why packages are not installing in PyCharm?

The most viable troubleshooting action is to try installing the problematic package on the selected Python interpreter using the terminal. If you get an identical error message, then the problem is not in the IDE and you should review the rationales and typical cases, or search for a solution on the Internet.

How do I see what modules are installed in PyCharm?

At any time you can open it using the main menu: View | Tool Windows | Python Packages. The Python Packages tool window shows installed packages and the packages available in the PyPI repository. Use the Search field to filter out the list of the available packages.


1 Answers

If you are using PyCharms CE (Community Edition), then click on:

File->Default Settings->Project Interpretor

Screenshot: Interpretor Settings

See the + sign at the bottom, click on it. It will open another dialog with a host of modules available. Select your package (e.g. requests) and PyCharm will do the rest.

MD

like image 100
user7650698 Avatar answered Sep 24 '22 18:09

user7650698