<?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 environment in bash git shell in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-environment-in-bash-git-shell/m-p/1145029#M63798</link>
    <description>&lt;P&gt;I spend a lot of time writing arcpy Python scripts and executing them via the "Python Command Prompt" that gets installed with ArcGIS Pro, but I also spend a lot of time using the git bash shell for version control and other useful linux tools (e.g. sort, uniq, etc).&amp;nbsp; "Python Command Prompt" is just a windows cmd window that runs a bat file to set up the conda pro environment and I was wondering how I might get this environment configured so I can execute my arcpy scripts from with the git bash window.&amp;nbsp; Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Feb 2022 04:09:24 GMT</pubDate>
    <dc:creator>GaryB</dc:creator>
    <dc:date>2022-02-17T04:09:24Z</dc:date>
    <item>
      <title>python environment in bash git shell</title>
      <link>https://community.esri.com/t5/python-questions/python-environment-in-bash-git-shell/m-p/1145029#M63798</link>
      <description>&lt;P&gt;I spend a lot of time writing arcpy Python scripts and executing them via the "Python Command Prompt" that gets installed with ArcGIS Pro, but I also spend a lot of time using the git bash shell for version control and other useful linux tools (e.g. sort, uniq, etc).&amp;nbsp; "Python Command Prompt" is just a windows cmd window that runs a bat file to set up the conda pro environment and I was wondering how I might get this environment configured so I can execute my arcpy scripts from with the git bash window.&amp;nbsp; Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Feb 2022 04:09:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-environment-in-bash-git-shell/m-p/1145029#M63798</guid>
      <dc:creator>GaryB</dc:creator>
      <dc:date>2022-02-17T04:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: python environment in bash git shell</title>
      <link>https://community.esri.com/t5/python-questions/python-environment-in-bash-git-shell/m-p/1145703#M63819</link>
      <description>&lt;P&gt;Hi Gary,&lt;/P&gt;&lt;P&gt;One way that I use is to define an alias in ".bashrc" file for python3 interpreter. If you have a clone python environment point the alias to that python env.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;alias python3='C:/Users/asharaf/AppData/Local/ESRI/conda/envs/arcgispro-py3-clone/python.exe'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;and then in bash use python3 command.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AzinSharaf_0-1645206468458.png" style="width: 705px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/34358iAFFA5F20B5AE4CC7/image-dimensions/705x108?v=v2" width="705" height="108" role="button" title="AzinSharaf_0-1645206468458.png" alt="AzinSharaf_0-1645206468458.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Let me know if it works in your environment.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 17:49:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-environment-in-bash-git-shell/m-p/1145703#M63819</guid>
      <dc:creator>AzinSharaf</dc:creator>
      <dc:date>2022-02-18T17:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: python environment in bash git shell</title>
      <link>https://community.esri.com/t5/python-questions/python-environment-in-bash-git-shell/m-p/1145710#M63820</link>
      <description>&lt;P&gt;The downside to this is that the conda environment is not getting activated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assuming you are in Windows and Pro is installed in the default location, you can use Pro's propy.bat file from a Git Bash window to call a script. That will activate Pro's conda environment and use its python.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;"C:\Program Files\ArcGIS\Pro\bin\Python\Scripts\propy.bat" scriptname.py&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 18:00:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-environment-in-bash-git-shell/m-p/1145710#M63820</guid>
      <dc:creator>JoshKalovGIS</dc:creator>
      <dc:date>2022-02-18T18:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: python environment in bash git shell</title>
      <link>https://community.esri.com/t5/python-questions/python-environment-in-bash-git-shell/m-p/1145718#M63821</link>
      <description>&lt;P&gt;yes &lt;EM&gt;propy.bat&lt;/EM&gt; works as well. Forgot to mention that I have activated my clone env and then use the alias in bash.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Feb 2022 18:04:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-environment-in-bash-git-shell/m-p/1145718#M63821</guid>
      <dc:creator>AzinSharaf</dc:creator>
      <dc:date>2022-02-18T18:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: python environment in bash git shell</title>
      <link>https://community.esri.com/t5/python-questions/python-environment-in-bash-git-shell/m-p/1148292#M63881</link>
      <description>&lt;P&gt;I tried this and it worked, but then I realized that you don't get any output until the script finishes.&amp;nbsp; So my script that takes a minute to run and reports what it's doing every few seconds (something that gives me confidence that things are going well and it's not stuck anywhere) now just dumps all the output at the end.&amp;nbsp; This is not really a workable solution.&amp;nbsp; I would really love to stick to the git bash shell and dump the dos cmd shell forever but it still seems like that might not be possible.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Feb 2022 23:36:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-environment-in-bash-git-shell/m-p/1148292#M63881</guid>
      <dc:creator>GaryB</dc:creator>
      <dc:date>2022-02-26T23:36:44Z</dc:date>
    </item>
    <item>
      <title>Re: python environment in bash git shell</title>
      <link>https://community.esri.com/t5/python-questions/python-environment-in-bash-git-shell/m-p/1148294#M63882</link>
      <description>&lt;P&gt;Have you used print or addmessage for the status report?&amp;nbsp; I can run the a simple script (see below) in Git Bash and it works fine.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried it with the both methods: 1) the one i always use (python3 alias) and 2) the one that Josh suggested. (using propy.bat file) and both works as expected.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AzinSharaf_0-1645921408325.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/35058i2A2CE0B820B00BED/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AzinSharaf_0-1645921408325.png" alt="AzinSharaf_0-1645921408325.png" /&gt;&lt;/span&gt;&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>Sun, 27 Feb 2022 00:24:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-environment-in-bash-git-shell/m-p/1148294#M63882</guid>
      <dc:creator>AzinSharaf</dc:creator>
      <dc:date>2022-02-27T00:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: python environment in bash git shell</title>
      <link>https://community.esri.com/t5/python-questions/python-environment-in-bash-git-shell/m-p/1148297#M63883</link>
      <description>&lt;P&gt;What if you sleep for a few seconds after your two statements that ouput text, do you see the messages before the sleep or after?&lt;/P&gt;</description>
      <pubDate>Sun, 27 Feb 2022 00:51:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-environment-in-bash-git-shell/m-p/1148297#M63883</guid>
      <dc:creator>GaryB</dc:creator>
      <dc:date>2022-02-27T00:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: python environment in bash git shell</title>
      <link>https://community.esri.com/t5/python-questions/python-environment-in-bash-git-shell/m-p/1148298#M63884</link>
      <description>&lt;P&gt;yes it pauses after two print statements and then script ends.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
import time

print(f"using print function...")
arcpy.AddMessage("using arcpy.add.message ...")

time.sleep(5)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Feb 2022 01:05:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-environment-in-bash-git-shell/m-p/1148298#M63884</guid>
      <dc:creator>AzinSharaf</dc:creator>
      <dc:date>2022-02-27T01:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: python environment in bash git shell</title>
      <link>https://community.esri.com/t5/python-questions/python-environment-in-bash-git-shell/m-p/1148299#M63885</link>
      <description>&lt;P&gt;my "arcpy.addmessage" statements are printed immediately but any and all simple print statements don't come out until the script ends (i.e. after the sleep statement)&lt;/P&gt;</description>
      <pubDate>Sun, 27 Feb 2022 01:19:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-environment-in-bash-git-shell/m-p/1148299#M63885</guid>
      <dc:creator>GaryB</dc:creator>
      <dc:date>2022-02-27T01:19:18Z</dc:date>
    </item>
  </channel>
</rss>

