<?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 Re: Python error 'No module named arcpy' in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306456#M23794</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ahh... so that explains why&lt;/P&gt;&lt;P&gt;print("PYTHONPATH: " + os.environ["PYTHONPATH"])&lt;/P&gt;&lt;P&gt;fails miserably on python 2.7.x on an iPad (Pythonista distribution) ... assuming that there is no equivalent for whatever iThingys run.&amp;nbsp; At least sys.path is informative ... sort of ... &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Dec 2015 05:44:53 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2015-12-30T05:44:53Z</dc:date>
    <item>
      <title>Python error 'No module named arcpy'</title>
      <link>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306448#M23786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey folks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;New to python but not coding; I'm running the Python tutorial, Python for everyone, and outright have an error I can't seem to find a solution to. Using Python 2.7.10 I tried running the sample script and immediately got the 'No module named arcpy' error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My path variables appear correct:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PYTHONPATH: C:\Python27\ArcGIS10.3\Lib\site-packages&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My Desktop 10.x pth file: &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;C:\Program Files (x86)\ArcGIS\Desktop10.3\bin
C:\Program Files (x86)\ArcGIS\Desktop10.3\arcPy
C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcToolBox\Scripts&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm running Win 0S 7 Pro SP1 64-bit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The example script: &lt;/STRONG&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy&amp;nbsp; # script fails here
#set workspace
arcpy.env.workspace = r"C:\Student\PythEveryone10_1\RunningScripts\Oregon_Polk.gdb"

#set up a describe object for each fc in gdb
fcList = arcpy.ListFeatureClasses()
for fc in fcList:
&amp;nbsp;&amp;nbsp;&amp;nbsp; desc = arcpy.Describe(fc)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print desc.spatialReference.name

print "Script completed"&amp;nbsp;&amp;nbsp; &lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking for any suggestions for troubleshooting. Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(&lt;A href="https://community.esri.com/migrated-users/3355" target="_blank"&gt;Curtis Price&lt;/A&gt;​ added formatting and put the import arcpy that is failing at the top)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:40:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306448#M23786</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T14:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Python error 'No module named arcpy'</title>
      <link>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306449#M23787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;import arcpy&amp;nbsp; # add as first line .... then you can use arcpy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Dec 2015 18:15:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306449#M23787</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-12-29T18:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: Python error 'No module named arcpy'</title>
      <link>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306450#M23788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;CODE style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif;"&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;from&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; arcpy &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b;"&gt;import&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; env&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;env.workspace = r"C:\Student\PythEveryone10_1\RunningScripts\Oregon_Polk.gdb"&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Dec 2015 18:19:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306450#M23788</guid>
      <dc:creator>MatthewBaber</dc:creator>
      <dc:date>2015-12-29T18:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: Python error 'No module named arcpy'</title>
      <link>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306451#M23789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dan/Matthew&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the response but I should note that the original script does include import arcpy and was missed in my poor copy/paste. Opening the script with 2.710 shell results in the error "No module named arcpy". Coincidentally, I downloaded pythonwin and tried to run the same script and of course because of different enviro variables it resulted in similar errors: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "C:\Users\twhitley\Downloads\Python27\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; exec codeObject in __main__.__dict__&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "C:\Student\PythEveryone10_1\RunningScripts\SpatialRef.py", line 2, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; import arcpy&lt;/P&gt;&lt;P&gt;ImportError: &lt;STRONG&gt;No module named arcpy&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Dec 2015 18:56:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306451#M23789</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2015-12-29T18:56:30Z</dc:date>
    </item>
    <item>
      <title>Re: Python error 'No module named arcpy'</title>
      <link>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306452#M23790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you run scripts within the python IDE inside of arcmap, then there is (apparently) no need to import arcpy.&amp;nbsp; I would not make this a habit.&amp;nbsp; I personally, use external IDEs such as PyScripter and PythonWin for all my scripting even when I have arcmap open.&amp;nbsp; Just a habit... because I often run different versions of python (ie 2.7.x and 3.4.x or 3.x.x etc) and I like different IDEs for different purposes and different reasons.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS&lt;/P&gt;&lt;P&gt;pythonwin should be installed in the c:\python27 folder.&amp;nbsp; This is the executable from which I create a desktop shortcut.&amp;nbsp; Check to see if you indeed have a pythonwin folder inside of correct folder&lt;/P&gt;&lt;P&gt;C:\Python27\ArcGIS10.3\Lib\site-packages\pythonwin\Pythonwin.exe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Dec 2015 19:06:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306452#M23790</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-12-29T19:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: Python error 'No module named arcpy'</title>
      <link>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306453#M23791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Dan, I'll work this through pythonwin and see what I can work out; much appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Dec 2015 19:14:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306453#M23791</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2015-12-29T19:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: Python error 'No module named arcpy'</title>
      <link>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306454#M23792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;just added an addendum...check my previous post so you can check your installation&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Dec 2015 19:15:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306454#M23792</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-12-29T19:15:24Z</dc:date>
    </item>
    <item>
      <title>Re: Python error 'No module named arcpy'</title>
      <link>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306455#M23793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are so many ways to launch Python, and often many versions of Python installed, that this can get tricky. Use these Python commands to verify your environment:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import sys
