sales-lab / spatialDE

R wrapper for SpatialDE
Other
3 stars 3 forks source link

Python error #25

Closed Vivianstats closed 1 year ago

Vivianstats commented 1 year ago

Hello spatialDE package developer,

Thanks for developing this package for R users! I got the following error when first trying to run the stablize() function. Can you advise how to fix it?

/bigdata/operations/pkgadmin/opt/linux/centos/8.x/x86_64/pkgs/R/4.2.2/lib64/R/library/reticulate/python/rpytools/loader.py:39: FutureWarning: In the future np.bool will be defined as the corresponding NumPy scalar. (This may have returned Python scalars in past versions. module = _import( Error in py_module_import(module, convert = convert) : AttributeError: module 'numpy' has no attribute 'bool'

Below is my session info:

R version 4.2.2 (2022-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Rocky Linux 8.5 (Green Obsidian)

Matrix products: default
BLAS/LAPACK: /usr/lib64/libopenblas-r0.3.12.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.2.2
gbrsales commented 1 year ago

Hi,

The error you reported likely derives from an incompatible version of numpy being installed. I've now pinned a different version, which should solve the issue. Could you please test the new code by installing it from GitHub as follows?

remotes::install_github("sales-lab/spatialDE@fix_np_bool")
Vivianstats commented 1 year ago

Thanks for your quick response!

I tried to install this version from github but ran into a new problem.

First, I got the error below.

Installing package into ‘/rhome/weil/R/x86_64-pc-linux-gnu-library/4.2’ (as ‘lib’ is unspecified)

  • installing source package ‘spatialDE’ ... using non-staged installation via StagedInstall field R data inst ** byte-compile and prepare package for lazy loading Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : namespace ‘basilisk’ 1.8.1 is being loaded, but >= 1.9.10 is required Calls: ... namespaceImportFrom -> asNamespace -> loadNamespace Execution halted ERROR: lazy loading failed for package ‘spatialDE’
  • removing ‘/rhome/weil/R/x86_64-pc-linux-gnu-library/4.2/spatialDE’
  • restoring previous ‘/rhome/weil/R/x86_64-pc-linux-gnu-library/4.2/spatialDE’

I tried to install a newer version of basilisk and again encounter an error:

Bioconductor version 3.16 (BiocManager 1.30.19), R 4.2.2 (2022-10-31) Installing package(s) 'basilisk' trying URL 'https://bioconductor.org/packages/3.16/bioc/src/contrib/basilisk_1.10.2.tar.gz' Content type 'application/x-gzip' length 267414 bytes (261 KB)

downloaded 261 KB

  • installing source package ‘basilisk’ ... using non-staged installation via StagedInstall field R inst byte-compile and prepare package for lazy loading Error: object ‘getFallbackREnv’ is not exported by 'namespace:basilisk.utils' Execution halted ERROR: lazy loading failed for package ‘basilisk’
  • removing ‘/rhome/weil/R/x86_64-pc-linux-gnu-library/4.2/basilisk’
  • restoring previous ‘/rhome/weil/R/x86_64-pc-linux-gnu-library/4.2/basilisk’

I didn't find same problems online but here is another post reporting an issue related to basilisk and spatialDE. Any suggestions?

Vivianstats commented 1 year ago

Hello,

I tried to use the package on a different machine, and received a new but more interpretable error. Can this be addressed by changing the version of pandas?

  • '/Users/vivianli/Library/Caches/org.R-project.R/R/basilisk/1.10.2/0/bin/conda' 'install' '--yes' '--prefix' '/Users/vivianli/Library/Caches/org.R-project.R/R/basilisk/1.10.2/spatialDE/1.5.1/env' '-c' 'conda-forge' 'python=3.8.5' 'python=3.8.5' 'pandas=0.25.3' 'patsy=0.5.1' 'pip=21.0.1' Collecting package metadata (current_repodata.json): ...working... done Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve. Collecting package metadata (repodata.json): ...working... done Solving environment: ...working... failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  • pandas=0.25.3

Current channels:

To search for alternate channels that may provide the conda package you're looking for, navigate to

https://anaconda.org

and use the search bar at the top of the page.

Error: one or more Python packages failed to install [error code 1]

gbrsales commented 1 year ago

Hi,

Are you sure you're trying to install the version of spatialDE including the latest changes that I made? I'm asking because I saw in the output you posted the following list of packages:

'python=3.8.5' 'python=3.8.5' 'pandas=0.25.3' 'patsy=0.5.1' 'pip=21.0.1'

This is actually the list that I replaced, since it was likely the original cause of the issue.

Can you try to install spatialDE again on this second machine, using the following command?

remotes::install_github("sales-lab/spatialDE@fix_np_bool")

Vivianstats commented 1 year ago

I actually tried both and got the same error about not finding pandas.

gbrsales commented 1 year ago

Hi again,

I have created a Conda environment manually to mimick your setup. I've then added the Pandas version that got installed as a requirement to spatialDE. Can you please make another attempt?

remotes::install_github("sales-lab/spatialDE@fix_np_bool")

gbrsales commented 1 year ago

Hi @Vivianstats. I believe my last commit addressed the version mismatch with Pandas, but I would greatly appreciate it if you could confirm whether the issue has been resolved for you.

Vivianstats commented 1 year ago

Hello,

I tried again and the error relating to pandas was fixed, but there was another error about something else.

I have successfully installed and used this R package on my old laptop. However, I'm currently using a Mac with M1 chip, and I'm not sure whether/how this is related to some of the errors we've seen. I now decide to use the python version instead.

Thank you very much for all the help!