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

RuntimeError when using cell2location on MacOS (M1) #206

Closed
sarahshuang opened this issue Oct 11, 2022 · 11 comments
Closed

RuntimeError when using cell2location on MacOS (M1) #206

sarahshuang opened this issue Oct 11, 2022 · 11 comments
Labels
bug Something isn't working

Comments

@sarahshuang
Copy link

sarahshuang commented Oct 11, 2022

Hi,

I follow the instructions from the [scvi-tools tutorial || Quick START TUTORIAL || Mapping human lymph node cell types to 10X Visium with Cell2location] and download all required package of cell2location successfully. (https://cell2location.readthedocs.io/en/latest/notebooks/cell2location_tutorial.html)


###PROBLEM

However, I encountered the following error when running the code on Python.

RuntimeError: This version of jaxlib was built using AVX instructions, which your CPU and/or operating system do not support. You may be able work around this issue by building jaxlib from source. 

it happened when reading

import jax

### MY THINKING

I guess that it occurred because of M1, I tried installing jaxlib from source by the following link,
(https://jax.readthedocs.io/en/latest/developer.html#building-from-source) , but failed. I am struggling for the issue and want to find an effective way to tackle with the problem.

do you have encountered such an issue? could you please give me some suggestions?

Await your reply appreciatively!! Thanks a lot!!

@sarahshuang sarahshuang added the bug Something isn't working label Oct 11, 2022
@sarahshuang
Copy link
Author

sarahshuang commented Oct 13, 2022

I try to install cell2location on Linux now, but I encounter a new error

INFO: pip is looking at multiple versions of cell2location[tutorials] to determine which version is compatible with other requirements. This could take a while.
ERROR: Cannot install cell2location because these package versions have conflicting dependencies.

The conflict is caused by:
    scvi-tools 0.18.0 depends on jaxlib
    scvi-tools 0.17.4 depends on jaxlib

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

I find that some people discuss about it in #160, and follow the suggestion to install and update scvi-tools. Unfortunately, the same error occurs.

do u know what's wrong about it?

Thanks a lot!!

@vitkl
Copy link
Contributor

vitkl commented Oct 13, 2022

Hi @sarahshuang

This seems to be a general scvi-tools issue, please check https://discourse.scverse.org/

Maybe @adamgayoso can give a general recommendation of what to do about scvi-tools installation issues due to jaxlib.

Cell2location doesn't use jax - so it is not ideal that this comes up as a common issue.

@adamgayoso
Copy link
Contributor

adamgayoso commented Oct 14, 2022

The issue is likely related to using a version of python that is being interpreted via rosetta istead of a native M1 version of python. Cell2location will only work in the latter case (e.g., download an m1 version of homebrew, use that to install miniforge and then use conda to install scvi-tools, and then pip install cell2location)

@sarahshuang
Copy link
Author

Thanks for both of your suggestions, I will try again. Many thanks.

@sarahshuang
Copy link
Author

Hi, @vitkl and @adamgayoso

I follow the instruction(download an m1 version of homebrew, use that to install miniforge and then use conda to install scvi-tools, and then pip install cell2location).
However, a new error occurs when running pip install cell2location-master.zip

  Installing build dependencies ... error
  error: subprocess-exited-with-error
  
  × pip subprocess to install build dependencies did not run successfully.
 

@adamgayoso
Copy link
Contributor

Does importing scvi work in the environment?

Can you try pip install git+https://github.com/BayraktarLab/cell2location.git#egg=cell2location[tutorials]?

@sarahshuang
Copy link
Author

sarahshuang commented Oct 14, 2022

@adamgayoso , thanks for your reply. Actually I tried pip install git+https://github.com/BayraktarLab/cell2location.git#egg=cell2location[tutorials] and errors occurred as I have mentioned 3 days ago. However, I fail to run the code at present, that is why I change to run pip install cell2location-master.zip. I am in a mess now.

zsh: no matches found: git+https://github.com/BayraktarLab/cell2location.git#egg=cell2location[tutorials]

Maybe I will try it on Linux. Actually, I tried it yesterday, but Cannot install cell2location because these package versions have conflicting dependencies.

The conflict is caused by:
    scvi-tools 0.18.0 depends on jaxlib
    scvi-tools 0.17.4 depends on jaxlib

What is your recommendation about this error? The similar solution as you have mentioned early on M1?

@adamgayoso
Copy link
Contributor

Are you using virtual environments? Or conda environments? It's hard for me to diagnose without fully understanding how Python is installed. I can say for certain you can run pretty large analyses with cell2location on google colab where installation is not an issue

@sarahshuang
Copy link
Author

sarahshuang commented Oct 14, 2022

Conda environments for M1. Okay, I think I will try it on M1 again.

I download homebrew for M1 via

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)

and the version is

Homebrew 3.6.5-22-g77311e4
Homebrew/homebrew-core (git revision a8dd80d1ecf; last commit 2022-10-13)
Homebrew/homebrew-cask (git revision 05c288e24e; last commit 2022-10-14)

Then I download Miniforge3-MacOSX-arm64 from https://github.com/conda-forge/miniforge

Next, I run conda install scvi-tools -c conda-forge, and follow the installation from https://github.com/BayraktarLab/cell2location, and the error occurs when running pip install cell2location

@sarahshuang
Copy link
Author

Hi @adamgayoso ,
The problem is solved now, because I realize I didn't install scvi-tools in the proper environment. Thanks a lot!!

@simonmfr
Copy link

I could solve the same error in Linux by reinstalling jax as described here: https://stackoverflow.com/a/71038502

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants