[GIS] Python/arcpy 32 bit and 64 bit problems

arcpypython

I have a 32 bit and 64 bit python installs, both 2.7 with arcpy

Paths to python.exe

32 bit path = C:\Python27\ArcGIS10.4
64 bit path = C:\Python27\ArcGISx6410.4

now in my environmental variables:

for my "user variable for user" top tab

variable name = PYTHONPATH
variable value = C:\Python27\ArcGISx6410.4;C:\Python27\ArcGIS10.4

and in the system variables I have added the exact same variable name and variable values

PROBLEM

The very import package arcpy only successfully imports and works in the 64 bit version but does not work when I try and import arcpy with the 32 bit version. it gives me this error with the 32 bit

Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
  File "C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\__init__.py", line 20, in <module>
    import numpy
  File "C:\Python27\ArcGIS10.4\lib\site-packages\numpy\__init__.py", line 142, in <module>
    from . import add_newdocs
  File "C:\Python27\ArcGIS10.4\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "C:\Python27\ArcGIS10.4\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
    from .type_check import *
  File "C:\Python27\ArcGIS10.4\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "C:\Python27\ArcGIS10.4\lib\site-packages\numpy\core\__init__.py", line 21, in <module>
    from . import function_base
  File "C:\Python27\ArcGIS10.4\lib\site-packages\numpy\core\function_base.py", line 7, in <module>
    from .numeric import (result_type, NaN, shares_memory, MAY_SHARE_BOUNDS,
ImportError: cannot import name shares_memory 

BUT here is what is even stranger. when i cmd over to the 64 bit install of python and try and install a library with pip, it installs it in the 32 bit directory!!!

C:\Python27\ArcGISx6410.4\Scripts>pip install pypdf2

this ends up in the 32 bit directory and not the 64 bit. I cannot import pypdf2 with the 64 bit.

So in essence I can use arcpy with 64 bit but no other modules, and I cannot use arcpy with the 32 bit but can use all the modules that are installed via pip.

I am not sure what to do here.I dont know how to properly set the env variables for my python path(i have tried just having the 32 bit alone and 64 bit python variable paths alone but the same problem exists).

when I run import os; print repr(os.environ).replace(',', '\n')

32 bit:

{'TMP': 'C:\\Users\\rizagha\\AppData\\Local\\Temp'
 'COMPUTERNAME': 'ARCSERVER'
 'VS140COMNTOOLS': 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\'
 'USERDOMAIN': 'HIGHLANDS'
 'PYTHON': 'C:\\Python27\\ArcGIS10.4;'
 'PSMODULEPATH': 'C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules\\'
 'COMMONPROGRAMFILES': 'C:\\Program Files (x86)\\Common Files'
 'PROCESSOR_IDENTIFIER': 'Intel64 Family 6 Model 45 Stepping 7
 GenuineIntel'
 'POSTGIS_GDAL_ENABLED_DRIVERS': 'GTiff PNG JPEG GIF XYZ DTED USGSDEM AAIGrid'
 'PROGRAMFILES': 'C:\\Program Files (x86)'
 'PROCESSOR_REVISION': '2d07'
 'PATH': 'C:\\Oracle_Client;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Program Files (x86)\\Common Files\\Microsoft Shared\\Windows Live;c:\\Program Files (x86)\\AMD APP\\bin\\x86_64;c:\\Program Files (x86)\\AMD APP\\bin\\x86;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\Intel\\Services\\IPT\\;c:\\Program Files (x86)\\ATI Technologies\\ATI.ACE\\Core-Static;C:\\Program Files\\Dell\\Dell Data Protection\\Access\\Advanced\\Wave\\Gemalto\\Access Client\\v5\\;C:\\Program Files (x86)\\Security Innovation\\SI TSS\\bin\\;C:\\Program Files (x86)\\Windows Live\\Shared;C:\\Program Files (x86)\\Enterprise Vault\\EVClient\\;C:\\Python27\\ArcGIS10.4;C:\\Python27\\ArcGIS10.4\\Scripts;C:\\Program Files\\nodejs\\;C:\\Users\\ishiland\\AppData\\Local\\GitHub\\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\\cmd;C:\\Program Files\\Git\\cmd;C:\\Users\\rizagha\\.dnx\\bin;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Program Files (x86)\\Brackets\\command'
 'SYSTEMROOT': 'C:\\Windows'
 'AMDAPPSDKROOT': 'c:\\Program Files (x86)\\AMD APP\\'
 'PROGRAMFILES(X86)': 'C:\\Program Files (x86)'
 'WINDOWS_TRACING_FLAGS': '3'
 'TEMP': 'C:\\Users\\rizagha\\AppData\\Local\\Temp'
 'COMMONPROGRAMFILES(X86)': 'C:\\Program Files (x86)\\Common Files'
 'PROCESSOR_ARCHITECTURE': 'x86'
 'AGSDESKTOPJAVA': 'C:\\Program Files (x86)\\ArcGIS\\Desktop10.4\\'
 'ALLUSERSPROFILE': 'C:\\ProgramData'
 'LOCALAPPDATA': 'C:\\Users\\rizagha\\AppData\\Local'
 'HOMEPATH': '\\'
 'PROGRAMW6432': 'C:\\Program Files'
 'USERNAME': 'rizagha'
 'FP_NO_HOST_CHECK': 'NO'
 'LOGONSERVER': '\\\\HC-07'
 'SESSIONNAME': 'Console'
 'PROGRAMDATA': 'C:\\ProgramData'
 'PYTHONPATH': 'C:\\Python27\\ArcGISx6410.4;C:\\Python27\\ArcGIS10.4'
 'HOMESHARE': '\\\\hc-05\\home\\rzagha'
 'PATHEXT': '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC'
 'ASL.LOG': 'Destination=file'
 'GDAL_DATA': 'C:\\Program Files\\PostgreSQL\\9.5\\gdal-data'
 'WINDIR': 'C:\\Windows'
 'WINDOWS_TRACING_LOGFILE': 'C:\\BVTBin\\Tests\\installpackage\\csilogfile.log'
 'HOMEDRIVE': 'U:'
 'SYSTEMDRIVE': 'C:'
 'COMSPEC': 'C:\\Windows\\system32\\cmd.exe'
 'NUMBER_OF_PROCESSORS': '12'
 'APPDATA': 'C:\\Users\\rizagha\\AppData\\Roaming'
 'USERDNSDOMAIN': 
 'PROCESSOR_LEVEL': '6'
 'PROCESSOR_ARCHITEW6432': 'AMD64'
 'POSTGIS_ENABLE_OUTDB_RASTERS': '1'
 'COMMONPROGRAMW6432': 'C:\\Program Files\\Common Files'
 'OS': 'Windows_NT'
 'PUBLIC': 'C:\\Users\\Public'
 'USERPROFILE': 'C:\\Users\\rizagha'}

64 bit:

{'TMP': 'C:\\Users\\rizagha\\AppData\\Local\\Temp'
 'PYTHONIOENCODING': 'UTF-8'
 'COMPUTERNAME': 'ARCSERVER'
 'VS140COMNTOOLS': 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\'
 'USERDOMAIN': 'HIGHLANDS'
 'PYTHON': 'C:\\Python27\\ArcGIS10.4;'
 'PSMODULEPATH': 'C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules\\'
 'PYTHONDONTWRITEBYTECODE': '1'
 'COMMONPROGRAMFILES': 'C:\\Program Files\\Common Files'
 'PROCESSOR_IDENTIFIER': 'Intel64 Family 6 Model 45 Stepping 7
 GenuineIntel'
 'POSTGIS_GDAL_ENABLED_DRIVERS': 'GTiff PNG JPEG GIF XYZ DTED USGSDEM AAIGrid'
 'PROGRAMFILES': 'C:\\Program Files'
 'PROCESSOR_REVISION': '2d07'
 'SYSTEMROOT': 'C:\\Windows'
 'PATH': 'C:\\Oracle_Client;C:\\ProgramData\\Oracle\\Java\\javapath;C:\\Program Files (x86)\\Common Files\\Microsoft Shared\\Windows Live;c:\\Program Files (x86)\\AMD APP\\bin\\x86_64;c:\\Program Files (x86)\\AMD APP\\bin\\x86;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\Intel\\Services\\IPT\\;c:\\Program Files (x86)\\ATI Technologies\\ATI.ACE\\Core-Static;C:\\Program Files\\Dell\\Dell Data Protection\\Access\\Advanced\\Wave\\Gemalto\\Access Client\\v5\\;C:\\Program Files (x86)\\Security Innovation\\SI TSS\\bin\\;C:\\Program Files (x86)\\Windows Live\\Shared;C:\\Program Files (x86)\\Enterprise Vault\\EVClient\\;C:\\Python27\\ArcGIS10.4;C:\\Python27\\ArcGIS10.4\\Scripts;C:\\Program Files\\nodejs\\;C:\\Users\\ishiland\\AppData\\Local\\GitHub\\PortableGit_c2ba306e536fdf878271f7fe636a147ff37326ad\\cmd;C:\\Program Files\\Git\\cmd;C:\\Users\\rizagha\\.dnx\\bin;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Program Files (x86)\\Brackets\\command;C:\\Program Files (x86)\\ArcGIS\\Desktop10.4\\bin64'
 'PYTHONUNBUFFERED': '1'
 'AMDAPPSDKROOT': 'c:\\Program Files (x86)\\AMD APP\\'
 'PROGRAMFILES(X86)': 'C:\\Program Files (x86)'
 'WINDOWS_TRACING_FLAGS': '3'
 'TERM': 'emacs'
 'TEMP': 'C:\\Users\\rizagha\\AppData\\Local\\Temp'
 'COMMONPROGRAMFILES(X86)': 'C:\\Program Files (x86)\\Common Files'
 'PROCESSOR_ARCHITECTURE': 'AMD64'
 'AGSDESKTOPJAVA': 'C:\\Program Files (x86)\\ArcGIS\\Desktop10.4\\'
 'ALLUSERSPROFILE': 'C:\\ProgramData'
 'LOCALAPPDATA': 'C:\\Users\\rizagha\\AppData\\Local'
 'HOMEPATH': '\\'
 'PROGRAMW6432': 'C:\\Program Files'
 'USERNAME': 'rizagha'
 'FP_NO_HOST_CHECK': 'NO'
 'LOGONSERVER': '\\\\HC-07'
 'COMSPEC': 'C:\\Windows\\system32\\cmd.exe'
 'PROGRAMDATA': 'C:\\ProgramData'
 'PYTHONPATH': 'C:\\Users\\rizagha\\PycharmProjects\\untitled;C:\\Python27\\ArcGISx6410.4;C:\\Python27\\ArcGIS10.4;C:\\Program Files (x86)\\JetBrains\\PyCharm 2016.1\\helpers\\pydev'
 'HOMESHARE': '\\\\hc-05\\home\\rzagha'
 'SESSIONNAME': 'Console'
 'PATHEXT': '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC'
 'ASL.LOG': 'Destination=file'
 'GDAL_DATA': 'C:\\Program Files\\PostgreSQL\\9.5\\gdal-data'
 'WINDIR': 'C:\\Windows'
 'WINDOWS_TRACING_LOGFILE': 'C:\\BVTBin\\Tests\\installpackage\\csilogfile.log'
 'HOMEDRIVE': 'U:'
 'SYSTEMDRIVE': 'C:'
 'PYCHARM_HOSTED': '1'
 'NUMBER_OF_PROCESSORS': '12'
 'APPDATA': 'C:\\Users\\rizagha\\AppData\\Roaming'
 'USERDNSDOMAIN': 
 'PROCESSOR_LEVEL': '6'
 'POSTGIS_ENABLE_OUTDB_RASTERS': '1'
 'COMMONPROGRAMW6432': 'C:\\Program Files\\Common Files'
 'OS': 'Windows_NT'
 'PUBLIC': 'C:\\Users\\Public'
 'USERPROFILE': 'C:\\Users\\rizagha'}

Best Answer

After trying all the suggestions posted to no avail I simply ended up uninstalling arcgis for desktop and the 64 bit processing. reinstalled the argis for desktop first then the 64 bit and it worked

Related Question