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

error importing arcpy in jupyter using anaconda 64 bit python3.4 #11

Closed sandeepgadhwal closed 7 years ago

sandeepgadhwal commented 7 years ago

this is the error which i am getting

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files (x86)\ArcGIS\Desktop10.5\arcpy\arcpy\__init__.py", line 22, in <module>
    from arcpy.geoprocessing import gp
  File "C:\Program Files (x86)\ArcGIS\Desktop10.5\arcpy\arcpy\geoprocessing\__init__.py", line 14, in <module>
    from _base import *
ModuleNotFoundError: No module named '_base'
JamesRamm commented 7 years ago

Is your ArcGIS version 64bit?

JamesRamm commented 7 years ago

I see that you are using arcgis 10.5. Archook has never been tested against this version (it must be the latest?), so it is feasible there have been changes to directory paths. Can you confirm that your ArcGIS directory (C:\Program Files (x86)\ArcGIS\Desktop10.5) contains a bin folder and bin64 folder?

sandeepgadhwal commented 7 years ago

Yes i have installed 64 bit geoprocessing and my argis folder contains bin and bin64.

On 30-May-2017 1:39 PM, "James Ramm" notifications@github.com wrote:

I see that you are using arcgis 10.5. Archook has never been tested against this version (it must be the latest?), so it is feasible there have been changes to directory paths. Can you confirm that your ArcGIS directory (C:\Program Files (x86)\ArcGIS\Desktop10.5) contains a bin folder and bin64 folder?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JamesRamm/archook/issues/11#issuecomment-304805982, or mute the thread https://github.com/notifications/unsubscribe-auth/ARpk2LT22lrq46-X29RS-oeOg3Qs676Yks5r-87KgaJpZM4NoqrT .

sandeepgadhwal commented 7 years ago

I am new to this python scripting but if I can help you in anyway please ask me as this tool archook really makes life easy and it would be great if it supports the latest version.

On 30-May-2017 1:51 PM, "Sandeep Kumar" sandeepgadhwal1@gmail.com wrote:

Yes i have installed 64 bit geoprocessing and my argis folder contains bin and bin64.

On 30-May-2017 1:39 PM, "James Ramm" notifications@github.com wrote:

I see that you are using arcgis 10.5. Archook has never been tested against this version (it must be the latest?), so it is feasible there have been changes to directory paths. Can you confirm that your ArcGIS directory (C:\Program Files (x86)\ArcGIS\Desktop10.5) contains a bin folder and bin64 folder?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JamesRamm/archook/issues/11#issuecomment-304805982, or mute the thread https://github.com/notifications/unsubscribe-auth/ARpk2LT22lrq46-X29RS-oeOg3Qs676Yks5r-87KgaJpZM4NoqrT .

JamesRamm commented 7 years ago

_base is a pyd (a compiled extension module), so an ImportError would typically be generated by either of these:

Is _base in the bin64 directory? Can you do a print(sys.path) after calling get_arcpy and paste the contents here?

sandeepgadhwal commented 7 years ago

import archook archook.get_arcpy() import sys print(sys.path) ['', 'C:\Program Files (x86)\ArcGIS\Desktop10.5\arcpy', 'C:\ProgramData\Anaconda3\python36.zip', 'C:\ProgramData\Anaconda3\DLLs', 'C:\ProgramData\Anaconda3\lib', 'C:\ProgramData\Anaconda3', 'C:\ProgramData\Anaconda3\lib\site-packages', 'C:\ProgramData\Anaconda3\lib\site-packages\Sphinx-1.5.1-py3.6.egg', 'C:\ProgramData\Anaconda3\lib\site-packages\win32', 'C:\ProgramData\Anaconda3\lib\site-packages\win32\lib', 'C:\ProgramData\Anaconda3\lib\site-packages\Pythonwin', 'C:\ProgramData\Anaconda3\lib\site-packages\setuptools-27.2.0-py3.6.egg', 'C:\Program Files (x86)\ArcGIS\Desktop10.5\arcpy', 'C:\Program Files (x86)\ArcGIS\Desktop10.5\bin64', 'C:\Program Files (x86)\ArcGIS\Desktop10.5\ArcToolbox\Scripts']

https://mailtrack.io/ Sent with Mailtrack https://mailtrack.io/install?source=signature&lang=en&referral=sandeepgadhwal1@gmail.com&idSignature=22

On Tue, May 30, 2017 at 1:58 PM, James Ramm notifications@github.com wrote:

_base is a pyd (a compiled extension module), so an ImportError would typically be generated by either of these:

  • mismatch between the bitness of the pyd, arcgis, python (64bit vs 32bit)
  • The directory containing _base was not added to the path.

