You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know exactly why I am encountering this bug as I was using the module fine up to a few days ago, maybe there was a NumPy update. I currently have the version 2.0.0 installed.
I tried this in a fresh virtual environment with only pynldas2 installed with pip
If I import pynldas2 I get the following error message:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
Cell In[12], [line 1](vscode-notebook-cell:?execution_count=12&line=1)
----> [1](vscode-notebook-cell:?execution_count=12&line=1) import pynldas2
File c:\Users\Luc\projects\pyagnps\.venv\Lib\site-packages\pynldas2\__init__.py:6
[4](file:///C:/Users/Luc/projects/pyagnps/.venv/Lib/site-packages/pynldas2/__init__.py:4) from pynldas2.exceptions import InputRangeError, InputTypeError, InputValueError, NLDASServiceError
[5](file:///C:/Users/Luc/projects/pyagnps/.venv/Lib/site-packages/pynldas2/__init__.py:5) from pynldas2.print_versions import show_versions
----> [6](file:///C:/Users/Luc/projects/pyagnps/.venv/Lib/site-packages/pynldas2/__init__.py:6) from pynldas2.pynldas2 import get_bycoords, get_bygeom, get_grid_mask
[8](file:///C:/Users/Luc/projects/pyagnps/.venv/Lib/site-packages/pynldas2/__init__.py:8) try:
[9](file:///C:/Users/Luc/projects/pyagnps/.venv/Lib/site-packages/pynldas2/__init__.py:9) __version__ = version("pynldas2")
File c:\Users\Luc\projects\pyagnps\.venv\Lib\site-packages\pynldas2\pynldas2.py:16
[14](file:///C:/Users/Luc/projects/pyagnps/.venv/Lib/site-packages/pynldas2/pynldas2.py:14) import pyproj
[15](file:///C:/Users/Luc/projects/pyagnps/.venv/Lib/site-packages/pynldas2/pynldas2.py:15) import xarray as xr
---> [16](file:///C:/Users/Luc/projects/pyagnps/.venv/Lib/site-packages/pynldas2/pynldas2.py:16) from numpy.core._exceptions import UFuncTypeError
[17](file:///C:/Users/Luc/projects/pyagnps/.venv/Lib/site-packages/pynldas2/pynldas2.py:17) from pandas.errors import EmptyDataError
[19](file:///C:/Users/Luc/projects/pyagnps/.venv/Lib/site-packages/pynldas2/pynldas2.py:19) import async_retriever as ar
ModuleNotFoundError: No module named 'numpy.core._exceptions'
Line 16 of pynldas2.py tries to import a class which results in the error above:
from numpy.core._exceptions import UFuncTypeError
I went and checked and this class is indeed present under numpy -> core -> _exceptions.py so there must be a mechanism preventing the import.
I do believe I know what would fix it: If just run
numpy.core._exceptions
I get a DeprecationWarning:
DeprecationWarning: numpy.core is deprecated and has been renamed to numpy._core. The numpy._core namespace contains private NumPy internals and its use is discouraged, as NumPy internals can change without warning in any release. In practice, most real-world usage of numpy.core is to access functionality in the public NumPy API. If that is the case, use the public NumPy API. If not, you are using NumPy internals. If you would still like to access an internal attribute, use numpy._core._exceptions.
numpy.core._exceptions
Thus this works without any issue:
from numpy._core._exceptions import UFuncTypeError
So adding a leading underscore in front of core would solve the issue.
Minimal Complete Verifiable Example
python-c"import pynldas2"
Environment
Fresh virtual environment with Python 3.11
The text was updated successfully, but these errors were encountered:
Yes, it's a numpy 2 compatibility issue that I've already addressed, but still haven't released a new version. So, if you update from git, it should work fine. I will release an update soon.
What happened?
I don't know exactly why I am encountering this bug as I was using the module fine up to a few days ago, maybe there was a NumPy update. I currently have the version 2.0.0 installed.
I tried this in a fresh virtual environment with only
pynldas2
installed withpip
If I
import pynldas2
I get the following error message:Line 16 of
pynldas2.py
tries to import a class which results in the error above:I went and checked and this class is indeed present under numpy -> core -> _exceptions.py so there must be a mechanism preventing the import.
I do believe I know what would fix it: If just run
I get a
DeprecationWarning
:Thus this works without any issue:
So adding a leading underscore in front of
core
would solve the issue.Minimal Complete Verifiable Example
Environment
Fresh virtual environment with Python 3.11
The text was updated successfully, but these errors were encountered: