BayraktarLab / cell2location

Comprehensive mapping of tissue cell architecture via integrated single cell and spatial transcriptomics (cell2location model)
https://cell2location.readthedocs.io/en/latest/
Apache License 2.0
324 stars 58 forks source link

Issue Importing Cell2Location - Completely Clean Env #129

Closed pranzatelli closed 2 years ago

pranzatelli commented 2 years ago

Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Minimal code sample (that we can run without your data, using public data)

import cell2location
ImportError: cannot import name '_CONSTANTS' from 'scvi' (/~/conda/envs/cell2loc39/lib/python3.9/site-packages/scvi/__init__.py)

Created a brand-new conda env called cell2loc39, did nothing other than "pip install cell2location" and tried to import cell2location. Immediately ran into a problem importing scvi. I didn't find a similar problem in the current issues.

adamgayoso commented 2 years ago

This is due to a new release on the scvi-tools side while cell2location needs to make a release to reflect our changes. For now you can first install pip3 install scvi-tools==0.14.5 and then install cell2location

pranzatelli commented 2 years ago

So I did this and am now getting a different ImportError: ImportError: cannot import name '_deep_getattr' from 'pyro.infer.autoguide.guides' (/conda/envs/py39c2l/lib/python3.9/site-packages/pyro/infer/autoguide/guides.py) Is there a different version of pyro I should install? Is there a list of all version controls necessary or a Docker container I should be using?

vitkl commented 2 years ago

Hi @pranzatelli

Sorry for the delayed response. Are you installing from the GitHub master branch or from pypi? pip install git+https://github.com/BayraktarLab/cell2location.git#egg=cell2location[tutorials] or pip install cell2location

Only installation from GitHub is valid at the moment. I see that GitHub tests pass https://github.com/BayraktarLab/cell2location/runs/5504910077?check_suite_focus=true today so installation from GitHub master branch should work.

Could it be that you have an issue with PYTHONNOUSERSITE on your system?

pranzatelli commented 2 years ago

Alright so after some testing, I can confirm that making a new environment and doing nothing more than pip install git+https://github.com/BayraktarLab/cell2location.git#egg=cell2location[tutorials] works perfectly and my problem has been solved. Thank you both for all your help.