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

numpy.typeDict is deprecated #92

Closed
otizonaizit opened this issue Aug 19, 2021 · 6 comments
Closed

numpy.typeDict is deprecated #92

otizonaizit opened this issue Aug 19, 2021 · 6 comments

Comments

@otizonaizit
Copy link
Member

In

_UNSAFE_DTYPES = [numx.typeDict[d] for d in

we use np.typeDict. This is deprecated since forever: numpy/numpy@6689502 and numpy/numpy#17585 . Since numpy release 1.21 this now issues a deprecation warning: numpy/numpy#17586
It seems that scipy is not importing deprecated names from the numpy namespace anymore, so that with numpy 1.21 and scipy 1.7 you now get an error:

AttributeError: module 'scipy' has no attribute 'typeDict'

We should change np.typeDict with np.sctypeDict most probably, but it is probably better to try to understand what we were trying to do in the function get_dtypes and fix it properly:

def get_dtypes(typecodes_key, _safe=True):

Thanks to Elgin Road for reporting this!

@NiMlr
Copy link
Member

NiMlr commented Mar 17, 2022

I will take care of this until March 27 EOD. @otizonaizit @Stewori @nkgevorgyan

@Stewori
Copy link
Member

Stewori commented Mar 17, 2022

Thank you, Nils.

@finnoshea
Copy link

finnoshea commented Jun 23, 2022

Using conda and a clean install of mdp with conda install mdp I can import mdp without problem. But, if I then install scipy (and do nothing else), when I import mdp I get the AttributeError mentioned in the op of this issue. Is there a work around for using both mdp and scipy? For completness, here is the entirety of the warnings/errors generated

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/sdf/group/ml/bes_anomalies/conda/envs/mdp.test/lib/python3.10/site-packages/mdp/__init__.py", line 131, in <module>
    from . import utils
  File "/sdf/group/ml/bes_anomalies/conda/envs/mdp.test/lib/python3.10/site-packages/mdp/utils/__init__.py", line 5, in <module>
    from .routines import (timediff, refcast, scast, rotate, random_rot,
  File "/sdf/group/ml/bes_anomalies/conda/envs/mdp.test/lib/python3.10/site-packages/mdp/utils/routines.py", line 219, in <module>
    _UNSAFE_DTYPES = [numx.typeDict[d] for d in
  File "/sdf/group/ml/bes_anomalies/conda/envs/mdp.test/lib/python3.10/site-packages/mdp/utils/routines.py", line 221, in <listcomp>
    if d in numx.typeDict]
AttributeError: module 'scipy' has no attribute 'typeDict'

@NiMlr
Copy link
Member

NiMlr commented Jun 24, 2022

@finnoshea Do you experience the same problem when you install the mdp version from the master branch:

pip install git+https://github.com/mdp-toolkit/mdp-toolkit

@finnoshea
Copy link

That does appear to work. To recap:

  1. new conda env
  2. conda install mdp -> import mdp works
  3. conda install scipy -> import mdp fails

versus

  1. new conda env
  2. pip install git+https://github.com/mdp-toolkit/mdp-toolkit -> import mdp works
  3. conda install scipy -> import mdp still works

Thanks for the pointer @NiMlr!

@Stewori
Copy link
Member

Stewori commented Jul 26, 2023

This issue has been fixed in #94, so I am closing it now.

@Stewori Stewori closed this as completed Jul 26, 2023
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

No branches or pull requests

4 participants