Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

np.str deprecated for numpy >= 1.24.0 - breaks MDSplus python #2532

Closed
cenkoloji opened this issue Feb 10, 2023 · 3 comments · Fixed by #2537
Closed

np.str deprecated for numpy >= 1.24.0 - breaks MDSplus python #2532

cenkoloji opened this issue Feb 10, 2023 · 3 comments · Fixed by #2537
Assignees

Comments

@cenkoloji
Copy link
Contributor

Hello,

I can overcome this by downgrading numpy to 1.19.5, but wanted to bring them to your attention for the future.

OS: RHEL8 compatible systems (rocky8, alma8)
MDS versions: both alpha and stable
python version: python3.9
numpy versions: (tested 1.19.5, 1.20.0, 1.21.0, 1.22.0, 1.23.0, 1.24.0)

no.str is deprecated (Used in mdsscalar.py - class String)
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

>>> import MDSplus
>>> MDSplus.String("ads")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/mdsplus/python/MDSplus/mdsscalar.py", line 422, in __init__
    if not isinstance(self._value, _N.str):
  File "/home/yildiz/myenv/lib64/python3.9/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'str'.
`np.str` was a deprecated alias for the builtin `str`. To avoid this error in existing code, use `str` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.str_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
@joshStillerman
Copy link
Contributor

joshStillerman commented Feb 14, 2023 via email

@cenkoloji
Copy link
Contributor Author

MDSplus alpha 7.139.20

My post was unclear, sorry. Deprecation message appeared in numpy 1.20, but it's only truly deprecated in 1.24.

numpy versions: (tested 1.19.5, 1.20.0, 1.21.0, 1.22.0, 1.23.0, 1.24.0)

Out of these, only 1.24.0 fails, rest of them work fine.

If you create a new virtualenv and install numpy, you should get the latest version (1.24.2) and hit this issue

python3.10 -m venv myenv
source myenv/bin/activate
pip install --upgrade pip
pip install numpy

@santorofer
Copy link
Contributor

Hello Cenk,

Yes, I'm able to reproduce the issue.
I'm working on adding a fix soon.
Thank you.
Fernando

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants