Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ IDEA says "unresolved reference" on everything (Python, virtual environment)

How can I get IntelliJ IDEA to recognize common Python modules? IntelliJ IDEA is complaining "unresolved reference" on everything despite that I have added my virtual environment as a "Python interpreter" and invalidated caches. These (1)(2) related questions did not help resolve the issue.

unresolved reference Interpreter is setup

like image 367
Atte Juvonen Avatar asked Mar 06 '18 22:03

Atte Juvonen


People also ask

How do I import a python module into IntelliJ?

Import an existing module iml file from another project: From the main menu, select File | New | Module from Existing Sources. In the dialog that opens, specify the path the . iml file of the module that you want to import, and click Open.


1 Answers

The errors are caused by wrong source roots configuration. Your project doesn't know where to locate the reference.

Add a new content root From the main menu, select File | Project Structure⌘; and click Project Settings | Modules.

Select the necessary module and then open the Sources tab in the right-hand part of the dialog.

Click Add Content Root and specify the folder that you want to add as a new content root.

The link is here.

IntelliJ support discussed the same issue at here.

Another stack overflow discussion is here.

like image 200
JIANG Avatar answered Nov 14 '22 00:11

JIANG