peng-lab / BaSiCPy

MIT License
67 stars 22 forks source link

Import error #149

Open fstur opened 7 months ago

fstur commented 7 months ago

Hi, Your package is really useful! Recently, though, my basicpy installations stopped working. On windows I install it with:

pip install "jax[cpu]==0.3.14" -f https://whls.blob.core.windows.net/unstable/index.html --use-deprecated legacy-resolver
pip install basicpy

But when I run

import basicpy

I get the error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\ProgramData\MinicondaZMB\envs\zmb_hcs_9833\lib\site-packages\basicpy\__init__.py", line 7, in <module>
    from basicpy.basicpy import BaSiC
  File "C:\ProgramData\MinicondaZMB\envs\zmb_hcs_9833\lib\site-packages\basicpy\basicpy.py", line 15, in <module>
    import jax.numpy as jnp
  File "C:\ProgramData\MinicondaZMB\envs\zmb_hcs_9833\lib\site-packages\jax\__init__.py", line 137, in <module>
    from jax import nn as nn
  File "C:\ProgramData\MinicondaZMB\envs\zmb_hcs_9833\lib\site-packages\jax\nn\__init__.py", line 19, in <module>
    from jax._src.nn.functions import (
  File "C:\ProgramData\MinicondaZMB\envs\zmb_hcs_9833\lib\site-packages\jax\_src\nn\functions.py", line 30, in <module>
    from jax.scipy.special import expit
  File "C:\ProgramData\MinicondaZMB\envs\zmb_hcs_9833\lib\site-packages\jax\scipy\__init__.py", line 16, in <module>
    from jax.scipy import linalg as linalg
  File "C:\ProgramData\MinicondaZMB\envs\zmb_hcs_9833\lib\site-packages\jax\scipy\linalg.py", line 15, in <module>
    from jax._src.scipy.linalg import (
  File "C:\ProgramData\MinicondaZMB\envs\zmb_hcs_9833\lib\site-packages\jax\_src\scipy\linalg.py", line 274, in <module>    @_wraps(scipy.linalg.tril)
AttributeError: module 'scipy.linalg' has no attribute 'tril'    

I guess the reason is, that in scipy 1.13.0, the scipy.linalg.tril function got removed. It does work, if I install it with scipy 1.12.0:

pip install scipy<1.13
pip install "jax[cpu]==0.3.14" -f https://whls.blob.core.windows.net/unstable/index.html --use-deprecated legacy-resolver
pip install basicpy

Maybe you could add scipy<1.13 as a requirement?

yfukai commented 7 months ago

Thanks @fstur for finding this out! I added the scipy constraint in a PR #148. The review system is currently not working, but at some point I organize them up to a new version.