theislab / scvelo

RNA Velocity generalized through dynamical modeling
https://scvelo.org
BSD 3-Clause "New" or "Revised" License
409 stars 102 forks source link

A bug on scv.tl.recover_dynamics #1089

Closed lzygenomics closed 1 year ago

lzygenomics commented 1 year ago

when I run scv.tl.recover_dynamics(adata), it return the bug, Could you please help me? Thank you!

scv.tl.recover_dynamics(adata)
Traceback (most recent call last): File "C:\Softwares\Miniconda3\envs\SpaVelo\lib\site-packages\traitlets\traitlets.py", line 653, in get value = obj._trait_values[self.name] KeyError: 'layout' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 1, in File "C:\Softwares\Miniconda3\envs\SpaVelo\lib\site-packages\scvelo\tools\dynamical_model.py", line 509, in recover_dynamics res = parallelize( File "C:\Softwares\Miniconda3\envs\SpaVelo\lib\site-packages\scvelo\core\_parallelize.py", line 121, in wrapper pbar = None if tqdm is None else tqdm(total=col_len, unit=unit) File "C:\Softwares\Miniconda3\envs\SpaVelo\lib\site-packages\tqdm\notebook.py", line 238, in __init__ self.container = self.status_printer(self.fp, total, self.desc, self.ncols) File "C:\Softwares\Miniconda3\envs\SpaVelo\lib\site-packages\tqdm\notebook.py", line 115, in status_printer pbar = IProgress(min=0, max=total) File "C:\Softwares\Miniconda3\envs\SpaVelo\lib\site-packages\ipywidgets\widgets\widget_float.py", line 26, in __init__ super().__init__(**kwargs) File "C:\Softwares\Miniconda3\envs\SpaVelo\lib\site-packages\ipywidgets\widgets\widget_description.py", line 35, in __init__ super().__init__(*args, **kwargs) File "C:\Softwares\Miniconda3\envs\SpaVelo\lib\site-packages\ipywidgets\widgets\widget.py", line 504, in __init__ self.open() File "C:\Softwares\Miniconda3\envs\SpaVelo\lib\site-packages\ipywidgets\widgets\widget.py", line 517, in open state, buffer_paths, buffers = _remove_buffers(self.get_state()) File "C:\Softwares\Miniconda3\envs\SpaVelo\lib\site-packages\ipywidgets\widgets\widget.py", line 615, in get_state value = to_json(getattr(self, k), self) File "C:\Softwares\Miniconda3\envs\SpaVelo\lib\site-packages\traitlets\traitlets.py", line 700, in __get__ return self.get(obj, cls) File "C:\Softwares\Miniconda3\envs\SpaVelo\lib\site-packages\traitlets\traitlets.py", line 656, in get default = obj.trait_defaults(self.name) File "C:\Softwares\Miniconda3\envs\SpaVelo\lib\site-packages\traitlets\traitlets.py", line 1868, in trait_defaults return self._get_trait_default_generator(names[0])(self) File "C:\Softwares\Miniconda3\envs\SpaVelo\lib\site-packages\traitlets\traitlets.py", line 624, in default return self.make_dynamic_default() File "C:\Softwares\Miniconda3\envs\SpaVelo\lib\site-packages\ipywidgets\widgets\trait_types.py", line 365, in make_dynamic_default return self.klass(*(self.default_args or ()), File "C:\Softwares\Miniconda3\envs\SpaVelo\lib\site-packages\ipywidgets\widgets\widget_layout.py", line 86, in __init__ super().__init__(**kwargs) File "C:\Softwares\Miniconda3\envs\SpaVelo\lib\site-packages\ipywidgets\widgets\widget.py", line 504, in __init__ self.open() File "C:\Softwares\Miniconda3\envs\SpaVelo\lib\site-packages\ipywidgets\widgets\widget.py", line 535, in open self.comm = create_comm(**args) File "C:\Softwares\Miniconda3\envs\SpaVelo\lib\site-packages\comm\__init__.py", line 27, in _create_comm raise NotImplementedError("Cannot ") NotImplementedError: Cannot
scvelo==0.2.5  scanpy==1.9.3  anndata==0.9.1  loompy==3.0.7  numpy==1.24.3  scipy==1.10.1  matplotlib==3.7.1  sklearn==1.2.2  pandas==1.3.5

AndiMunteanu commented 1 year ago

Hi! Did you get this error while running it in a notebook cell or as a python script?

WeilerP commented 1 year ago

@lzygenomics looks like a tqdm issue to me. Could also be related to you running your code on a Windows machine.

AndiMunteanu commented 1 year ago

@WeilerP I have similar errors raised by tqdm when trying to run my code as a python script on UNIX terminal. I suspect it is caused by the progress bar that cannot be shown. Could there be an option to toggle between showing this progress bar or not? (I know that this parameter exists in the internal methods, but it is not accessible in functions such as recover_dynamics)

lzygenomics commented 1 year ago

@WeilerP Wow, thank you for your quick response! Yes, I run scvelo on the Windows machine, and I also try to run it on Linux, and this step return another bug: ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (4,) + inhomogeneous part.

lzygenomics commented 1 year ago

Hi! Did you get this error while running it in a notebook cell or as a python script?

Yes~I run it both on interactive model and as the whole python script model, both returns same error

lzygenomics commented 1 year ago

@WeilerP Wow, thank you for your quick response! Yes, I run scvelo on the Windows machine, and I also try to run it on Linux, and this step return another bug: ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (4,) + inhomogeneous part.

I find that the new bug on linux has been reported before~I follow your suggestion and now scvelo works! : ) Thank you! (Maybe the original bug is indeed due to the tqdm on Windows)

lzygenomics commented 1 year ago

I downgrade the numpy to 1.23.5, and use Spyder instead of vscode in windows, the bug has been fixed, Thank you!