import os
&lt;SPAN style="font-size: 9pt;"&gt;print (sys.executable)&lt;/SPAN&gt;
print(sys.prefix)
print("PYTHONPATH: " + os.environ["PYTHONPATH"])
print("sys.path:")
print("\n".join(sys.path))
import arcpy&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The results from these print statements will give you more confidence that the right environment is set up to import arcpy.&lt;/P&gt;&lt;P&gt;My guess is your PYTHONPATH is not getting into the sys.path for some reason.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Windows env variable PYTHONPATH must be set before the shell that launches Python (or a parent process like ArcMap) is launched for the PYTHONPATH to be read. This may mean you need to log out and log in again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For best results instead of running the Python you installed to your Downloads folder (&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;C:\Users\twhitley\Downloads\Python27\ -- &lt;/SPAN&gt;not a great place to install software!) you should just uninstall that and use Esri's.&amp;nbsp; Then you know all the python libraries will be compatible with ArcGIS and arcpy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The command will below will launch the Python installed with ArcMap. If you are using PythonWin you should consider installing it there instead on another Python somewhere else on your computer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;C:\Python27\Desktop10.3\python.exe&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 14:40:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306455#M23793</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2021-12-11T14:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Python error 'No module named arcpy'</title>
      <link>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306456#M23794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ahh... so that explains why&lt;/P&gt;&lt;P&gt;print("PYTHONPATH: " + os.environ["PYTHONPATH"])&lt;/P&gt;&lt;P&gt;fails miserably on python 2.7.x on an iPad (Pythonista distribution) ... assuming that there is no equivalent for whatever iThingys run.&amp;nbsp; At least sys.path is informative ... sort of ... &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Dec 2015 05:44:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306456#M23794</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2015-12-30T05:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: Python error 'No module named arcpy'</title>
      <link>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306457#M23795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if PYTHONPATH env variable (not required to run Python) Is not set you will get a KeyError (os.environ is a dict of all os env variables). On my Mac this works:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;print("HOME: " + os.environ["HOME"])&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Dec 2015 06:17:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306457#M23795</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2015-12-30T06:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: Python error 'No module named arcpy'</title>
      <link>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306458#M23796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks all; coincidentally, Dan as you had sent me the info regarding ensuring Pythonwin was within the correct folder path it turns out I had a separate install of Python on this machine and was reading that path for installation for Pythonwin install. I ended up uninstalling everything and reinstalling and ensuring my paths and environments were correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Happy to say I'm now in code heaven. Although I was a bit confused at first why ESRI didn't include Pythonwin with the ArcMap installation. But further reading shows their thought process on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So thanks again all. I'm sure I'll have more Python related questions as I delve more.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Dec 2015 14:25:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306458#M23796</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2015-12-30T14:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: Python error 'No module named arcpy'</title>
      <link>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306459#M23797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anthony, don't forget to close out this thread by marking all those answers that were helpful, and marking the best solution (if one) as the answer.&amp;nbsp; This will help others in the future to find the solution.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Dec 2015 16:17:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-error-no-module-named-arcpy/m-p/306459#M23797</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2015-12-30T16:17:22Z</dc:date>
    </item>
  </channel>
</rss>

