Which Python Environment?

592
4
Jump to solution
02-14-2020 05:25 AM
JoeBorgione
MVP Emeritus

As many of us do, I used ArcGis Pro to clone the default python environment where I add various packages. Using conda, not the Pro package manager I added the pyodbc package to my clone (hereinafter referred to as clone1)  and the installation warned me that other packages would be down-graded in the process. Okay. I figured I would leave clone1 alone, so I went back to Pro and cloned the default to clone2. I happen to like spyder so I added it to clone2 and then  added pyodbc  accepting the down grades.  Cool.  Now I have 3 python environmments: the default, clone1 and clone2.  Clone1 remains the active clone in ArcGis Pro.

I added  a new desktop shortcut that fires clone2 spyder and started experimenting with pyodbc.  How does a stand alone script know which environment is the right one?  I never thought about this till now; my scripts written in clone1 spyder work just fine, ignoring the default, and I guess my scripts written in clone2 spyder will as well. Right?! 

Dan Patterson

That should just about do it....
0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

Spyder knows.  From Preferences, python interpreter... the selection defaults to .... Default (same as Spyders)

Which basically means that if you are using a shortcut or similar, then the same one will be used all the time

If you want to launch a different interpreter, you can create different shortcuts

/blogs/dan_patterson/2017/07/01/arcgis-pro-2-creating-desktop-shortcuts 

View solution in original post

4 Replies
DanPatterson_Retired
MVP Emeritus

Spyder knows.  From Preferences, python interpreter... the selection defaults to .... Default (same as Spyders)

Which basically means that if you are using a shortcut or similar, then the same one will be used all the time

If you want to launch a different interpreter, you can create different shortcuts

/blogs/dan_patterson/2017/07/01/arcgis-pro-2-creating-desktop-shortcuts 

JoeBorgione
MVP Emeritus

So... when standaloneScript.py written in my clone2 spyder executes  it follows:

Which is initially set in the shortcut I created as per your instructions:

where PythonClone = clone2.....

That should just about do it....
0 Kudos
DanPatterson_Retired
MVP Emeritus

That is the one.... python/spyder doesn't care about where the script is located... just the python executable

It is possible (but don't go there!!!) to set things to reduce the amount of things that need copying/cloning

Now you get the drift as to why I am a big proponent doing my install in the base environment... clones have their place where people have no control over their environment ... or are sheep or storm troopers

JoeBorgione
MVP Emeritus

Gotcha.  Thanks!

That should just about do it....
0 Kudos