IntelliJ IDEA 2022.2 Help

Create a Python project

  1. Ensure that the Python plugin is installed and enabled.

  2. From the main menu, choose File | New | Project or on the Welcome screen, click New Project.

  3. In the New Project dialog, select Python as a project type.

    New Python project: existing interpreter

    If you have any configured Python environments, select one from the list, or click The Browse button and specify a path to the target environment.

  4. If no environment is available, select the New button and choose the environment type:

    Create a new venv environment
    • Specify the location of the new virtual environment in the text field, or click Virtual environment location and specify it in your file system. Note that the directory where the new virtual environment should be located, must be empty!

    • Choose the base interpreter from the list, or click Choose the base interpreter and find a Python executable in the your file system.

      If IntelliJ IDEA detects no Python on your machine, it provides two options: to download the latest Python versions from python.org or to specify a path to the Python executable (in case of non-standard installation).

    • Select the Inherit global site-packages checkbox if you want that all packages installed in the global Python on your machine to be added to the virtual environment you're going to create. This checkbox corresponds to the --system-site-packages option of the virtualenv tool.

    • Select the Make available to all projects checkbox if you want to reuse this environment when creating Python interpreters in IntelliJ IDEA.

    Create a new venv environment
    • Ensure that Anaconda or Miniconda is downloaded and installed on your computer, and you're aware of a path to its executable file.

      Refer to the installation instructions for more details.

    • Specify the location of the new Conda environment in the text field, or click Conda environment location and specify it in your file system. Note that the directory where the new Conda environment should be located, must be empty!

    • Select the Python version from the list.

    • Specify the location of the Conda executable file in the text field, or click Conda executable location and find location in the Conda installation directory. You're basically looking for a path that you've used when installing Conda on your machine.

    • Select the Make available to all projects checkbox if you want to reuse this environment when creating Python interpreters in IntelliJ IDEA.

    Create a new venv environment
    • Ensure that you have installed Pipenv on your machine.

    • Choose the base interpreter from the list, or click Choose the base interpreter and find a Python executable in the your file system.

    • If you have added the user base’s binary directory to your PATH environmental variable, you don't need to set any additional options: the path to the pipenv executable will be autodetected.

      If you have not modified the PATH variable, IntelliJ IDEA shows an error message: Pipenv executable is not found. Discover the proper executable path as described in the pipenv installation procedure and enter the target string in the Pipenv executable field, for example: C:\Users\jetbrains\AppData\Roaming\Python\Python37\Scripts\pipenv.exe (Windows) or /Users/jetbrains/.local/bin/pipenv (macOS).

    Create a new venv environment
    • Ensure that you have installed Poetry.

    • Select the base Python interpreter from the list, or click Virtual environment location and find its location in your file system.

    • If IntelliJ IDEA has not discovered the Poetry path, click Show Poetry path near Poetry executable and navigate to its location. Then click OK in the explorer window to add it to the field.

  5. Click Create to complete the task.

Last modified: 29 November 2022