arcpy load time suddenly long

4641
4
Jump to solution
03-09-2015 07:48 PM
ChipHankley1
New Contributor III

arcpy is taking a LONG time (30 seconds) to load.  Just a simple script like

import arcpy
x=5
print x * 5

...takes about 30 seconds before I see the output.  This appears to be the same for

  • 64 or 32 bit python
  • run via IDLE or run straight through the Python interpreter (e.g. double-clicking on the *.py file)

Of course if I comment out the "import arcpy" line, the script runs instantaneously.

This came on rather suddenly.  The only recent major change that I know of was installing 10.3, although I know that I have run scripts since then and they ran fine (no lag loading arcpy).

This is an (otherwise) smoking fast machine... 16 GB RAM, SSD, etc.  Windows 8.1, ArcGIS 10.3.

Any ideas on what to check???  TIA.

1 Solution

Accepted Solutions
SachinKanaujia
Occasional Contributor III

Do you have a single use license? Or else Can you try installing a 30 days evaluation version and use a local single use license and see how much time it takes?

View solution in original post

0 Kudos
4 Replies
SachinKanaujia
Occasional Contributor III

This is definitely taking way longer. Generally it should be anything between 5 to 10 secs. Can you do a quick check for the following?

1) Check .pth file to see if the paths are mapped correctly for ArcGIS 10.3

2) Check if you have issues initializing a product license. Do you have multiple products installed? Are you using floating license or single use license?

0 Kudos
ChipHankley1
New Contributor III

Thanks...

- All of the paths listed in the "Desktop10.3.pth" appear to be correct

- I am running a floating license. It's possible that this IS the

problem...it takes about 20 seconds for ArcMap to open, perhaps a few

seconds LESS than my script is taking to fire. This is a little hard to

judge because ArcMap always takes a little while to open.

0 Kudos
SachinKanaujia
Occasional Contributor III

Do you have a single use license? Or else Can you try installing a 30 days evaluation version and use a local single use license and see how much time it takes?

0 Kudos
ChipHankley1
New Contributor III

I'm marking this as the correct answer, although some explanation applies.  I think this has to do with network traffic to the license server.

Here's a more complete script for testing this:

import time
import sys
t_start = time.clock()
import arcpy
print "      ... complete in %s seconds." % (time.clock() - t_start)

Initially, this was taking about 38 seconds to run in IDLE.  After the resolution below, it takes about 8 seconds (still unacceptably long in my opinion).

In my case, I have a remote license server.  I initiate a VPN connection, which allows my machine to "see" the remote server.  I was using the format port@IP to point at my license server.  I changed this to simply point at the name of the server, and I added an entry in my hosts file to resolve the IP address of the host.

Furthering my suspicion that this has to do with a license server communication, I ran the above code in the Python window from within ArcMap and it runs immediately (way, way less than a second).

0 Kudos