theislab / scib

Benchmarking analysis of data integration tools
MIT License
294 stars 63 forks source link

Not really able to import scib #353

Closed das2000sidd closed 1 year ago

das2000sidd commented 1 year ago

Hi,

I am not able to import scib. I get the following error trace:


OSError Traceback (most recent call last) Cell In[5], line 8 6 import scanpy as sc 7 import scvi ----> 8 import scib ## causing issues

File ~/anaconda3/envs/py310/lib/python3.10/site-packages/scib/init.py:8 4 import importlib_metadata as metadata 6 version = metadata.version("scib") ----> 8 from . import integration, metrics, preprocessing, utils 9 from ._package_tools import rename_func 10 from .metrics import clustering

File ~/anaconda3/envs/py310/lib/python3.10/site-packages/scib/integration.py:6 3 import tempfile 5 import numpy as np ----> 6 import rpy2.rinterface_lib.callbacks 7 import scanpy as sc 8 import scipy as sp

File ~/anaconda3/envs/py310/lib/python3.10/site-packages/rpy2/rinterface_lib/callbacks.py:11 9 import typing 10 import os ---> 11 from rpy2.rinterface_lib import openrlib 12 from rpy2.rinterface_lib import ffi_proxy 13 from rpy2.rinterface_lib import conversion

File ~/anaconda3/envs/py310/lib/python3.10/site-packages/rpy2/rinterface_lib/openrlib.py:54 52 rlib = _rinterface_cffi.lib 53 else: ---> 54 rlib = _dlopen_rlib(R_HOME) 57 # R macros and functions 58 def _get_symbol_or_fallback(symbol: str, fallback: typing.Any):

File ~/anaconda3/envs/py310/lib/python3.10/site-packages/rpy2/rinterface_lib/openrlib.py:47, in _dlopen_rlib(r_home) 45 raise ValueError('The library path cannot be None.') 46 else: ---> 47 rlib = ffi.dlopen(lib_path) 48 return rlib

OSError: cannot load library '/Library/Frameworks/R.framework/Resources/lib/libR.dylib': dlopen(/Library/Frameworks/R.framework/Resources/lib/libR.dylib, 0x0002): tried: '/Library/Frameworks/R.framework/Resources/lib/libR.dylib' (mach-o file, but is an incompatible architecture (have (arm64), need (x86_64))), '/Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libR.dylib' (mach-o file, but is an incompatible architecture (have (arm64), need (x86_64)))

I am running it on a Mac OS Monterey OS running on an M1 chip. Any suggestions would be highly helpful.

Thanks!

mumichae commented 1 year ago

Hi, which version are you using? It seems that python is having trouble finding an R installation, since rpy2 is a dependency for scib. In the upcoming version 1.0.5, rpy2 will be an optional dependency, so you should be able to import the package without having R installed. This also means that you won't be able to run R methods (e.g. kBET) unless you install R and rpy2.

das2000sidd commented 1 year ago

I am using version 1.0.4. Thanks about the suggestion of python having trouble finding R. I will look into it.