More languages, more power: Python support


CLion is known to be a cross-platform IDE for C and C++. However, the first CLion 1.5 EAP build brought the Swift support to CLion and made IntelliJ-based Swift IDE on Linux possible. Recent CLion EAP build added support for Python. Let’s take a look at the features.

Initial setup

Getting started with Python in CLion is way more easier than starting with Swift, since the plugin is already bundled into the IDE and is on by default. All you need is to install Python SDK and point CLion to the Python interpreter for your project:
Since CLion is using CMake project model as a basis, you still need to have a proper CMake project, and then can mix Python and C/C++.

Rem. In case of working with Python in CLion due to PY-18231 and PY-18221 we do recommend to set run.processes.with.pty to false in CLion’s registry:

  • in Find Action dialog (Shift+Ctrl+A on Linux/Windows, ⇧⌘A on OS X) type Registry,
  • in the registry type run.processes.with.pty to find the parameter,
  • untick the parameter there.

This is necessary for correct Python console and Python run/debug functioning.

We also observed several problems with debugger on Windows, when using Python from Cygwin. So better install it from here.


The feature set corresponds to the PyCharm IDE Community Edition and includes all the basic and essential Python editing features, as well as running, debugging and testing.

You may notice quite a lot of new settings available if filter them typing ‘python’:

Python plugin in CLion provides:

  • Python code parsing and highlighting. Colors & Fonts settings will help you to configure your favourite scheme.
  • Python code built-in code formatter together with the separate set of Python code style settings that support you code style preferences.
  • Code completion, file structure view and various navigation actions:
  • Find Usages in Python code.
  • Live Templates for generating widely-used code samples with ease:
  • Refactorings, including Rename, Change Signature, Extract Variable/Parameter/Constant/etc. and more.
  • A huge list of code intentions and inspections with quick fixes to make your code better and raise its quality:
  • Quick documentation:
    and various external documentation resources.
  • Python console: you can start it from Tools | Python Console or Find Action dialog, alternatively you can execute any Python code in console by simply pressing Alt+Shift+E.
  • Run and debug for Python configurations.
  • Unit testing.

Short demo below will demonstrate you some of the features:

Download the build and give it a try. Share your feedback in the comments section below. We’ll be glad to hear what you think about the Python support in CLion.

And in case you are interested in more PyCharm features, find a set of video tutorials covering PyCharm functionality and features here.

Sincerely yours,
The CLion Team

This entry was posted in Tips'n'Tricks and tagged , , , . Bookmark the permalink.

26 Responses to More languages, more power: Python support

  1. Yury V. Zaytsev says:

    YAY!!!11 for Python support in CLion. I find it a pretty sad that Cython support doesn’t seem to be included though. One important reason why you would want to deal with Python from inside CLion anyways is obviously in order to work on idiomatic Python bindings for your C++ software (or bindings where you need to be in control of very low level stuff for performance reasons). In this case, Cython (possibly on top of some autogenerator) is clearly the way to go. No support for Cython == low productivity in this scenario :-(

  2. Martin Pecka says:

    Now, CLion has become the best and single IDE for developing in ROS (Robot Operating System)

  3. Dmitry Romanov says:

    Wow! You are doing a great job! Thank you!

    I would also like to see Cython support here. I think it is ok moving it from PyCharm pro because CLion is not free too.

  4. NoName says:

    lua/luaJIT support would be awesome, since it’s used a lot as embedded language in c/c++ programs.

  5. Thomas Johnson says:

    Can you use CLion to debug C/C++ Python extensions?

  6. Olof Edlund says:

    When should one use PyCharm and when should one use CLion with regards to Python?

    I’m mainly a C++ developer (work) and I’m using CLion but I’m about to dabble with Raspberry Pi for fun at home and I don’t know which IDE to choose.

    I’m guessing PyCharm probably is a better platform for pure Python development but I’m used to CLion and I wouldn’t mind to learn things on how I might be able to use Python in conjunction with C++ at work.

    • Anastasia Kazakova says:

      Python plugin in CLion is not for pure Python dev, PyCharm is a better option for this, since it supports a lot of Python specific features/frameworks/tools/etc. However, if you have a mixed C/C++ and Python project, or use Python for some code generation, etc. scripting in your C/C++ projects, then CLion is a choice for you.

  7. Chris says:

    I’m getting: “Error running error=7, Argument list too long” when trying to run a python program in the clion terminal.

    EAP Build: 145.184.4, JRE: 1.8.0_76-release-b18 amd64

    • Anastasia Kazakova says:

      Could you please share which program are you trying to run? How do you do that? Can you run it the same way from the usual terminal (not in CLion)?

  8. Giles says:

    Want to be able to use “Project Structure” in CLion to set a python source folder. Looks like it’s missing from CLion. I can find and set it in PyCharm but alas get unresolved references in CLion. Is there a way (aside from altering the python path env to include the dir) to do this?
    (There’s not much that can’t be coded with Rust + Python)

    • Anastasia Kazakova says:

      CLion doesn’t have Project Structure window as PyCharm does. But the same functionality is available in CLion in the context menu on the file if you call it in the project view, and it’s called Mark Directory as | Project Sources and Headers.

      • Don Griffin says:

        (CLion 2019.1) Doing that does not fix complaints on imports of my python code. If I Mark Directory as | Library Files, the imports work and Go To Definition seems to work. Is there a right-er way?

        • Anastasia Kazakova says:

          If that works for you, then why not. We probably have to investigate deeper on how Mark Directory As affects other languages than C++ in CLion.

  9. Alexander Johnson says:

    I’ve tried several times over the last couple of years to make CLion resolve my Python imports. I always fail. I’m tired of using it as a crippled text editor.

    Let’s say I have a directory in my project called src/lib/python. All I want is some setting in CLion which is equivalent to adding this directory to my PYTHONPATH. In other words: I want CLion to resolve references to code in src/lib/python/foo when I call “import foo” from any another Python script in the project (including tests). How do I do this?

    • Anastasia Kazakova says:

      Do you have a CMake project?

      • Alexander Johnson says:

        I don’t. It’s a mixed project containing several different languages. I’m using CLion for the remote toolchain support. There’s a Makefile, but no CMakeLists.txt.

        I read yesterday that CLion has a bug where it won’t give you all the options on the context menus (IE: mark directory as source root) if CMake isn’t set up for the project. On a whim, I tried manually editing the project’s .iml file to include src/lib/python as a source root and test/lib/python as a test root since the GUI options were missing. This worked.

        I’m extremely pleased to finally have autocomplete suggestions and ‘go to source’ functionality for my own code!

        • Anastasia Kazakova says:

          Unfortunately, this is now not supported. CLion can work only with CMake, compilation database or Gradle projects. It requires a project model to get all the information about the files in project, their compilation options, flags, header search paths, etc. to be able to resolve the code correctly and provide code insights.

Leave a Reply

Your email address will not be published. Required fields are marked *