Troubleshooting PyCharm
While working with PyCharm, you might encounter some warning or error messages. This chapter provides the list of the known problem solutions and workarounds.
You can also find the recommendations for troubleshooting and performing basic diagnostics of your working environment.
Reported Problem | Possible cause | Solution |
---|---|---|
Project Settings | ||
A Python interpreter is marked as unsupported in the list of available interpreters in . | The Python version of the marked interpreter is outdated and it is not supported in PyCharm | You can delete the unsupported interpreter from the list of the available interpreters. For more information about the supported Python versions, refer to Python Support. |
Code Editing | ||
PyCharm Editor restricts code editing. | You have installed the IdeaVim plugin and thus enabled the vim editing mode. | Deselect Vim Emulator on the menu. See Using Vim Editor Emulation in PyCharm for more details. |
Python code is not highlighted in the Editor. | The PY files are associated with the text file format. | In the Settings dialog (Ctrl+Alt+S) , navigate to , select Text from the Recognized File Type list, select *.py from the File Name Patterns list, and click . |
Code Completion | ||
Code completion action is not available. | Power Save Mode is enabled. | From the main menu, choose File and clear the Power Save Mode checkbox. |
Your file doesn't reside in a content root , so it doesn't get the required class definitions and resources needed for code completion. | Restructure your sources files. | |
A file containing classes and functions that you want to appear in the completion suggestion list is a plain text file. | Reconsider and modify (if needed) the format of your source files. | |
Debugging | ||
Cannot debug a Docker run/debug configuration; the Debug action is not available. | PyCharm provides debugging for Python run/debug configurations. | Configure a Docker-based interpreter and debug your Python script in a Docker container. |
Python Debugger hangs when debugging Gevent code. | Gevent compatibility mode is not enabled. | In the Settings dialog (Ctrl+Alt+S) , navigate to and select the Gevent compatible checkbox. |
Some import errors are reported in your PyQt code. | PyQt is installed on the interpreter but is not imported in the application code. | In the Settings dialog (Ctrl+Alt+S) , navigate to , and clear the PyQt compatible checkbox in the . This mode is enabled by default. |
Debugging process is slow. | Debugger stops not only when the process terminates with an exception but on each exception thrown (even though it was caught and didn't lead to the process termination). | Clear the On raise checkbox in the Breakpoints dialog ( ). |
The following error message appears on your first attempt to attach to a local process: | It a known issue for Ubuntu. | Ensure that the |
Cython Speedups | ||
The following error message is shown:
| You lack header files and static libraries for Python. | Use your package manager to install the On Linux and macOS, you can run the following command:
sudo apt-get install python-dev
To install the package for specific Python version, use
sudo apt-get install python3.11-dev
|
The following error message is shown:
| You lack a C compiler. | Install a C compiler in order to build Cython extensions for the debugger. For more information, refer to the Cython documentation. |
You have already clicked the Install link in the Cython speedup extensions notification but PyCharm repeatedly prompts to install it. | You do not have permissions to write in the directories used by PyCharm. | Check and modify your permissions. |
Packaging | ||
Package installation fails. | pip is not available for a particular Python interpreter, or any of the installation requirements is not met. |
|
Docker (refer to Docker troubleshooting) | ||
File Watchers You might notice the following messages in the window. | ||
| The File Watcher uses a scope that is not defined in this project. | Double-click the watcher and select an available scope or create a new one. |
| The project uses a global File Watcher that was removed. | Delete the watcher from the list using the Remove button or edit it to create a new global watcher with the same name. |
Deployment | ||
Error message when using SSH configurations: | The RFC 4716 format for OpenSSH keys is not supported by PyCharm. |
|
The Profile command is not available in the Run menu. |
| Check the edition of PyCharm and enable the Diagrams plugin in the plugin settings. |
In some cases, you might need to perform diagnostic steps to identify whether the problem occurs in PyCharm or in your working environment. Below is the list of the useful tips and tricks.
Troubleshooting case | Diagnostic action |
---|---|
You are experiencing different behavior of your application when running it in PyCharm and in the Terminal window. | Run your script with the python version specified in the PyCharm project settings:
If the behavior of your application still differs, contact the support service pycharm-support@jetbrains.com |
The required package is not installed for a particular Python interpreter. A version of the package installed for a particular Python interpreter is outdated. | Run the following commands to install the required package:
For example, Once executed, these commands install the latest versions of the specified packages. To install a particular version of the package, use the following expressions:
For example, the following command installs Flask compatible with the version 1.0.2:
For example, Once executed, these commands install the latest versions of the specified packages. To install a particular version of the package, use the following expressions:
For example, the following command installs Flask compatible with the version 1.0.2: |
When trying to install a package, you discover that pip is not available for a particular Python interpreter. | Try to bootstrap pip from the standard library:
For example,
For example, For more information about pip installation, refer to packaging.python.org |