Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error occurred when importing scvelo. TypeError: 'ABCMeta' object is not subscriptable #1292

Open
18520964064 opened this issue Jan 11, 2025 · 2 comments

Comments

@18520964064
Copy link

To conduct RNA velocity analysis, I need to download the scvelo package for Python. However, due to insufficient local computer memory, I rented a shared server and attempted to download the scvelo package using Python 3 in Jupyterlab on the shared server. After the download was completed, I encountered frequent errors when importing it. I have no idea how to solve this problem. If I create a new virtual environment on my local computer, I can successfully download and import the scvelo package. But on the shared server, I don't have the permission to create the required virtual environment, so I'm at a loss. Can anyone help me?

The error-reporting code is as follows:

TypeError Traceback (most recent call last)
Cell In[2], line 1
----> 1 import scvelo
2 print(scvelo.version)

File ~/.local/lib/python3.8/site-packages/scvelo/init.py:4
1 """scvelo - RNA velocity generalized through dynamical modeling."""
2 from anndata import AnnData
----> 4 from scvelo import datasets, logging
5 from scvelo import plotting as pl
6 from scvelo import preprocessing as pp

File ~/.local/lib/python3.8/site-packages/scvelo/datasets/init.py:1
----> 1 from ._datasets import (
2 bonemarrow,
3 dentategyrus,
4 dentategyrus_lamanno,
5 forebrain,
6 gastrulation,
7 gastrulation_e75,
8 gastrulation_erythroid,
9 pancreas,
10 pbmc68k,
11 toy_data,
12 )
13 from ._simulate import simulation
15 all = [
16 "bonemarrow",
17 "dentategyrus",
(...)
26 "toy_data",
27 ]

File ~/.local/lib/python3.8/site-packages/scvelo/datasets/_datasets.py:9
5 import pandas as pd
7 from scanpy import read
----> 9 from scvelo.core import cleanup
10 from scvelo.read_load import load
12 url_datadir = "https://github.com/theislab/scvelo_notebooks/raw/master/"

File ~/.local/lib/python3.8/site-packages/scvelo/core/init.py:1
----> 1 from ._anndata import (
2 clean_obs_names,
3 cleanup,
4 get_df,
5 get_initial_size,
6 get_modality,
7 get_size,
8 make_dense,
9 make_sparse,
10 merge,
11 set_initial_size,
12 set_modality,
13 show_proportions,
14 )
15 from ._arithmetic import clipped_log, invert, multiply, prod_sum, sum
16 from ._linear_models import LinearRegression

File ~/.local/lib/python3.8/site-packages/scvelo/core/_anndata.py:14
10 from scipy.sparse import csr_matrix, issparse, spmatrix
12 from anndata import AnnData
---> 14 from scvelo import logging as logg
15 from ._arithmetic import sum
16 from ._utils import deprecated_arg_names

File ~/.local/lib/python3.8/site-packages/scvelo/logging/init.py:1
----> 1 from ._logging import (
2 error,
3 hint,
4 info,
5 msg,
6 print_version,
7 ProgressReporter,
8 switch_verbosity,
9 warn,
10 )
12 all = [
13 "error",
14 "hint",
(...)
20 "warn",
21 ]

File ~/.local/lib/python3.8/site-packages/scvelo/logging/_logging.py:211
207 _DEPENDENCIES_PLOTTING = ["matplotlib"]
210 # Adapted from https://github.com/theislab/cellrank/blob/main/src/cellrank/logging/_logging.py#L98-L128
--> 211 def _versions_dependencies(dependencies: Iterable[str]):
212 # this is not the same as the requirements!
213 for mod in dependencies:
214 mod_name, dist_name = mod if isinstance(mod, tuple) else (mod, mod)

TypeError: 'ABCMeta' object is not subscriptable

@hanshanmengqi
Copy link

Hello @18520964064,

I think this problem is related to the Python version.

For me, I solved it by switching from Python 3.8 to Python 3.6.

Hope this helps.

Han

@Caizhengwen123
Copy link

if your python version <3.9, then you can try replace "from collections.abc import Iterable" in /scvelo/logging/_logging.py with "from typing import Iterable".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants