cliffzhou92 / STT

MIT License
11 stars 3 forks source link

AttributeError: 'slepc4py.SLEPc.DS' object has no attribute 'restoreMat' when run st.tl.dynamical_iteration #1

Open liyarubio opened 1 month ago

liyarubio commented 1 month ago

Hi there,

I wanted to express my appreciation for the intriguing and innovative STT method you've developed. It's truly fascinating, and I've been excited to explore the example code you've provided.

However, I've encountered an issue while running the example_toggle.ipynb notebook. I was hoping to get some guidance on how to resolve it. The error message I'm receiving is as follows:

Code

adata_aggr = st.tl.dynamical_iteration(adata,n_states =2, n_iter = 20, n_neighbors = 100, n_components = 20, 
                                       weight_connectivities=0.2)

Error

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[/tmp/ipykernel_114418/1393412481.py](https://file+.vscode-resource.vscode-cdn.net/tmp/ipykernel_114418/1393412481.py) in 
      1 adata.obs['attractor']=adata.obs['leiden']
      2 adata_aggr = st.tl.dynamical_iteration(adata,n_states =2, n_iter = 20, n_neighbors = 100, n_components = 20, 
----> 3                                        weight_connectivities=0.2)

[/media/liyaru/LYR/Diff_change/2_benchmark/5_STT/STT-release/example_notebooks/stt/tl/_dynamical_analysis.py](https://file+.vscode-resource.vscode-cdn.net/media/liyaru/LYR/Diff_change/2_benchmark/5_STT/STT-release/example_notebooks/stt/tl/_dynamical_analysis.py) in dynamical_iteration(adata, n_states, n_states_seq, n_iter, return_aggr_obj, weight_connectivities, n_components, n_neighbors, thresh_ms_gene, thresh_entropy, use_spatial, spa_weight, spa_conn_key, monitor_mode, l2)
    303         sc.tl.pca(sc_object_aggr,use_highly_variable = True)
    304         sc.pp.neighbors(sc_object_aggr,n_neighbors = n_neighbors)#update the neighbors using multistable genes
--> 305         dynamical_analysis(adata, sc_object_aggr, n_states = n_states,n_states_seq=n_states_seq, weight_connectivities=weight_connectivities, n_components = n_components,thresh_ms_gene = thresh_ms_gene, use_spatial = use_spatial, spa_weight = spa_weight, spa_conn_key = spa_conn_key)
    306 
    307         rho = adata.obsm['rho']

[/media/liyaru/LYR/Diff_change/2_benchmark/5_STT/STT-release/example_notebooks/stt/tl/_dynamical_analysis.py](https://file+.vscode-resource.vscode-cdn.net/media/liyaru/LYR/Diff_change/2_benchmark/5_STT/STT-release/example_notebooks/stt/tl/_dynamical_analysis.py) in dynamical_analysis(sc_object, sc_object_aggr, n_states, n_states_seq, weight_connectivities, n_components, thresh_ms_gene, use_spatial, spa_weight, spa_conn_key)
     55 
     56     g_fwd = GPCCA(kernel)
---> 57     g_fwd.compute_schur(n_components=n_components)
     58 
     59     if n_states == None:

[~/miniconda3/envs/stt/lib/python3.7/site-packages/cellrank/tl/estimators/_decomposition.py](https://file+.vscode-resource.vscode-cdn.net/media/liyaru/LYR/Diff_change/2_benchmark/5_STT/STT-release/example_notebooks/~/miniconda3/envs/stt/lib/python3.7/site-packages/cellrank/tl/estimators/_decomposition.py) in compute_schur(self, n_components, initial_distribution, method, which, alpha)
    465 
    466         try:
--> 467             self._gpcca._do_schur_helper(n_components)
...
--> 272     ds.restoreMat(SLEPc.DS.MatType.A, A)
    273 
    274     # Gets the number of converged eigenpairs.

AttributeError: 'slepc4py.SLEPc.DS' object has no attribute 'restoreMat'

Here are the details of my environment: OS: Ubuntu 20.04.6 LTS Python Version : Python 3.7.6 Package Version : piplist.txt The slepc and slepc4py version are 3.13.0 as your requirements.txt shown. piplist.txt

I'd be very grateful for any assistance you can offer. Thank you in advance for your time and support!

Best regards!

shaohuishi commented 2 weeks ago

Hi there,

I wanted to express my appreciation for the intriguing and innovative STT method you've developed. It's truly fascinating, and I've been excited to explore the example code you've provided.

However, I've encountered an issue while running the example_toggle.ipynb notebook. I was hoping to get some guidance on how to resolve it. The error message I'm receiving is as follows:

Code

adata_aggr = st.tl.dynamical_iteration(adata,n_states =2, n_iter = 20, n_neighbors = 100, n_components = 20, 
                                       weight_connectivities=0.2)

Error

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[/tmp/ipykernel_114418/1393412481.py](https://file+.vscode-resource.vscode-cdn.net/tmp/ipykernel_114418/1393412481.py) in 
      1 adata.obs['attractor']=adata.obs['leiden']
      2 adata_aggr = st.tl.dynamical_iteration(adata,n_states =2, n_iter = 20, n_neighbors = 100, n_components = 20, 
----> 3                                        weight_connectivities=0.2)

[/media/liyaru/LYR/Diff_change/2_benchmark/5_STT/STT-release/example_notebooks/stt/tl/_dynamical_analysis.py](https://file+.vscode-resource.vscode-cdn.net/media/liyaru/LYR/Diff_change/2_benchmark/5_STT/STT-release/example_notebooks/stt/tl/_dynamical_analysis.py) in dynamical_iteration(adata, n_states, n_states_seq, n_iter, return_aggr_obj, weight_connectivities, n_components, n_neighbors, thresh_ms_gene, thresh_entropy, use_spatial, spa_weight, spa_conn_key, monitor_mode, l2)
    303         sc.tl.pca(sc_object_aggr,use_highly_variable = True)
    304         sc.pp.neighbors(sc_object_aggr,n_neighbors = n_neighbors)#update the neighbors using multistable genes
--> 305         dynamical_analysis(adata, sc_object_aggr, n_states = n_states,n_states_seq=n_states_seq, weight_connectivities=weight_connectivities, n_components = n_components,thresh_ms_gene = thresh_ms_gene, use_spatial = use_spatial, spa_weight = spa_weight, spa_conn_key = spa_conn_key)
    306 
    307         rho = adata.obsm['rho']

[/media/liyaru/LYR/Diff_change/2_benchmark/5_STT/STT-release/example_notebooks/stt/tl/_dynamical_analysis.py](https://file+.vscode-resource.vscode-cdn.net/media/liyaru/LYR/Diff_change/2_benchmark/5_STT/STT-release/example_notebooks/stt/tl/_dynamical_analysis.py) in dynamical_analysis(sc_object, sc_object_aggr, n_states, n_states_seq, weight_connectivities, n_components, thresh_ms_gene, use_spatial, spa_weight, spa_conn_key)
     55 
     56     g_fwd = GPCCA(kernel)
---> 57     g_fwd.compute_schur(n_components=n_components)
     58 
     59     if n_states == None:

[~/miniconda3/envs/stt/lib/python3.7/site-packages/cellrank/tl/estimators/_decomposition.py](https://file+.vscode-resource.vscode-cdn.net/media/liyaru/LYR/Diff_change/2_benchmark/5_STT/STT-release/example_notebooks/~/miniconda3/envs/stt/lib/python3.7/site-packages/cellrank/tl/estimators/_decomposition.py) in compute_schur(self, n_components, initial_distribution, method, which, alpha)
    465 
    466         try:
--> 467             self._gpcca._do_schur_helper(n_components)
...
--> 272     ds.restoreMat(SLEPc.DS.MatType.A, A)
    273 
    274     # Gets the number of converged eigenpairs.

AttributeError: 'slepc4py.SLEPc.DS' object has no attribute 'restoreMat'

Here are the details of my environment: OS: Ubuntu 20.04.6 LTS Python Version : Python 3.7.6 Package Version : piplist.txt The slepc and slepc4py version are 3.13.0 as your requirements.txt shown. piplist.txt

I'd be very grateful for any assistance you can offer. Thank you in advance for your time and support!

Best regards!

I found that the problem came from the package ‘pygpcca’. According to the suggestion of the package author, I used conda to reinstall this package and its dependencies. It now works normally in my conda environment.

XiangyuKuang commented 8 hours ago

Hi there,

I wanted to express my appreciation for the intriguing and innovative STT method you've developed. It's truly fascinating, and I've been excited to explore the example code you've provided.

However, I've encountered an issue while running the example_toggle.ipynb notebook. I was hoping to get some guidance on how to resolve it. The error message I'm receiving is as follows:

Code

adata_aggr = st.tl.dynamical_iteration(adata,n_states =2, n_iter = 20, n_neighbors = 100, n_components = 20, 
                                       weight_connectivities=0.2)

Error

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
[/tmp/ipykernel_114418/1393412481.py](https://file+.vscode-resource.vscode-cdn.net/tmp/ipykernel_114418/1393412481.py) in 
      1 adata.obs['attractor']=adata.obs['leiden']
      2 adata_aggr = st.tl.dynamical_iteration(adata,n_states =2, n_iter = 20, n_neighbors = 100, n_components = 20, 
----> 3                                        weight_connectivities=0.2)

[/media/liyaru/LYR/Diff_change/2_benchmark/5_STT/STT-release/example_notebooks/stt/tl/_dynamical_analysis.py](https://file+.vscode-resource.vscode-cdn.net/media/liyaru/LYR/Diff_change/2_benchmark/5_STT/STT-release/example_notebooks/stt/tl/_dynamical_analysis.py) in dynamical_iteration(adata, n_states, n_states_seq, n_iter, return_aggr_obj, weight_connectivities, n_components, n_neighbors, thresh_ms_gene, thresh_entropy, use_spatial, spa_weight, spa_conn_key, monitor_mode, l2)
    303         sc.tl.pca(sc_object_aggr,use_highly_variable = True)
    304         sc.pp.neighbors(sc_object_aggr,n_neighbors = n_neighbors)#update the neighbors using multistable genes
--> 305         dynamical_analysis(adata, sc_object_aggr, n_states = n_states,n_states_seq=n_states_seq, weight_connectivities=weight_connectivities, n_components = n_components,thresh_ms_gene = thresh_ms_gene, use_spatial = use_spatial, spa_weight = spa_weight, spa_conn_key = spa_conn_key)
    306 
    307         rho = adata.obsm['rho']

[/media/liyaru/LYR/Diff_change/2_benchmark/5_STT/STT-release/example_notebooks/stt/tl/_dynamical_analysis.py](https://file+.vscode-resource.vscode-cdn.net/media/liyaru/LYR/Diff_change/2_benchmark/5_STT/STT-release/example_notebooks/stt/tl/_dynamical_analysis.py) in dynamical_analysis(sc_object, sc_object_aggr, n_states, n_states_seq, weight_connectivities, n_components, thresh_ms_gene, use_spatial, spa_weight, spa_conn_key)
     55 
     56     g_fwd = GPCCA(kernel)
---> 57     g_fwd.compute_schur(n_components=n_components)
     58 
     59     if n_states == None:

[~/miniconda3/envs/stt/lib/python3.7/site-packages/cellrank/tl/estimators/_decomposition.py](https://file+.vscode-resource.vscode-cdn.net/media/liyaru/LYR/Diff_change/2_benchmark/5_STT/STT-release/example_notebooks/~/miniconda3/envs/stt/lib/python3.7/site-packages/cellrank/tl/estimators/_decomposition.py) in compute_schur(self, n_components, initial_distribution, method, which, alpha)
    465 
    466         try:
--> 467             self._gpcca._do_schur_helper(n_components)
...
--> 272     ds.restoreMat(SLEPc.DS.MatType.A, A)
    273 
    274     # Gets the number of converged eigenpairs.

AttributeError: 'slepc4py.SLEPc.DS' object has no attribute 'restoreMat'

Here are the details of my environment: OS: Ubuntu 20.04.6 LTS Python Version : Python 3.7.6 Package Version : piplist.txt The slepc and slepc4py version are 3.13.0 as your requirements.txt shown. piplist.txt

I'd be very grateful for any assistance you can offer. Thank you in advance for your time and support!

Best regards!

This error is caused by pygpcca=1.0.4. Downgrading pygpcca to 1.0.2 solved this problem in my environment.