theislab / zellkonverter

Conversion between scRNA-seq objects
https://theislab.github.io/zellkonverter/
Other
144 stars 27 forks source link

writeH5AD: Issue about arm64 (M1 macbook user) #85

Closed david-priest closed 1 year ago

david-priest commented 1 year ago

I get the following error after running writeH5AD?

Error in checkForRemoteErrors(lapply(cl, recvResult)) : 
one node produced an error: /Users/####/Library/Caches/org.R-project.R/R/basilisk/1.6.0/zellkonverter/1.4.0/zellkonverterAnnDataEnv/lib/libpython3.7m.dylib 
- dlopen(/Users/####/Library/Caches/org.R-project.R/R/basilisk/1.6.0/zellkonverter/1.4.0/zellkonverterAnnDataEnv/lib/libpython3.7m.dylib, 0x000A): 
tried: '/Users/####/Library/Caches/org.R-project.R/R/basilisk/1.6.0/zellkonverter/1.4.0/zellkonverterAnnDataEnv/lib/libpython3.7m.dylib' 
(mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))

I noticed this issue has come up before in different forms. Could you provide the commands to force zellkonverter to use the system install of Anaconda, which is arm64.

Here's a related error that arises when I try to mess around with things after asking ChatGPT

Error in .obtainEnvironmentPath(env) : 
environment 'zellkonverterAnnDataEnv-0.8.0' should have been created during 'zellkonverter' installation
lazappi commented 1 year ago

I think this may be more of a {basilisk} issue rather than coming directly from {zellkonverter}. I would suggest checking the {basilisk} issues to see if there is anything there but maybe @LTLA can help as well. It would be helpful for us to have the code you are running and the session information either way.

If you are comfortable managing your own Python environment and using {reticulate} you can use AnnData2SCE()/SCE2AnnData() directly which will use whatever environment {reticulate} finds rather than the special environments that are created.

LTLA commented 1 year ago

Latest release version of basilisk (1.10.2) should support downloading of M1 conda environments:

https://github.com/LTLA/basilisk.utils/blob/411502fabdca972bb10b4f12115b9f7bd5b05c5d/R/installConda.R#L126-L127

Looking at the paths in your error messages, your version is pretty old (1.6.0), so that would be why.

david-priest commented 1 year ago

When I delete /Users/####/Library/Caches/org.R-project.R/R/basilisk (which contains the old version 1.6.0) and run installConda(installed = TRUE), it seems to install basilisk 1.6.0 and Miniconda for x86 architecture. i.e. it gives this message during installation:

trying URL 'https://repo.anaconda.com/miniconda/Miniconda3-py37_4.8.3-MacOSX-x86_64.sh'
Content type 'application/x-sh' length 54829425 bytes (52.3 MB)

Regardless, after doing this and then running writeH5AD(), it goes through the process of installing the old version, before throwing the same initial error above.

I'm sorry that I don't understand it fully. I don't seem to be able to install the arm64 version of Basilisk (that contains it's own miniConda and Zellkonverter?).

LTLA commented 1 year ago

Basically, the installed version of basilisk is too old. Deleting the conda environment won't help, the old version of basilisk will continue to populate it with the non-Arm version.

You'll need an updated version of basilisk (1.10+, I believe); which technically requires an updated version of Bioconductor (to 3.16); which in turn possibly requires an updated version of R itself (4.2).

If you're unable to update R/Bioconductor, I suppose you could just try installing the latest basilisk and basilisk.utils from source, but there are no guarantees that'll work. I don't remember adding non-backwards-compatible things but I also don't remember deciding not to add them, and two releases ago is a long enough time for something to have changed through a deprecation cycle.

david-priest commented 1 year ago

Updating R worked! Running writeH5AD() for the first time installed basilisk 1.10, and then it worked. Thanks very much.