AnsweredAssumed Answered

Problem importing arcpy in ArcMap console -- 64 bit DLL conflict

Question asked by washakie on Mar 5, 2013
Latest reply on Apr 4, 2014 by tlaxson
Hello,

Working on Windows 7 with ArcGIS 10.1 using the 64 bit geoprocessing python... I have been having problems with using python **inside** ArcMap. Outside of ArcMap, I can run the ArcGISx6410.1/python.exe without problems. Here is my WORKING case:

arcpython.bat which will launch 64 bit python and use 64 bit libraries/modules and wraps everything in Ipython.
@echo off set path=C:\Python27\ArcGISx6410.1;%path% set PYTHONPATH=C:\Python27\ArcGISx6410.1\Lib\site-packages\;C:\Python27\Lib\;C:\Python27\Lib\site-packages\;%pythonpath% C:\Python27\ArcGISx6410.1\python.exe -c "import sys; from IPython.frontend.terminal.ipapp import launch_new_instance; sys.exit(launch_new_instance())" %* exit /B %ERRORLEVEL%


With this, I get an Ipython window and all arcpy functionality with no errors.

However, when I launch the python console inside of ArcMap I get a traceback with the following ultimate error:
  File "C:\Python27\Lib\site-packages\numpy\lib\type_check.py", line 8, in <module>     import numpy.core.numeric as _nx   File "C:\Python27\Lib\site-packages\numpy\core\__init__.py", line 5, in <module>     import multiarray ImportError: DLL load failed: %1 is not a valid Win32 application. >>> 


So clearly, it's a problem with the 64 bit imports.

I have my PYTHONPATH set to point to my 64 bit libraries, and I've defined a pythonExePath to point to the ArcGISx6410.1/python.exe.

I'm stumped, because I don't understand how to control which python executable is called from **WITHIN** Arcmap. Output from the console only provides this:

>>> import sys >>> sys.executable  'C:\\Program Files (x86)\\ArcGIS\\Desktop10.1\\bin\\ArcMap.exe' >>> 


Please advise on how to instruct the console to use the ArcGISx6410.1/python.exe because that seems to be the problem...

Thanks,
john

Outcomes