Is _base in the bin64 directory? Can you do a print(sys.path) after calling get_arcpy and paste the contents here?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JamesRamm/archook/issues/11#issuecomment-304809924, or mute the thread https://github.com/notifications/unsubscribe-auth/ARpk2Kbdz43VFxuch8wIQeMkpsYtHZuMks5r-9MjgaJpZM4NoqrT .

JamesRamm commented 7 years ago

I can see that the bin64 directory is correctly added to the path, as is the arcpy directory. Can you confirm that either

C:/Program Files(x86)/ArcGIS/Desktop10.5/bin64 or C:/Program Files (x86)/ArcGIS/Desktop10.5/arcpy contains a _base.pyd file?

sandeepgadhwal commented 7 years ago

C:\Program Files (x86)\ArcGIS\Desktop10.5\arcpy\arcpy contains a _base.py file

JamesRamm commented 7 years ago

As far as I know, ArcGIS 10.5 for desktop still uses python 2.x, so there is a chance this causes problems. Try creating a new conda environment for python 2 and importing archook into that:

conda create -n py2 python=2.7
source activate py2
pip install archook numpy==1.9.3

P.S. github doesnt show images attached to emails

sandeepgadhwal commented 7 years ago

i am able to import arcpy in anaconda 2.7 32 bit.

https://mailtrack.io/ Sent with Mailtrack https://mailtrack.io/install?source=signature&lang=en&referral=sandeepgadhwal1@gmail.com&idSignature=22

On Tue, May 30, 2017 at 2:22 PM, James Ramm notifications@github.com wrote:

As far as I know, ArcGIS 10.5 for desktop still uses python 2.x, so there is a chance this causes problems. Try creating a new conda environment for python 2 and importing archook into that:

conda create -n py2 python=2.7 source activate py2 pip install archook numpy==1.9.3

P.S. github doesnt show images attached to emails

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JamesRamm/archook/issues/11#issuecomment-304815559, or mute the thread https://github.com/notifications/unsubscribe-auth/ARpk2J9AfRS2HJpHeKXOAxjwj7NiV0fqks5r-9jUgaJpZM4NoqrT .

sandeepgadhwal commented 7 years ago

(C:\ProgramData\Anaconda2) C:\Users\sandyjones>python Python 2.7.13 |Anaconda 4.3.1 (32-bit)| (default, Dec 19 2016, 13:36:02) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. Anaconda is brought to you by Continuum Analytics. Please check out: http://continuum.io/thanks and https://anaconda.org

import archook archook.get_arcpy() import arcpy arcpy <module 'arcpy' from 'C:\Program Files (x86)\ArcGIS\Desktop10.5\arcpy\arcpy__init__.pyc'>

https://mailtrack.io/ Sent with Mailtrack https://mailtrack.io/install?source=signature&lang=en&referral=sandeepgadhwal1@gmail.com&idSignature=22

On Tue, May 30, 2017 at 2:23 PM, Sandeep Kumar sandeepgadhwal1@gmail.com wrote:

i am able to import arcpy in anaconda 2.7 32 bit.

https://mailtrack.io/ Sent with Mailtrack https://mailtrack.io/install?source=signature&lang=en&referral=sandeepgadhwal1@gmail.com&idSignature=22

On Tue, May 30, 2017 at 2:22 PM, James Ramm notifications@github.com wrote:

As far as I know, ArcGIS 10.5 for desktop still uses python 2.x, so there is a chance this causes problems. Try creating a new conda environment for python 2 and importing archook into that:

conda create -n py2 python=2.7 source activate py2 pip install archook numpy==1.9.3

P.S. github doesnt show images attached to emails

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JamesRamm/archook/issues/11#issuecomment-304815559, or mute the thread https://github.com/notifications/unsubscribe-auth/ARpk2J9AfRS2HJpHeKXOAxjwj7NiV0fqks5r-9jUgaJpZM4NoqrT .

JamesRamm commented 7 years ago

great

sandeepgadhwal commented 7 years ago

image

image

i have 64bit python installed by arcgis in C:\Python27\ArcGISx6410.5 when i import arcpy there i get this error.

JamesRamm commented 7 years ago

Such errors are often caused by a mismatch in bitness. Since this appears to be a problem with the ArcGIS installation and not archook (you can create import problems without archook) then I suggest posting on the ArcGIS support forum?

Archook seems to be working correctly when you match up the correct python version, so I'll close this.

sandeepgadhwal commented 7 years ago

okay so can i import arcpy in 64bit windows or not.

JamesRamm commented 7 years ago

Evidently in your current setup, you cant. Whether you are supposed to be able to is a question for the ArcGIS support (maybe there is a problem with your installation).

sandeepgadhwal commented 7 years ago

thanks james.