JamesRamm / archook

Searches the system for arcgis and makes arcpy available to python (regardless of pythonpath/system path/registry settings)
GNU General Public License v2.0
81 stars 28 forks source link

Tries to use 64 bit DLLs when using Python 32-bit #7

Closed geographika closed 7 years ago

geographika commented 7 years ago

To recreate, run the following when C:\Program Files (x86)\ArcGIS\Desktop10.4\bin64 is also on the machine:

cd C:\Python27\ArcGIS410.4\Scripts
pip install virtualenv
virtualenv.exe C:\VirtualEnvs\arcpytest
C:\VirtualEnvs\arcpytest\Scripts\activate.bat
pip install archook
pip install numpy
python

import archook
archook.get_arcpy()
import arcpy

Results in:

>>> import arcpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files (x86)\ArcGIS\Desktop10.4\arcpy\arcpy\__init__.py", line
 22, in <module>
    from arcpy.geoprocessing import gp
  File "C:\Program Files (x86)\ArcGIS\Desktop10.4\arcpy\arcpy\geoprocessing\__in
it__.py", line 14, in <module>
    from _base import *
  File "C:\Program Files (x86)\ArcGIS\Desktop10.4\arcpy\arcpy\geoprocessing\_bas
e.py", line 14, in <module>
    import arcgisscripting
ImportError: DLL load failed: %1 is not a valid Win32 application.
JamesRamm commented 7 years ago

Thanks for raising this! Closed by #6

geographika commented 7 years ago

@JamesRamm - thanks for the project!

I posted my current approach to handling this on your question at http://gis.stackexchange.com/a/234417/186

Quick question - I presume numpy (at a minimum) is installed separately in the alternative environment? Otherwise there are import errors. I can add this to the docs, or look at optionally including all arcpy Python dependencies (I've hit missing dateutil before with arcpy in a venv).

JamesRamm commented 7 years ago

@geographika Yes; archook only adds the arcpy libraries to the current python environment (it does nothing with other libraries in the python env installed by arcgis). Therefore the user must have the correct version of numpy in their python environment (I think the official requirement for arcpy is some versions behind the current numpy release). Documenting numpy as a requirement could be useful. I wasnt aware that arcpy is dependent on dateutil - I dont think Ive seen it documented it anywhere?