Troubleshooting
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, see 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/Preferences 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 suggestions 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/Preferences 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/Preferences 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 dev. | Use your package manager to install header files and static libraries for Python dev system-wide. For example, you can use the following commands:
|
The following error message is shown:
| You lack a C compiler. | Install a C compiler in order to build Cython extensions for the debugger. |
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 | ||
Unable to connect to Docker | Docker is not running, or your Docker connection settings are incorrect. | In the Settings/Preferences dialog Ctrl+Alt+S, select , and select Docker for <your operating system> under Connect to Docker daemon with. For example, if you're on macOS, select Docker for Mac. See more detail in Docker settings. If you are using Docker Toolbox, make sure that Docker Machine is running and its executable is specified correctly in the Settings/Preferences dialog Ctrl+Alt+S under Build, Execution, Deployment | Docker | Tools. |
Docker-composer does not work on Ubuntu using unix socket settings. | Docker-composer reports the following error:
docker.errors.TLSParameterError:
Path to a certificate and key
files must be provided through
the client_config param.
TLS configurations should map the
Docker CLI client configurations.
|
|
When you try to pull an image, the following message is displayed: | Invalid Auth config file when using | Go to <your_home_dir>/.docker directory and delete the config.json file. |
Unable to use Docker Compose | Docker Compose executable is specified incorrectly. | Specify Docker Compose executable in the Settings/Preferences dialog Ctrl+Alt+S under Build, Execution, Deployment | Docker | Tools |
Unable to use port bindings | Container ports are not exposed. | Use the EXPOSE command in your Dockerfile |
High CPU usage while connecting to Docker via services. | When Hyper-V is selected as the backend for the Docker service on Windows, Hyper-V virtual disk files (.vhdx) are constantly scanned by the anti-virus software. This behavior leads to excessive consumption of CPU, even no container is running. | Exclude Hyper-V virtual disk files from the anti-virus scan. |
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 Tips
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 |