Problem
- Go to Declaration or Usages on an imported name shows the hint "Cannot find declaration to go to".
- No import is underlined in red, also an import of a package that is not installed. The file shows the green check.
- The banner "No Python interpreter configured for <project name>" is above the editor, and the status bar shows
No interpreter. - The script runs without errors from a terminal.
Cause
The project has no Python interpreter. Without an interpreter PyCharm does not check imports and cannot find names from installed packages. A missing red underline in this state does not mean that the import is found.
PyCharm does not read the #! line of a script to choose an interpreter. For a folder without a virtual environment PyCharm does not set a system interpreter by itself.
Resolution
- In the banner above the editor, click Custom Environment.
- Click Add Local Interpreter….
- Select Select existing.
- Keep Type: set to
Python. - In Python path: select the interpreter that has the packages, for example
/usr/local/bin/python3.10. - Click OK.
- Wait until the background tasks in the status bar finish.
The banner goes away, Go to Declaration opens the package source, and an import of a package that is not installed gets the error "Unresolved reference".
A new virtual environment does not contain the packages of the system interpreter. To use packages that are already installed, select the existing interpreter and do not create an environment.
Tested on PyCharm 2026.2.3 (Build #"Implement standard interface" action.10968.92) and PyCharm 2026.3 EAP 4 (Build #Paired quote autoinsertion doesn't work after r.5701.41) on Linux.
Configure a Python interpreter describes the other interpreter types.
PyCharm can't install/import a package/library/module covers a package that is installed in a different interpreter than the interpreter of the project.
Comments
0 comments
Please sign in to leave a comment.