dynamicslab / pysindy

A package for the sparse identification of nonlinear dynamical systems from data
https://pysindy.readthedocs.io/en/latest/
Other
1.42k stars 310 forks source link

module 'pysindy' has no attribute 'SINDyPI' #366

Closed penguinaugustus closed 1 year ago

penguinaugustus commented 1 year ago

Hi, I meet some problems when i try to run the sample of implicit-ODEs: https://pysindy.readthedocs.io/en/latest/examples/15_pysindy_lectures/example.html#Implicit-ODEs the error was


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
/var/folders/cd/5hbmg50x21dcv5w59_3cwdrm0000gn/T/ipykernel_3812/3017384247.py in <module>
     49 '''
     50 
---> 51 sindy_opt = ps.SINDyPI(
     52     threshold=1e-6,
     53     tol=1e-8,

AttributeError: module 'pysindy' has no attribute 'SINDyPI'

I found a similar issue here: https://github.com/dynamicslab/pysindy/issues/270 However, it seems that the current solution is to reinstall python. I tried to run the same example on another computer, still meet the same issue. Could you give me some instruction on how to deal with the problem? Thank you for your time!

_____- My python version: computer 1: 3.8.8 computer 2: 3.9.13 pysindy version: both 1.7.5

Jacob-Stevens-Haas commented 1 year ago

SINDyPI requires cvxpy. Run pip install pysindy[cvxpy]

If pysindy cannot import cvxpy, it does not import SINDyPI

penguinaugustus commented 1 year ago

thank you for your reply! However, i still met some problem: first I tried pip install pysindy[cvxpy] i got

zsh:1: no matches found: pysindy[cvxpy]
Note: you may need to restart the kernel to use updated packages.

I restart the kernel but still AttributeError: module 'pysindy' has no attribute 'SINDyPI' Then i try to upgrade my pip with pip install --upgrade pip setuptools and try pip install pysindy[cvxpy] again, but get the same result. Then i try pip install "pysindy[cvxpy]", the result was:

Requirement already satisfied: pysindy[cvxpy] in /Users/yufu/opt/anaconda3/lib/python3.9/site-packages (1.7.5)
WARNING: pysindy 1.7.5 does not provide the extra 'cvxpy'
Requirement already satisfied: scikit-learn>=0.23 in /Users/yufu/opt/anaconda3/lib/python3.9/site-packages (from pysindy[cvxpy]) (1.0.2)
Requirement already satisfied: numpy in /Users/yufu/opt/anaconda3/lib/python3.9/site-packages (from pysindy[cvxpy]) (1.21.5)
.......
Note: you may need to restart the kernel to use updated packages.

could you give me some instruction on it? thank you so much on your help!

Jacob-Stevens-Haas commented 1 year ago

Oh I see you opened a new Issue. Closing this one again.