Creating Empty Python Project
To create an empty project:
- On the main menu, choose Welcome screen, click New Project.
New Project dialog box opens.
or on the In the left-hand pane of the New Project dialog box, select Python as a project type.
- In the right-hand pane, specify the project SDK. If the desired SDK is missing in the list, click New and create one of the following Python SDK: In the left-hand pane of the Add Python Interpreter dialog box, select Virtualenv Environment. The following actions depend on whether the virtual environment existed before.
If New environment is selected:
Specify the location of the new virtual environment in the text field, or click and find location 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 drop-down list, or click and find the base interpreter in the your file system.
Select the Inherit global site-packages check-box if you want to inherit your global site-packages directory. This check-box corresponds to the
--system-site-packages
option of the virtualenv tool.Select the Make available to all projects check-box, if needed.
If Existing environment is selected:
Specify the required interpreter: use the drop-down list, or click and find one in your file system.
Select the check-box Make available to all projects, if needed.
In the left-handed pane of the Add Python Interpreter dialog, select Pipenv.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:Click OK to complete the task.
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).Click OK to save the changes and complete the task.
In the left-hand pane of the Add Python Interpreter dialog box, select Conda Environment. The following actions depend on whether the Conda environment existed before.If New environment is selected:
Specify the location of the new Conda environment in the text field, or click and find location 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 drop-down list.
Specify the location of the Conda executable file in the text field, or click and find location in the Conda installation directory.
Select the Make available to all projects check-box, if needed.
If Existing environment is selected:
Specify the required interpreter: use the drop-down list, or click and find one in your file system.
Select the check-box Make available to all projects, if needed.
In the left-hand pane of the Add Python Interpreter dialog box, select System Interpreter. In the Interpreter field, type the fully-qualified path to the required interpreter executable, or click and in the Select Java Interpreter dialog box that opens, choose the desired Java executable and click OK. Note that you will need admin privileges to install, remove, and upgrade packages for the system interpreter. When attempting to install an interpreter package through an intention action, you might receive the following error message: As prompted, consider using a virtual environment for your project. Click OK to complete the task.In the left-hand pane of the Add Python Interpreter dialog box, click SSH Interpreter. In the right-hand pane select New server configuration, then specify server information (host, port, and username). Alternatively, you can select Existing server configuration and choose any available deployment configuration from the list. If needed, click to review the Connection settings, Mappings, and Excluded paths for the selected deployment configuration. Click Next to continue configuring an interpreter. In the next dialog window, provide the authentication details to connect to the target server.Select Password or Key pair (OpenSSL or PuTTY) and enter your password or passphrase.
Click Next to proceed with the final configuration step.In the next dialog window, verify the path to the desired Java interpreted. You can accept default, or specify a different one. You have to configure the path mappings between your local project and the server. To do that, click next to the Sync folders field and enter the path to the local project folder and the path to the folder on the remote server.
You can also select two checkboxes to upload local project directories to the remote server and to enable automatic upload of the local changes to the remote server.
Click Finish to complete adding an interpreter.In the left-hand pane of the Add Python Interpreter dialog box, click Vagrant: Click the browse button next to the field Vagrant instance folder, and specify the desired Vagrant instance folder.This results in showing the link to Vagrant host URL.
The Python interpreter path field displays the path to the desired Python executable. You can accept default, or specify a different one. Click OK. The configured remote interpreter is added to the list.In the dialog box that opens, select the Docker option, from the drop-down lists select the Docker server (if the server is missing, click New...), and specify the image name.
Python interpreter path should have the default value, for example,
python
:Click OK to complete the task.
In the dialog box that opens, select the Docker Compose option, from the drop-down lists select the Docker server, Docker Compose service (here
web
), configuration file (heredocker-compose.yml
)and image name (herepython
).Next, wait while IntelliJ IDEA starts your Docker-Compose configuration to scan and index:
Click OK to complete the task.
If needed, select additional libraries and frameworks to enable with the project. When selecting a particular framework, ensure that it is supported by the specified project SDK. Also, provide the required parameters.
Click Next.
On the next page, select the Create project from template checkbox if you want to use a project or framework template for the new Python project.
Specify the project name and location.
Click Finish to complete the task.