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

tutorial does not run -- version issues with scvi-tools #90

Closed
kiristern opened this issue Oct 24, 2023 · 5 comments
Closed

tutorial does not run -- version issues with scvi-tools #90

kiristern opened this issue Oct 24, 2023 · 5 comments

Comments

@kiristern
Copy link

Hello, I am trying to run the scgen_perturbation_prediction.ipynb tutorial but am having dependency issues, namely with scvi-tools.

I created a new conda env with the latest releases:
scgen 2.1.0
scvi-tools 1.0.4

When simply running the tutorial, on import scgen, I got:

from ._scgenvae import SCGENVAE
  File "~/miniconda3/envs/scgen/lib/python3.11/site-packages/scgen/_scgenvae.py", line 6, in <module>
    from scvi.module.base import BaseModuleClass, LossRecorder, auto_move_data
ImportError: cannot import name 'LossRecorder' from 'scvi.module.base'

It appears as if LossRecorder was renamed to LossOutput.
I simply changed LossRecorder to LossOutput but then kept getting new errors such as "Literal is deprecated, use typing instead" (again, just modified from typing import Literal), but then more errors... i ended up just restarting and installing pip install git+https://github.com/theislab/scgen.git development version, but now get the error:

scgen.SCGEN.setup_anndata(train_new, batch_key="condition", labels_key="cell_type")
"~/miniconda3/envs/scgen/lib/python3.11/site-packages/scvi/data/_utils.py", line 245, in _check_if_view
    raise ValueError("Please run `adata = adata.copy()`")
ValueError: Please run `adata = adata.copy()`

I was wondering what is the last stable versions to run the tutorial without having to manually go through all these errors? Thanks!

@kiristern kiristern changed the title version issues with scvi-tools tutorial does not run -- version issues with scvi-tools Oct 25, 2023
@kiristern
Copy link
Author

kiristern commented Oct 25, 2023

I tried running the same tutorial via Google Colab as well and have the same dependencies issues.

@matwasilewski
Copy link

Hi! This fork has resolved some of my issues, I hope it helps: https://github.com/szhorvat/scgen

@printfisnotgood
Copy link

I encountered this problem, too.

scgen.SCGEN.setup_anndata(train_new, batch_key="condition", labels_key="cell_type")
"~/miniconda3/envs/scgen/lib/python3.11/site-packages/scvi/data/_utils.py", line 245, in _check_if_view
    raise ValueError("Please run `adata = adata.copy()`")
ValueError: Please run `adata = adata.copy()`

I finally solved it by adding ".copy()" to "train_new = train[~((train.obs["cell_type"] == "CD4T") & (train.obs["condition"] == "stimulated"))]" at the end

@MEFarhadieh
Copy link

I resolved the issue with scgen by downgrading scvi-tools to version 0.17 and installing scgen with pip in Google Colab:

import sys
#if branch is stable, will install via pypi, else will install from source
branch = "stable"
IN_COLAB = "google.colab" in sys.modules

!pip install --quiet scvi-tools==0.17
!pip install --quiet scgen
if IN_COLAB and branch == "stable":
    !pip install --quiet scgen[tutorials]
elif IN_COLAB and branch != "stable":
    !pip install --quiet --upgrade jsonschema
    !pip install --quiet git+https://github.com/theislab/scgen@$branch#egg=scgen[tutorials]

@M0hammadL
Copy link
Member

@chelseabright96

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

5 participants