<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Python Command Prompt not changing environments correctly in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/python-command-prompt-not-changing-environments/m-p/1118430#M48003</link>
    <description>&lt;P&gt;Greetings All,&lt;/P&gt;&lt;P&gt;I just updated to ArcGIS Pro 2.9, and the following happens in the Python Command Prompt (also see copy/paste from the Python Command Prompt Terminal):&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I start out in default environment. If I launch python, it starts as expected, no problem so far.&lt;/LI&gt;&lt;LI&gt;I activate another environment with packages I normally use. Activation appears to happen without issue, but when I launch python, I get the warning &lt;FONT face="terminal,monaco"&gt;This Python interpreter is in a conda environment, but the environment has&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="terminal,monaco"&gt;not been activated. Libraries may fail to load. To activate this environment&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="terminal,monaco"&gt;please see &lt;A href="https://conda.io/activation" target="_blank"&gt;https://conda.io/activation&lt;/A&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT face="helvetica"&gt;With this instance of python running, if I try importing a package that's in my custom environment (in the example below the package is dbfread), it says the package does not exist.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT face="terminal,monaco"&gt;&lt;FONT face="helvetica"&gt;However, a workaround is to run cd Scripts in the cmd prompt to go one folder deeper from&lt;/FONT&gt; ~\Python\envs\arcgispro-py3 &lt;FONT face="helvetica"&gt;to&lt;/FONT&gt; ~\Python\envs\arcgispro-py3\&lt;STRONG&gt;Scripts. &lt;/STRONG&gt;&lt;FONT face="helvetica"&gt;If I do this and launch python, the warning disappears and I can import packages unique to the environment.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;FONT face="helvetica"&gt;All in all, this is a minor inconvenience, i.e., all I have to do is enter cd Scripts before changing environments, but I want to raise it as a quality issue as it should not be necessary.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica"&gt;Lastly, in case you're asking why I don't just use the GUI environment manager, I find the command interface to be less buggy and more transparent (e.g., I can see how things are progressing rather than worrying that something has frozen).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Everything I described is in command line excerpt below. Also, this problem existed with the last version of Pro as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;(arcgispro-py3) C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3&amp;gt;python
