intellij-community icon indicating copy to clipboard operation
intellij-community copied to clipboard

fix: Failed to activate conda environment

Open liuzhenghua opened this issue 7 months ago • 0 comments

Issue Description

An error ocurred while open the Terminal:

+ Failed to activate conda environment.
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (Failed:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

image 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

  1. Install Miniconda3 on Windows.
  2. Verify the installation directory is %USERPROFILE%/AppData/Local/miniconda3.
  3. Modify the %USERPROFILE%/.condarc file to change the envs_dirs and pkgs_dirs:
envs_dirs:
  - D:\data\conda_envs
pkgs_dirs:
  - D:\data\conda_pkgs
  1. Use PyCharm to create a conda environment, and open the Terminal in PyCharm.

liuzhenghua avatar Jul 25 '24 03:07 liuzhenghua