Skip to content
  • Bas Nijholt's avatar
    Fix ImportError for scipy 1.8.0 · 4a6830ff
    Bas Nijholt authored
    See
    - https://github.com/scipy/scipy/pull/15220
    - https://github.com/scipy/scipy/issues/14360
    
    
    Currently, it gives the following error message:
    ```
    ---------------------------------------------------------------------------
    ImportError                               Traceback (most recent call last)
    Input In [29], in <module>
    ----> 1 from scipy.sparse.linalg import linsolve
    
    ImportError: cannot import name 'linsolve' from 'scipy.sparse.linalg' (/nfshome/basnijholt/mambaforge/envs/qms-lab-20220224-main/lib/python3.9/site-packages/scipy/sparse/linalg/__init__.py)
    ```
    
    With this change, the following warning is emitted:
    ```
    /tmp/scratch/basnijholt/ipykernel_59547/2794395227.py:1: DeprecationWarning: The module `scipy.sparse.linalg.dsolve.linsolve` is deprecated. All public names must be imported directly from the `scipy.sparse.linalg` namespace.
      from scipy.sparse.linalg.dsolve import linsolve
    ```
    
    The following gives no warning:
    ```
    from scipy.sparse.linalg._dsolve import linsolve
    ```
    
    However, we should reconsider using private features.
    4a6830ff