Ideas to solve failed mesa import - "AttributeError: module 'numpy.typing' has no attribute 'NDArray'" #1826
-
I'm trying to import Mesa (2.1.1) using Juptyer notebooks in ArcGIS Pro 3.13 (Python 3.9.18). on Import I an attribute error tracing to Line 54: FloatCoordinate = Union[Tuple[float, float], npt.NDArray[float]]. Is it a possible data type error or could it be a dependency issue? (Code and screen shot below) AttributeError Traceback (most recent call last) File C:\Program Files\ArcGIS\Pro\bin\Python\envs\AgentBasedModel\lib\site-packages\mesa_init_.py, in : File C:\Program Files\ArcGIS\Pro\bin\Python\envs\AgentBasedModel\lib\site-packages\mesa\flat_init_.py, in : File C:\Program Files\ArcGIS\Pro\bin\Python\envs\AgentBasedModel\lib\site-packages\mesa\space.py, in : AttributeError: module 'numpy.typing' has no attribute 'NDArray' |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
FloatCoordinate = Any |
Beta Was this translation helpful? Give feedback.
numpy.typing.NDArray
is a recent addition to NumPy since 1.21: https://numpy.org/doc/stable/reference/typing.html#numpy.typing.NDArray. It's possible that the installed NumPy version bundled in that ArcGIS Pro is older than that. I haven't used that software: is it possible to update the NumPy version manually? If this is not possible, you can also manually edit line 54 of C:\Program Files\ArcGIS\Pro\bin\Python\envs\AgentBasedModel\lib\site-packages\mesa\space.pyto