# ARCPY development standalone script

I am trying to follow this llink to work ARCPY in standalone script.

I define ARCGIS paths in paths from windows environment variables system :

C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy
C:\Program Files (x86)\ArcGIS\Desktop10.1\bin
C:\Program Files (x86)\ArcGIS\Desktop10.1\ArcToolbox\Scripts


and PYTHONPATH=C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy

if i run :

import sys
print sys.path


i take that paths

['', 'C:\\Python27\\Lib\\idlelib', 'C:\\Python27\\lib\\site-packages\\django_leaflet-0.18.1-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\radical.utils-0.41.1-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\apache_libcloud-1.0.0-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\colorama-0.3.7-py2.7.egg', 'C:\\Python27\\lib\\site-packages\\traits-4.5.0-py2.7-win32.egg', 'C:\\Python27\\lib\\site-packages\\rasterstats-0.12a1-py2.7.egg', 'C:\\Program Files (x86)\\ArcGIS\\Desktop10.1\\arcpy', 'C:\\WINDOWS\\SYSTEM32\\python27.zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Python27\\lib\\site-packages', 'C:\\Python27\\lib\\site-packages\\wx-3.0-msw']


but then importing arcpy package i take that error message :

import arcpy

Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import arcpy
File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\__init__.py", line 21, in <module>
from arcpy.geoprocessing import gp
File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\geoprocessing\__init__.py", line 14, in <module>
from _base import *
File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\geoprocessing\_base.py", line 14, in <module>
import arcgisscripting
ImportError: No module named arcgisscripting


any idea how to fix that ?

i use windows 10 64 bit

python 2.7 32 bit

ARCGIS 10.1

• Do you have this file on your system, if so, whats in it? "C:\Python27\ArcGIS10.3\Lib\site-packages\Desktop10.1.pth" – KHibma Dec 6 '16 at 20:12
• sorry i update my ask wrong copy-paste – Mar Dec 6 '16 at 20:14
• I see your edit. But do those paths live within the PTH file I referenced, or are you manually adding them to the path? – KHibma Dec 6 '16 at 20:16
• i define this paths in windows environment variables. – Mar Dec 6 '16 at 20:17

Based on the comments on the question, I'll offer the "sure to work answer" for this situation:

• remove arcgis
• forget manually setting variables (actually, undo these variables)
• re-install arcgis

You do not need to add to the windows path to import arcpy. At this point something on your system is either pointing at the wrong thing, or not pointing at something it should be. (The research you've done is probably sending you down the right path, but theres no guarantees you'll find a solution)

This answer might seem heavy handed, but honestly in the time to continue to research and experiment with the right combination of settings, you could clean up and re-install and have it working. (Of course if someone can offer a solution that gets you working faster than this, you should accept that)

More explanation:

When you install arcgis, it installs Python (assuming you do not have Python and all the required libaries already installed.) During the install a PTH file (C:\Python27\ArcGIS10.3\Lib\site-packages\Desktop10.1.pth) gets laid down. Inside this file are the paths you've already referenced:

C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy
C:\Program Files (x86)\ArcGIS\Desktop10.1\bin
C:\Program Files (x86)\ArcGIS\Desktop10.1\ArcToolbox\Scripts


When you call Python from command prompt prompt, that PTH inside the site-packages handles the paths for you. Thus when you import arcpy, it all just works. My system (note all the packages installed and the 3 line items from the PTH at the end of the paths):

C:\Python27\ArcGIS10.3>python
Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
>>> import sys
>>> sys.path
['', 'C:\\Python27\\ArcGIS10.3\\lib\\site-packages\\distribute-0.6.8-py2.7.egg', 'C:\\Python27\\ArcG
IS10.3\\lib\\site-packages\\sample_gp_tools-0.0.1-py2.7.egg', 'C:\\Python27\\ArcGIS10.3\\lib\\site-p
ackages\\legofy-0.0.1-py2.7.egg', 'C:\\Python27\\ArcGIS10.3\\lib\\site-packages\\click-5.1-py2.7.egg
', 'C:\\Python27\\ArcGIS10.3\\lib\\site-packages\\pillow-3.0.0-py2.7-win32.egg', 'C:\\Python27\\ArcG
b\\site-packages\\uritemplate-0.6-py2.7.egg', 'C:\\Python27\\ArcGIS10.3\\lib\\site-packages\\six-1.1
0.0-py2.7.egg', 'C:\\Python27\\ArcGIS10.3\\lib\\site-packages\\oauth2client-1.5.2-py2.7.egg', 'C:\\P
ython27\\ArcGIS10.3\\lib\\site-packages\\httplib2-0.9.2-py2.7.egg', 'C:\\Python27\\ArcGIS10.3\\lib\\
site-packages\\simplejson-3.8.1-py2.7-win32.egg', 'C:\\Python27\\ArcGIS10.3\\lib\\site-packages\\rsa
-3.2.3-py2.7.egg', 'C:\\Python27\\ArcGIS10.3\\lib\\site-packages\\pyasn1_modules-0.0.8-py2.7.egg', '
C:\\Python27\\ArcGIS10.3\\lib\\site-packages\\pyasn1-0.1.9-py2.7.egg', 'C:\\Python27\\ArcGIS10.3\\li
ests-2.10.0-py2.7.egg', 'C:\\Python27\\ArcGIS10.3\\lib\\site-packages\\lxml-3.6.0-py2.7-win32.egg',
'c:\\qatest\\py\\pyharness', 'C:\\windows\\system32\\python27.zip', 'C:\\Python27\\ArcGIS10.3\\DLLs'
, 'C:\\Python27\\ArcGIS10.3\\lib', 'C:\\Python27\\ArcGIS10.3\\lib\\plat-win', 'C:\\Python27\\ArcGIS1
0.3\\lib\\lib-tk', 'C:\\Python27\\ArcGIS10.3', 'C:\\Python27\\ArcGIS10.3\\lib\\site-packages', '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']
>>> import os
>>> os.getenv('PYTHONPATH')
'c:\\qatest\\py\\pyharness'
>>> import arcpy
>>>


And to prove I'm not using PYTHONPATH.... that is a directory on my system that we have custom modules that specifically looks for this variable/drive location. It has nothing to do with allowing arcpy at stand alone.

• not need paths to work arcpy in STANDALONE python script outside ARCGIS ?seriously? – Mar Dec 6 '16 at 20:28
• for serious. I added more info. – KHibma Dec 6 '16 at 20:36
• thnx you so much @KHibma problem fixed i create a Desktop10.1.pth with the paths and work,can i work and other editor like pycharm ? – Mar Dec 6 '16 at 20:48
• Please mark solution as solved if it worked for you – FelixIP Dec 6 '16 at 21:51
• @Mar adding [SOLVED] to your question title doesn't mark your question as solved. Instead, you need to accept KHibma's answer. If you don't know how, see gis.stackexchange.com/help/someone-answers. – user2856 Dec 6 '16 at 23:53