theislab / scgen

Single cell perturbation prediction
https://scgen.readthedocs.io
GNU General Public License v3.0
255 stars 51 forks source link

DeprecationWarning as error when importing scgen #76

Closed mumichae closed 1 year ago

mumichae commented 1 year ago

I have installed scgen, but am getting the following as an error:

  File "/hpc/projects/data_lg/michaela.mueller/workspace/hca_pipelines/.snakemake/scripts/tmp0wp72ut2.scgen.py", line 7, in <module>
    import scgen
  File "/hpc/projects/data_lg/michaela.mueller/workspace/hca_pipelines/.snakemake/conda/a801a19208bb963253e51e9f2f96478b_/lib/python3.9/site-packages/scgen/__init__.py", line 3, in <module>
    from ._scgenvae import SCGENVAE
  File "/hpc/projects/data_lg/michaela.mueller/workspace/hca_pipelines/.snakemake/conda/a801a19208bb963253e51e9f2f96478b_/lib/python3.9/site-packages/scgen/_scgenvae.py", line 4, in <module>
    from scvi._compat import Literal
  File "/hpc/projects/data_lg/michaela.mueller/workspace/hca_pipelines/.snakemake/conda/a801a19208bb963253e51e9f2f96478b_/lib/python3.9/site-packages/scvi/_compat.py", line 1, in <module>
    class Literal:
  File "/hpc/projects/data_lg/michaela.mueller/workspace/hca_pipelines/.snakemake/conda/a801a19208bb963253e51e9f2f96478b_/lib/python3.9/site-packages/scvi/_compat.py", line 4, in Literal
    raise DeprecationWarning("This class is deprecated, please import from typing")

I have scvi-tools 20.0 installed and am still getting the warning, even when I deactivate warnings.

M0hammadL commented 1 year ago

This seems to be a sci-tools issue @adamgayoso. Do you have any suggestions?

mumichae commented 1 year ago

I managed to fix this issue by downgradings scvi-tools (I randomly chose 0.17). Would be good though to check for consistency, since the optional scvi-tools dependency is set to 0.20.0 or larger https://github.com/theislab/scgen/blob/69124b7fb83921be5acca1962d0529a1573a8549/pyproject.toml#L56

mumichae commented 1 year ago

This is also causing errors on CI and when building the documentation: https://readthedocs.org/projects/scgen/builds/19486185/

adamgayoso commented 1 year ago

It's fixed here https://github.com/theislab/scgen/commit/3cb40806bfb70d36399f710d4f2cc82e4375872b

adamgayoso commented 1 year ago

everything is fixed now!

lmp1210-uoft commented 1 year ago

Hi, I installed scvi-tools and scgen today and still get this error when importing scgen. It seems the issue is not solved when installing scgen using pip.

quentinblampey commented 1 year ago

@lmp1210-uoft indeed, I think that the changes have not been released yet, so you have to use pip install git+https://github.com/theislab/scgen.git