6

I use a lot of scripts as GP Service almost all use the arcpy functions but one (and very important) of my scripts needs a gdal/ogr and numpy imports. I can run this script in PyScripter or as a tool in Toolbox in ArcMap. Now, I am trying to publish my script from GP Result window as GP Service on ArcGIS Server 10.1. This is weird because I can see only Packaging in progress window a long time and after 30 minutes I must kill the Service Editor. I tested my script by commenting it line by line and publishing each time as a GP service. I have already found the reason of my problems but still I do not have solution. The publishing problems appear when I use import of numpy in my script (import numpy as np or import numpy). Does anyone know the reason of this state? Numpy is very important library so I think the solution should exists.


I have tested my simple script

import arcpy
from arcpy import env

from osgeo import gdal
from osgeo import ogr
from osgeo.gdalconst import *
import numpy as np

arcpy.AddMessage("End")
print("End")

It runs in ArcGIS for Desktop but I can not publish service. I always get window Packing in progress

enter image description here

When I comment out import as np I can publish service successfully.

  • 2
    Give a quick read of this topic: resources.arcgis.com/en/help/main/10.2/#/… If it takes forever to publish its either a) stuck in a bad loop, or more likely b) trying to copy/consolidate a larger amount of data over. From the above link, make sure you dont have pointers at folders with a lot of data inside (unless you need that) – KHibma Oct 22 '13 at 16:46
  • I'm guessing its a typo in the question, but shouldn't "import Numpy" be "import numpy" lowercase? – bcollins Oct 22 '13 at 17:51
  • I am sorry for distracting typo, I use numpy in my script. – ConeGIS Oct 23 '13 at 8:35
  • One more quick test: Goto Customize >ArcMap Options > Sharing Tab. Note the "Staging Path". When in seems stuck, go there, find the folder its generating and look inside. Is there a lot of content being copied in? And do you have 10.1 sp1 installed? – KHibma Oct 23 '13 at 13:55
  • 1
    Strange thing happened. When I have changed the method of importing inside my script from import numpy to from numpy import * I published my service successfully. Any idea why? – ConeGIS Oct 23 '13 at 13:59
3

The asker (@ConeGIS) has indicated in a Comment that this went away when:

  import numpy

was replaced by:

  from numpy import *
2

Can you check and make sure that the 64bit version of numpy is also installed on the server machine. I believe that 10.1 Desktop uses 32bit Python and Server uses 64bit. If numpy isn't install on 64bit that could be the issue.

  • 1
    Not really related, it's hanging in the packaging stage. Also, if you have correctly installed any 64 bit ArcGIS product it will already include the 64 bit numpy. – Jason Scheirer Oct 22 '13 at 18:33
  • good point, possibly a later issue with ogr/gdal but not during the packaging phase. – bcollins Oct 22 '13 at 21:19
  • On my server machine I have got numpy forArcGIS for Desktop (C:\Python27\ArcGIS10.1\Lib\site-packages) and server (C:\Python27\ArcGISx6410.1\Lib\site-packages\numpy) – ConeGIS Oct 23 '13 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.