Do I need to create a new conda env every time Prod is updated?

2044
7
03-21-2023 04:28 PM
Labels (2)
Trippetoe
Occasional Contributor III

Hello. I created a python script which uses the ArcGIS API for Python. I created a new conda env for the script because i also use several non-esri libraries. The conda environment was cloned from a ArcGIS Pro 2.8 install. Our IT staff recently updated all our machines to ArcGIS 2.9.  Now my script no longer runs. I get the following error message indicating an ArcGIS Pro version mismatch: 

Trippetoe_0-1679440979399.png

I activated the conda env before trying to execute my script, but there still seems to be a dependency on the pro-py3 environment.

Do i need to clone\create a new conda env based on the new version of ArcGIS Pro installed? I thought the advantage of using conda was to create independent environments that don't have these types of version dependencies.

Is there something that i'm not doing quite right here?

Thank you

0 Kudos
7 Replies
DanPatterson
MVP Esteemed Contributor

did you try updating the environment?

Don't know about 2.9, but in 3.x

Upgrade an environment—ArcGIS Pro | Documentation

check your version of the help topic


... sort of retired...
Trippetoe
Occasional Contributor III

Nope - not yet anyway. I'll do that right away. Thank you for the link.

Maybe i'm quibbling here (plus don't fully understand conda environments), but isnt the purpose of a conda environments to remove dependencies on other 'environments'?  Anyway, i'll try the update approach and let you know how it goes.

Thanks again.

0 Kudos
Luke_Pinner
MVP Regular Contributor

@Trippetoe wrote:

Maybe i'm quibbling here (plus don't fully understand conda environments), but isnt the purpose of a conda environments to remove dependencies on other 'environments'? 


I think the error message is a little misleading. But regardless, the version of arcpy in your cloned  environment needs to match the version of ArcGIS Pro to ensure binary compatibility, this is a common issue with other python packages that use C/C++ extension libraries.  

If your script that uses arcgis API doesn't use arcpy (and doesn't require any arcpy functionality), you can create a stand-alone conda env with arcgis that doesn't include arcpy and thus doesn't depend on a specific version of ArcGS Pro.

E.g. from the command line:

 

conda create -n arcgisapi -c esri arcgis

 

https://developers.arcgis.com/python/guide/anaconda

 

 

0 Kudos
Trippetoe
Occasional Contributor III

Turns out that updating the environment with a magic desktop command is not possible in 2.9, and the

conda proup

command doesn't exist yet.  Any other ideas i can try other than just rebuilding the environment from scratch?

Trippetoe_0-1679443751061.png

0 Kudos
DanPatterson
MVP Esteemed Contributor

I was afraid of that, so you are probably already done cloning arcgispro-py3 and adding your packages already, but for future reference, you can create one using a *.yml file

Managing environments — conda 23.3.0.post6+9929f60ed documentation

clones are still pinned so you will have to deal with that in 2.9 onward


... sort of retired...
Trippetoe
Occasional Contributor III

Thank you for sharing your knowledge with me. I really appreciate it. 

Yah, it turned out to be more efficient to recreate the conda environment. Strangely, i had documented the process pretty well the last time, so it wasn't so painful. who knew documentation could be so helpful 😉

 

DanPatterson
MVP Esteemed Contributor

It becomes more important with age... as well as changing technology 😀


... sort of retired...
0 Kudos