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

ModuleNotFoundError: No module named 'anndata.io' #261

Open
Hastikabirsamadi opened this issue Jan 23, 2025 · 8 comments
Open

ModuleNotFoundError: No module named 'anndata.io' #261

Hastikabirsamadi opened this issue Jan 23, 2025 · 8 comments

Comments

@Hastikabirsamadi
Copy link

Hello,
I've been trying to execute your Jupyter notebooks but i get error for importing "anndata.io".
I've already installed "anndata" package version 0.9.2, but it seems that this package doesn't contain anndata.io.
The error occurs like this:
import scarches as sca
from . import dataset, metrics, trainers, models, zenodo, plotting, utils, classifiers
from .trvae.trvae import trVAE
from .losses import mse, mmd, zinb, nb
from scvi.distributions import NegativeBinomial
from . import data, model, external, utils
from anndata.io import read_csv, read_loom, read_text
what can I do to resolve this problem?

@Koncopd
Copy link
Member

Koncopd commented Jan 23, 2025

Hello, where does this happen? Could you post the full traceback, the versions of anndata and scarches?

@Hastikabirsamadi
Copy link
Author

sure, here it is:

ModuleNotFoundError Traceback (most recent call last)
Cell In[7], line 3
1 import scanpy as sc
2 import torch
----> 3 import scarches as sca
4 import numpy as np
5 import gdown

File ~/miniconda3/envs/hasti_env/lib/python3.8/site-packages/scArches-0.6.1-py3.8.egg/scarches/init.py:1
----> 1 from . import dataset, metrics, trainers, models, zenodo, plotting, utils, classifiers
3 author = ', '.join([
4 'Mohammad Lotfollahi',
5 'Sergei Rybakov',
6 'Marco Wagenstetter',
7 'Mohsen Naghipourfar',
8 ])
10 email = ', '.join([
11 '[email protected]',
12 '[email protected]'
13 ])

File ~/miniconda3/envs/hasti_env/lib/python3.8/site-packages/scArches-0.6.1-py3.8.egg/scarches/models/init.py:1
----> 1 from .trvae.trvae import trVAE
2 from .trvae.trvae_model import TRVAE
3 from .trvae.adaptors import Adaptor, attach_adaptors

File ~/miniconda3/envs/hasti_env/lib/python3.8/site-packages/scArches-0.6.1-py3.8.egg/scarches/models/trvae/trvae.py:9
6 import torch.nn.functional as F
8 from .modules import Encoder, Decoder
----> 9 from .losses import mse, mmd, zinb, nb
10 from ._utils import one_hot_encoder
11 from ..base._base import CVAELatentsModelMixin

File ~/miniconda3/envs/hasti_env/lib/python3.8/site-packages/scArches-0.6.1-py3.8.egg/scarches/models/trvae/losses.py:1
----> 1 from scvi.distributions import NegativeBinomial
2 import torch
3 from torch.autograd import Variable

File ~/miniconda3/envs/hasti_env/lib/python3.8/site-packages/scvi_tools-1.2.2.post2-py3.8.egg/scvi/init.py:11
8 from ._settings import settings
10 # this import needs to come after prior imports to prevent circular import
---> 11 from . import data, model, external, utils
13 from importlib.metadata import version
15 package_name = "scvi-tools"

File ~/miniconda3/envs/hasti_env/lib/python3.8/site-packages/scvi_tools-1.2.2.post2-py3.8.egg/scvi/data/init.py:2
1 from anndata import read_h5ad
----> 2 from anndata.io import read_csv, read_loom, read_text
4 from ._anntorchdataset import AnnTorchDataset
5 from ._datasets import (
6 annotation_simulation,
7 brainlarge_dataset,
(...)
23 synthetic_iid,
24 )

ModuleNotFoundError: No module named 'anndata.io'

@Koncopd
Copy link
Member

Koncopd commented Jan 23, 2025

This looks like a problem with scvi-tools version that is incompatible with your anndata version.

@Hastikabirsamadi
Copy link
Author

which version should I use?

@Hastikabirsamadi
Copy link
Author

my scvi-tools version is 1.2.2.post2
and anndata version is 0.9.2

@Koncopd
Copy link
Member

Koncopd commented Jan 23, 2025

Your anndata version is pretty old, i believe you need to update it.

@Hastikabirsamadi
Copy link
Author

the problem is that pip and conda can only install this version for me. when I tried to install the latest version "0.11.3" using pip, i got an error. because pip couldn't find this version

@Koncopd
Copy link
Member

Koncopd commented Jan 24, 2025

you can do pip install --upgrade anndata

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

2 participants