0

I have had to reinstall ArcGIS Pro 2.0 and have attempted to recreate an Anaconda environment, but am running into some problems. When I create a new environment from the initial ArcGIS Pro environment, I can install packages using pip, but then when I try to load them from within the cloned environment, the modules can't be found. Here are the steps I performed.

  1. Open Command Prompt as provided by ArcPro (not in the GUI)
  2. conda create --clone old --name new
  3. activate new
  4. pip install package
  5. python -c "import package"

This results in an error message. Within the new environment, sys.executable returns the old environment. If I provide the hard path the python executable in the new environment, I can load the package. But this behavior doesn't seem right. I am assuming that when I try to open python within an Anaconda environment it should use the environment's python version.

  • The old environment doesn't have to be activated to clone it. I am editing to clarify what I did. – user44796 Jul 11 '18 at 21:08
  • I didn't say it needs to be activated to clone. However, you are activating old by using the ArcGIS Pro command prompt and if the above are your exact steps, you are not deactivating old before cloning and activating new. So perhaps there is a conflict between old and new because old is never deactivated...? – user2856 Jul 13 '18 at 3:25
2

@user44796 if possible you may just want to move up to later version of Pro.

Your expectation matches the 2.2 behavior nicely.

2.2 session below (sanitized for noise).

(arcgispro-py3) C:\Program Files\ArcGIS\Pro\bin\Python\Scripts>conda create --clone arcgispro-py3 --name new
Source:      C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3
Destination: C:\Users\user\AppData\Local\ESRI\conda\envs\new
Packages: 98
Files: 23
- Validating: ok

(arcgispro-py3) C:\Program Files\ArcGIS\Pro\bin\Python\Scripts>activate new

(new) C:\Program Files\ArcGIS\Pro\bin\Python\Scripts>pip install bs4
Collecting bs4
Collecting beautifulsoup4 (from bs4)
  Using cached https://files.pythonhosted.org/packages/fe/62/720094d06cb5a92cd4b3aa3a7c678c0bb157526a95c4025d15316d594c4b/beautifulsoup4-4.6.1-py3-none-any.whl
Installing collected packages: beautifulsoup4, bs4
Successfully installed beautifulsoup4-4.6.1 bs4-0.0.1
You are using pip version 9.0.3, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

(new) C:\Program Files\ArcGIS\Pro\bin\Python\Scripts>python -c "import bs4;print(bs4.__version__)"
4.6.1
0

The issue is that when ArcPro creates a clone of an environment, the clone still links back to the original environment's python executable. So when you install packages via pip in the new environment, they are not available to that environment. However, if you start spyder from within the new environment, it does link to the new environment's python executable and you can load pip-installed packages. Not sure why, but seems to be the way ArcGIS wants to structure their clones.

0

Posting the fix I found,

typed into cmd at the conda install location

conda create -k --clone arcgispro-py3 --name test

the -k runs the command in the insecure ssl mode

Here is the reference I used:

https://docs.conda.io/projects/conda/en/latest/commands/create.html#Networking%20Options

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.