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

numpy C extensions failed #34

Closed mhw-at-yg closed 3 months ago

mhw-at-yg commented 3 years ago

I haven't tried to use archook for a few months. This error is from an existing archook conda environment that worked fine the last time I touched it. Pro was recently upgraded to v2.8.0.

(archook-py36)

$ python D:\code\public\archook\test\simple-test-arcpro.py
========================================
3.6.10 |Anaconda, Inc.| (default, May  7 2020, 19:46:08) [MSC v.1916 64 bit (AMD64)]

--- PRE sys.path:
D:\code\public\archook\test
C:\tools\miniconda3\envs\archook-py36\python36.zip
C:\tools\miniconda3\envs\archook-py36\DLLs
C:\tools\miniconda3\envs\archook-py36\lib
C:\tools\miniconda3\envs\archook-py36
C:\tools\miniconda3\envs\archook-py36\lib\site-packages
d:\code\public\archook
---

--- ArcGIS Pro archook result: None
---

--- archook version: 1.3.dev0
---

--- POST sys.path:
C:\ArcGIS\Pro\\Resources\ArcToolbox\Scripts
C:\ArcGIS\Pro\\Resources\ArcPy
C:\ArcGIS\Pro\\bin
C:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages
C:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib
C:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\DLLs
C:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python36.zip
C:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3
D:\code\public\archook\test
C:\tools\miniconda3\envs\archook-py36\python36.zip
C:\tools\miniconda3\envs\archook-py36\DLLs
C:\tools\miniconda3\envs\archook-py36\lib
C:\tools\miniconda3\envs\archook-py36
C:\tools\miniconda3\envs\archook-py36\lib\site-packages
d:\code\public\archook
---
C:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\numpy\__init__.py:143: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
  from . import _distributor_init

*** Error:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.6 from "C:\tools\miniconda3\envs\archook-py36\python.exe"
  * The NumPy version is: "1.20.1"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: No module named 'numpy.core._multiarray_umath'

Traceback (most recent call last):
  File "C:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\numpy\core\__init__.py", line 22, in <module>
    from . import multiarray
  File "C:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\numpy\core\multiarray.py", line 12, in <module>
    from . import overrides
  File "C:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\code\public\archook\test\simple-test-arcpro.py", line 28, in <module>
    import arcpy
  File "C:\ArcGIS\Pro\\Resources\ArcPy\arcpy\__init__.py", line 21, in <module>
    import numpy
  File "C:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\numpy\__init__.py", line 145, in <module>
    from . import core
  File "C:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\numpy\core\__init__.py", line 48, in <module>
    raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.6 from "C:\tools\miniconda3\envs\archook-py36\python.exe"
  * The NumPy version is: "1.20.1"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: No module named 'numpy.core._multiarray_umath'
maphew commented 1 year ago

This still occurs with Pro v3.1.2 and py 3.9. So, we can't blindly assume conda install numpy will fetch a numpy compiled in the same manner that Pro's numpy is. I tried the naive approuch of conda installing using Pro's numpy version number but that doesn't fix it.

conda install numpy==1.20.1

Perhaps we need to add Esri's conda channel?

JamesRamm commented 1 year ago

Your logs show you have a 64bit version of Anaconda, but a quick google search seems to indicate that ArcGIS is still 32bit: image (Image from here)

mhw-at-yg commented 1 year ago

ArcGIS Desktop is ArcMap, and that remains 32bit, while ArcGIS Pro is 64bit. Esri and their infinite changing names!

mhw-at-yg commented 1 year ago

data point:

  • The Python version is: Python3.9 from "c:\apps\miniconda3\python.exe"
    • The NumPy version is: "1.20.1"

while conda list numpy reports 1.20.3. So the Numpy that's being imported is from Pro environment not the active shell's python. If I remove numpy from the conda env, the same error occurs. So it's not numpy alone.

However @cooperjaXC in #18 reports no issue with their conda envs and the current master repo so for the moment I'm concluding this is might be a local-only issue.

maphew commented 3 months ago

with Pro v3.3 and python 3.11, conda install numpy works, so closing this issue.

conda create -y --name archook-py311 python=3.11 -y
conda activate archook-py311
conda install -y numpy