Configure a conda virtual environment
PyCharm supports creating virtual environments for Python with Conda. The following procedure applies to all supported operating systems. Use the platform switcher at the top of this page to view shortcuts specific to your operating system.
Ensure that Anaconda or Miniconda is downloaded and installed on your computer, and you're aware of a path to its executable file.
For more information, refer to the installation instructions.
Do one of the following:
Click the Python Interpreter selector and choose Add New Interpreter.
Press CtrlAlt0S to open Settings and go to Project: <project name> | Python Interpreter. Click the Add Interpreter link next to the list of the available interpreters.
Click the Python Interpreter selector and choose Interpreter Settings. Click the Add Interpreter link next to the list of the available interpreters.
Select Add Local Interpreter.
In the left-hand pane of the Add Python Interpreter dialog, select Conda Environment.
The following actions depend on whether you want to create a new conda environment or to use an existing one.
Click OK to complete the task.
If the directory with your source files contains an environment.yml file, PyCharm can create a conda environment based on it.
Do one of the following:
Go to File | Open.
On the Welcome Screen, click Open.
Browse for the directory which contains your source files and the environment.yml file, and then click Open (on Mac) or OK (on Windows):
If you didn't create a project and configure a Python interpreter in that directory before, PyCharm suggests creating a conda environment:
Keep the suggested options, or specify an alternative Conda executable. Click OK to complete the task.
Once you click OK, PyCharm creates an environment and installs all the required packages.
Note that if you ignore a suggestion to create a Conda environment, PyCharm won't create a Python interpreter for your project. So, any time when you open a .py file, you'll see the warning with the options for configuring a project interpreter:
![Warning with options for configuring a project interpreter Warning with options for configuring a project interpreter](https://resources.jetbrains.com/help/img/idea/2024.2/py_create_conda_requirements_file.png)
For any of the configured Python interpreters (but Docker-based), you can:
Thanks for your feedback!