How to choose the ArcGIS Pro Python environment used by Jupyter Notebook?

542
2
07-16-2019 08:21 AM
AndrewRudin1
Occasional Contributor

I am trying to get going with Jupyter Notebooks and the ArcGIS API for Python, but I'm having some problems with the version installed with ArcGIS Pro 2.4.  I know that in Pro you can create multiple Python environments, and you can activate which one is used by the project via the GUI by going to Project->Python.  I saw that Pro 2.4 installs the ArcGIS API version 1.6.1...however the API website shows 1.6.2 is the latest.  I created a clone of the default environment and upgraded the API using these instructions.  When I go back into Pro I can see the clone environment has arcgis api version 1.6.2, and it is the active version for my project.

The problem is, when I open the Jupyter Notebooks provided on the Start Menu under ArcGIS, I believe it is using the default environment and not my upgraded one.  I don't see anything on the Jupyter Notebook interface that tells me which environment is being used.  To check, I created a new notebook and entered the following code: 

import arcgis

print(arcgis.__version__)

The result says 1.6.1, therefore I assume it's using the default environment.

Any advice on how to get the Jupyter Notebook to use my clone environment?  I'm trying to stick with the out of the box tools installed with Pro

0 Kudos
2 Replies
KarstenRank
Occasional Contributor III

Hi Andrew,

if you use 

print(arcgis.__path__)

you get the path of the active Python environment used by Jupyter Notebook.

You can activate the version in the python package manager under manage environments.

Greetings 

Karsten

AndrewRudin1
Occasional Contributor

Thanks for the response.  I think I'm going to put in a support ticket.  For me, running print(arcgis.__path__) returns the path to my default environment, even though the cloned environment is shown as the active one in the Pro python package manager.