intellij-community
intellij-community copied to clipboard
fix: Failed to activate conda environment
Issue Description
An error ocurred while open the Terminal:
+ Failed to activate conda environment.
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (Failed:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
The actual reason for this error can be found in the logs:
2024-07-25 10:35:24,316 [1553431] INFO - #c.j.p.packaging - System conda executable is not found
2024-07-25 10:35:24,316 [1553431] WARN - #c.i.p.t.PyVirtualEnvTerminalCustomizer - Can't find null, will not activate conda
This is because the default installation location for conda is the local app data directory, but this directory is not in PyCharm's search path list. If the user changes the conda environment path, then PyCharm cannot find the conda path.
Issue Reproduction
- Install Miniconda3 on Windows.
- Verify the installation directory is %USERPROFILE%/AppData/Local/miniconda3.
- Modify the
%USERPROFILE%/.condarc
file to change theenvs_dirs
andpkgs_dirs
:
envs_dirs:
- D:\data\conda_envs
pkgs_dirs:
- D:\data\conda_pkgs
- Use PyCharm to create a conda environment, and open the Terminal in PyCharm.