I'm using the conda environment that comes with ArcGIS Pro 1.4 (administrative install in C:\Program Files\ArcGIS\Pro).
So I open a cmd-shell and cd into C:\Program Files\ArcGIS\Pro\bin\Python\Scripts (running as normal Windows user, not as an administrative one).
Creating and listing a new conda env works just fine:
C:\Program Files\ArcGIS\Pro\bin\Python\Scripts>conda create --name JebuTest python=3.5
Fetching package metadata: ......
Solving package specifications: .........
Package plan for installation in environment C:\Users\jebu\.conda\envs\JebuTest:
The following NEW packages will be INSTALLED:
Linking packages ...
[ COMPLETE ]|##################################################| 100%
# To activate this environment, use:
# > activate JebuTest
C:\Program Files\ArcGIS\Pro\bin\Python\Scripts>conda info --envs
# conda environments:
arcgispro-py3 C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3
root * C:\Program Files\ArcGIS\Pro\bin\Python
As I'm not administrator, the environment installs into my user's home directory.
But if I try to activate the environment, it fails:
C:\Program Files\ArcGIS\Pro\bin\Python\Scripts>activate JebuTest
No environment named "JebuTest" exists in C:\Program Files\ArcGIS\Pro\bin\Python\envs, or is not a valid conda installation directory.
Conda info also knows about my user's home directory:
C:\Program Files\ArcGIS\Pro\bin\Python\Scripts>conda info
Current conda install:
platform : win-64
conda version : 4.0.11
conda-build version : not installed
python version : 3.5.2.final.0
requests version : 2.11.1
root environment : C:\Program Files\ArcGIS\Pro\bin\Python (read only)
default environment : C:\Program Files\ArcGIS\Pro\bin\Python
envs directories : C:\Users\jebu\.conda\envs
package cache : C:\Users\jebu\.conda\envs\.pkgs
channel URLs : https://conda.anaconda.org/esri/win-64/
config file : C:\Program Files\ArcGIS\Pro\bin\Python\.condarc
is foreign system : False
I can workaround this, by manually setting CONDA_ENVS_PATH to my user's home directory, but that hides the default ArcGIS Pro environment..
Is this a bug in conda itself, a bug in ArcGIS Pro's installation of conda or just wrong usage?
I can confirm the same behavior on a new, default ArcGIS Pro 1.4.1 installation.
I think this is likely both a conda and Esri issue. Esri is still packaging conda 4.0.11 with ArcGIS Pro. It appears Esri isn't really updating conda with the new versions of Pro. I suspect we will get a new version of conda with ArcGIS Pro, but that is still a few months out.
The reason I mention the version of conda is that there have been many fixes with the activate script since 4.0.11. Although I can't confirm any of those fixes addressed the issue, I suspect that one of them does.
Jens, since you installed Pro in C:\Program Files but ran conda create without admin privilege, it had created the new environment in your local user profile. Hence when you tried to activate, conda looked for it in typical envs folder under c:\Program Files... and could not find it.
In this case, to activate your new env, first cd into the local user profile conda directory, then run the activate command by calling activate.bat with fully qualified path, as shown below:
c:\users\username\.conda\envs>"C:\Program Files\ArcGIS\Pro\bin\python\scripts\activate.bat" your_new_env_name
After this, you can change directory to your working directory and start Jupyter notebooks and this environment would continue to remain your active environment.
Atma Mani, although what you describe works, I still would argue that the conda bundled with ArcGIS Pro is not working "properly." The user shouldn't have to change to his/her local env to activate that environment.
As a simple test, I downloaded and installed the latest version of miniconda, which includes conda 4.3.11. After installing miniconda, I was able to both see and activate the environment that I created with ArcGIS Pro conda. I used the same command that doesn't work with ArcGIS Pro conda. I installed miniconda as administrator but ran the command as a non-privileged user, just like with my ArcGIS Pro installation.
I believe updating the version of conda will address the issue, but it may be something else with how Esri has packaged it.