Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ IDEA 14 does not recognise Python built-in types when using interpreter in virtualenv

I'm using IntelliJ IDEA 14 on OSX for a Python project that uses a virtual environment. The program runs fine both in the terminal and using the run command inside IDEA, but it is not recognising Python built in types and functions.

IDEA is not recognising Python built in types and functions

I created the virtual environment and added it to my Project Structure following the steps below, which according to posts I read, should work, but I cannot figure out what is going wrong.

  1. Added Python in venv as the Project SDK.

Added Python in <code>venv</code> as the Project SDK

  1. Added Python in venv as Python interpreter in Modules.

Added Python in <code>venv</code> as Python interpreter in Modules.

  1. Added Python in venv as the Python interpreter in Facets.

Added Python in <code>venv</code> as the Python interpreter in Facets.

  1. Ensured that the appropriate Python interpreter is the selected SDK.

Ensured that the appropriate Python interpreter is the selected SDK.

  1. These are the global libraries.

These are the global libraries

[Update]

Following one of the comments below, I recreated the virtual environment from scratch. The built-in types for Python are now recognised, but the libraries in the venv folder are not.

Error importing modules.

Modules.

like image 729
Juan Carlos Farah Avatar asked Oct 20 '22 18:10

Juan Carlos Farah


1 Answers

You need to put the Python 2.7.x interpreter library in the dependencies of your python module. Having the python SDK is not enough.

like image 57
alexandre Clement Avatar answered Oct 22 '22 08:10

alexandre Clement