Cannot activate conda env when created in a path
See original GitHub issueWhat steps will reproduce the problem?
1 Create a conda environment with the --prefix option, specifying a path rather than an environment name.
2 install spyder-kernel in the environment.
3 Inside the new environment, create an environment variable using: conda env config vars set MY_VAR=‘HELLO’
4 launch spyder from another conda environment (can be the base environment)
5 change the Python Interpreter to point to the python.exe file in the new environment. The path is obtained from the command: python -c “import sys; print(sys.executable)”
6 Create a new console or restart the kernel. Spyder outputs the message ‘<path_to_env>/Scripts/activate’ is not recognized as an internal or external command.
Python 3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 19:20:16) [MSC v.1916 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.
IPython -- An enhanced Interactive Python.
Restarting kernel...
'C:/<path_to_dir>/.conda/dev_env/Scripts/activate' is not recognized as an internal or external command,
operable program or batch file.
7 Check that the environment variable MY_VAR does not exist.
If the environment is created with a name and placed in the default miniconda3/envs directory, there is no issue and the new environment appears directly in the Spyder drop-down menu for the Python interpreter.
Environment
- Spyder version: 5.1.5 None
- Python version: 3.8.12 64-bit
- Qt version: 5.12.9
- PyQt5 version: 5.12.3
- Operating System: Windows 10
Installation from miniconda3
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (8 by maintainers)
Top GitHub Comments
Just tested: I uninstalled standalone Spyder 5.3.2, which was installed “for all users” (with Admin privileges), and installed it again “just for me” (using the the standalone installer). Now the console starts without error when using a custom interpreter.
If it matters: my Miniconda is also installed “just for me” in
C:\users\username\Miniconda3
.@ccordoba12 I met the same problem in
5.3.0
, conda environment created in a path is not properly activated, but conda env in default path(in my case is ‘C:\ProgramData\Miniconda3\envs\envname\python.exe’) can be properly activated. Today I update to5.3.1
and change none of settings, the same conda env in default path can’t be properly activated! It shows :I think this problem will nag many people, hope it can be resolved in the near future.