Python 3.7.11 [MSC v.1927 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
&amp;gt;&amp;gt;&amp;gt; quit()

(arcgispro-py3) C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3&amp;gt;activate arcgispro-nov042021

(arcgispro-nov042021) C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3&amp;gt;python
Python 3.7.11 [MSC v.1927 64 bit (AMD64)] :: Anaconda, Inc. on win32

Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated.  Libraries may fail to load.  To activate this environment
please see https://conda.io/activation

Type "help", "copyright", "credits" or "license" for more information.
&amp;gt;&amp;gt;&amp;gt; import dbfread
Traceback (most recent call last):
  File "&amp;lt;stdin&amp;gt;", line 1, in &amp;lt;module&amp;gt;
ModuleNotFoundError: No module named 'dbfread'
&amp;gt;&amp;gt;&amp;gt; quit()

(arcgispro-nov042021) C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3&amp;gt;cd scripts

(arcgispro-nov042021) C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Scripts&amp;gt;activate arcgispro-nov042021

(arcgispro-nov042021) C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Scripts&amp;gt;python
Python 3.7.10 [MSC v.1927 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
&amp;gt;&amp;gt;&amp;gt; import dbfread
&amp;gt;&amp;gt;&amp;gt; quit()

(arcgispro-nov042021) C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Scripts&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Nov 2021 22:17:53 GMT</pubDate>
    <dc:creator>DarrenConly</dc:creator>
    <dc:date>2021-11-18T22:17:53Z</dc:date>
    <item>
      <title>Python Command Prompt not changing environments correctly</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-command-prompt-not-changing-environments/m-p/1118430#M48003</link>
      <description>&lt;P&gt;Greetings All,&lt;/P&gt;&lt;P&gt;I just updated to ArcGIS Pro 2.9, and the following happens in the Python Command Prompt (also see copy/paste from the Python Command Prompt Terminal):&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;I start out in default environment. If I launch python, it starts as expected, no problem so far.&lt;/LI&gt;&lt;LI&gt;I activate another environment with packages I normally use. Activation appears to happen without issue, but when I launch python, I get the warning &lt;FONT face="terminal,monaco"&gt;This Python interpreter is in a conda environment, but the environment has&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="terminal,monaco"&gt;not been activated. Libraries may fail to load. To activate this environment&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="terminal,monaco"&gt;please see &lt;A href="https://conda.io/activation" target="_blank"&gt;https://conda.io/activation&lt;/A&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT face="helvetica"&gt;With this instance of python running, if I try importing a package that's in my custom environment (in the example below the package is dbfread), it says the package does not exist.&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT face="terminal,monaco"&gt;&lt;FONT face="helvetica"&gt;However, a workaround is to run cd Scripts in the cmd prompt to go one folder deeper from&lt;/FONT&gt; ~\Python\envs\arcgispro-py3 &lt;FONT face="helvetica"&gt;to&lt;/FONT&gt; ~\Python\envs\arcgispro-py3\&lt;STRONG&gt;Scripts. &lt;/STRONG&gt;&lt;FONT face="helvetica"&gt;If I do this and launch python, the warning disappears and I can import packages unique to the environment.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;FONT face="helvetica"&gt;All in all, this is a minor inconvenience, i.e., all I have to do is enter cd Scripts before changing environments, but I want to raise it as a quality issue as it should not be necessary.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="helvetica"&gt;Lastly, in case you're asking why I don't just use the GUI environment manager, I find the command interface to be less buggy and more transparent (e.g., I can see how things are progressing rather than worrying that something has frozen).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Everything I described is in command line excerpt below. Also, this problem existed with the last version of Pro as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;(arcgispro-py3) C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3&amp;gt;python
Python 3.7.11 [MSC v.1927 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
&amp;gt;&amp;gt;&amp;gt; quit()

(arcgispro-py3) C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3&amp;gt;activate arcgispro-nov042021

(arcgispro-nov042021) C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3&amp;gt;python
Python 3.7.11 [MSC v.1927 64 bit (AMD64)] :: Anaconda, Inc. on win32

Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated.  Libraries may fail to load.  To activate this environment
please see https://conda.io/activation

Type "help", "copyright", "credits" or "license" for more information.
&amp;gt;&amp;gt;&amp;gt; import dbfread
Traceback (most recent call last):
  File "&amp;lt;stdin&amp;gt;", line 1, in &amp;lt;module&amp;gt;
ModuleNotFoundError: No module named 'dbfread'
&amp;gt;&amp;gt;&amp;gt; quit()

(arcgispro-nov042021) C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3&amp;gt;cd scripts

(arcgispro-nov042021) C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Scripts&amp;gt;activate arcgispro-nov042021

(arcgispro-nov042021) C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Scripts&amp;gt;python
Python 3.7.10 [MSC v.1927 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
&amp;gt;&amp;gt;&amp;gt; import dbfread
&amp;gt;&amp;gt;&amp;gt; quit()

(arcgispro-nov042021) C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Scripts&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Nov 2021 22:17:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-command-prompt-not-changing-environments/m-p/1118430#M48003</guid>
      <dc:creator>DarrenConly</dc:creator>
      <dc:date>2021-11-18T22:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: Python Command Prompt not changing environments correctly</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-command-prompt-not-changing-environments/m-p/1118513#M48013</link>
      <description>&lt;P&gt;I don't use clones, but I am wondering if proswap.bat is worth a try.&amp;nbsp; If memory serves its useage is.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt;&amp;nbsp;proswap arcgispro-nov042021&lt;/P&gt;&lt;P&gt;it is one of the scripts in the folder&amp;nbsp;&lt;/P&gt;&lt;P&gt;C:\....YourInstallFolder....\bin\Python\Scripts&lt;/P&gt;&lt;P&gt;which contains activate.bat, conda.exe, conda_env.exe, proenv.bat and propy.bat&lt;/P&gt;</description>
      <pubDate>Fri, 19 Nov 2021 02:07:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-command-prompt-not-changing-environments/m-p/1118513#M48013</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-11-19T02:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: Python Command Prompt not changing environments correctly</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-command-prompt-not-changing-environments/m-p/1118690#M48033</link>
      <description>&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for following up. Using "proswap" instead of "activate" did the trick!&lt;/P&gt;&lt;P&gt;Quick question though: If you don't use clones, do you just edit the default env as an administrator?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Nov 2021 15:40:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-command-prompt-not-changing-environments/m-p/1118690#M48033</guid>
      <dc:creator>DarrenConly</dc:creator>
      <dc:date>2021-11-19T15:40:42Z</dc:date>
    </item>
    <item>
      <title>Re: Python Command Prompt not changing environments correctly</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-command-prompt-not-changing-environments/m-p/1118800#M48045</link>
      <description>&lt;P&gt;yes, I have full rights and I am not adverse to reinstalling if need be,&amp;nbsp; I have a number of blog posts in my current and previous incarnation about installing spyder and other packages in the main environment.&lt;/P&gt;&lt;P&gt;But!!! don't install "stuff" unless you feel comfortable with conda and know how to rollback to a previous state (amongst other things)&lt;/P&gt;</description>
      <pubDate>Fri, 19 Nov 2021 18:33:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-command-prompt-not-changing-environments/m-p/1118800#M48045</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-11-19T18:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: Python Command Prompt not changing environments correctly</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-command-prompt-not-changing-environments/m-p/1137151#M50554</link>
      <description>&lt;P&gt;Dan gave the correct answer, &lt;FONT face="courier new,courier"&gt;proswap &amp;lt;env&amp;gt;&lt;/FONT&gt; is the preferred way to activate environments for Pro from the command prompt, it simplifies stuff like the problem you ran into. I just wanted to explain why you were getting the warning in the first place.&lt;BR /&gt;&lt;BR /&gt;Notice that on line 8 (in OP) after you've called &lt;FONT face="courier new,courier"&gt;activate&amp;nbsp;arcgispro-nov042021&lt;/FONT&gt;&amp;nbsp;your directory is still pointing to the&amp;nbsp;&lt;FONT face="courier new,courier"&gt;arcgispro-py3&lt;/FONT&gt; environment. So while you've activated &lt;FONT face="courier new,courier"&gt;arcgispro-nov042021&lt;/FONT&gt;&amp;nbsp;you're still running&amp;nbsp;&lt;EM&gt;Python.exe&lt;/EM&gt; from &lt;FONT face="courier new,courier"&gt;arcgispro-py3&lt;/FONT&gt;, leading&amp;nbsp;to the problems you described. Once you switched out of the directory with &lt;EM&gt;cd&lt;/EM&gt; you were no longer using the wrong &lt;EM&gt;Python.exe&lt;/EM&gt;&amp;nbsp;(no &lt;EM&gt;Python.exe&lt;/EM&gt; in that folder) so your problems went away.&lt;/P&gt;&lt;P&gt;The reason for that is the &lt;A href="https://docs.microsoft.com/en-us/previous-versions//cc723564(v=technet.10)#command-search-sequence" target="_self"&gt;Command Search Sequence&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;If you're ever in doubt, you can run &lt;FONT face="courier new,courier"&gt;sys.prefix&lt;/FONT&gt; to see where your &lt;FONT face="courier new,courier"&gt;Python.exe&lt;/FONT&gt; is called from in your session.&lt;/P&gt;&lt;P&gt;Try this to see it:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;(arcgispro-py3) C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3&amp;gt;activate arcgispro-nov042021

(arcgispro-nov042021) C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3&amp;gt;python
Python 3.7.11 [MSC v.1927 64 bit (AMD64)] :: Anaconda, Inc. on win32

Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated.  Libraries may fail to load.  To activate this environment
please see https://conda.io/activation

Type "help", "copyright", "credits" or "license" for more information.
&amp;gt;&amp;gt;&amp;gt; import sys
&amp;gt;&amp;gt;&amp;gt; sys.prefix
'C:\\Program Files\\ArcGIS\\Pro\\bin\\Python\\envs\\arcgispro-py3'
&amp;gt;&amp;gt;&amp;gt; sys.exit()

(arcgispro-nov042021) C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3&amp;gt; cd ..

(arcgispro-nov042021) C:\Program Files\ArcGIS\Pro\bin\Python\envs&amp;gt; python
Python 3.7.11 [MSC v.1927 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
&amp;gt;&amp;gt;&amp;gt; import sys
&amp;gt;&amp;gt;&amp;gt; sys.prefix
'C:\\&amp;lt;whatever_the_path_to_your_environment_is&amp;gt;\\arcgispro-nov042021
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2022 22:11:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-command-prompt-not-changing-environments/m-p/1137151#M50554</guid>
      <dc:creator>HannesZiegler</dc:creator>
      <dc:date>2022-01-25T22:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: Python Command Prompt not changing environments correctly</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-command-prompt-not-changing-environments/m-p/1183901#M56303</link>
      <description>&lt;P&gt;Thanks for this response. I have a somewhat similar issue that I could not solve entirely by this suggestion. I was earlier using a cloned ArcGIS Pro environment to run Spyder but then my user license changed from a university license to an individual one and I am back to a default project environment under the Python Package Manager. But still, when I open the python command prompt from the windows start menu it opens pointing to the cloned environment (which no longer exists). I tried running what you suggested above but reopening the python command prompt still points to the cloned environment by default. Here is a screenshot&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RupinderKBakhshi_0-1655474850281.png" style="width: 714px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/43708i3D596B26C25141C3/image-dimensions/714x450?v=v2" width="714" height="450" role="button" title="RupinderKBakhshi_0-1655474850281.png" alt="RupinderKBakhshi_0-1655474850281.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;How can I start fresh with the new default environment? Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2022 14:10:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-command-prompt-not-changing-environments/m-p/1183901#M56303</guid>
      <dc:creator>RupinderKBakhshi</dc:creator>
      <dc:date>2022-06-17T14:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: Python Command Prompt not changing environments correctly</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/python-command-prompt-not-changing-environments/m-p/1183915#M56305</link>
      <description>&lt;P&gt;So from my understanding, %localappdata%\esri\conda\envs\arcgispro-py3-clone is now an empty folder? In the screenshot, you're using activate. Using activate will switch the Windows environment path variable to point to arcgispro-py3, but it won't switch the current directory in your CMD out of arcgispro-py3-clone, so arcgispro-py3 wasn't used until you backed out (cd ..) of arcgispro-py3-clone due to the&amp;nbsp;&lt;A href="https://docs.microsoft.com/en-us/previous-versions//cc723564(v=technet.10)#command-search-sequence" target="_self" rel="nofollow noopener noreferrer"&gt;Command Search Sequence&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;reopening the python command prompt still points to the cloned environment by default&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The Python Command Prompt will open in the environment currently active in ArcGIS Pro (this is backed by a registry key), so you've probably not activated another environment for Pro. Using activate won't affect the environment that Pro (and therefore the Python Command Prompt) is set to.&lt;/P&gt;&lt;P&gt;Can you open ArcGIS Pro and see what the active environment there is? If it is still arcgispro-py3-clone, try to either switch the active environment to arcgispro-py3 from the Package Manager or use proswap instead of activate from the CMD, like this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;proswap arcgispro-py3&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If there are no other problems with your environments, the Python Command Prompt (and Pro) should now open with arcgispro-py3 as the active environment.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2022 14:56:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/python-command-prompt-not-changing-environments/m-p/1183915#M56305</guid>
      <dc:creator>HannesZiegler</dc:creator>
      <dc:date>2022-06-17T14:56:30Z</dc:date>
    </item>
  </channel>
</rss>

