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

Error in py_module_import(module, convert = convert) #46

Open
frenkiboy opened this issue Mar 17, 2021 · 5 comments
Open

Error in py_module_import(module, convert = convert) #46

frenkiboy opened this issue Mar 17, 2021 · 5 comments

Comments

@frenkiboy
Copy link

I am getting the following error messages when executing the example from the help file:

When I try to execute the function for the first time, the error is the following:

ImportError: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/user/.cache/basilisk/1.2.1/velociraptor-1.0.0/env/lib/python3.7/site-packages/pandas/_libs/window/aggregations.cpython-37m-x86_64-linux-gnu.so)

Detailed traceback:
  File "/home/user/R/x86_64-pc-linux-gnu-library/4.0/reticulate/python/rpytools/loader.py", line 24, in _import_hook
    level=level
  File "/home/user/.cache/basilisk/1.2.1/velociraptor-1.0.0/env/lib/python3.7/site-packages/anndata/__init__.py", line 1, in <module>
    from ._core.anndata import AnnData, ImplicitModificationWarning
  File "/home/user/R/x86_64-pc-linux-gnu-library/4.0/reticulate/python/rpytools/loader.py", line 24, in _import_hook
    level=level
  File "/home/user/.cache/basilisk/1.2.1/velociraptor-1.0.0/env/lib/python3.7/site-packages/anndata/_core/anndata.py", line 20, in <module>
    import pandas as pd
  File "/home/user/R/x86_64-pc-linux-gnu-library/4.0/reticulate/python/rpytools/load

When I execute the function subsequently:

Error in py_module_import(module, convert = convert) :
  AttributeError: module 'pandas' has no attribute 'plotting'

Detailed traceback:
  Error in py_module_import(module, convert = convert) :
  AttributeError: module 'pandas' has no attribute 'plotting'

Detailed traceback:
  File "/home/user/R/x86_64-pc-linux-gnu-library/4.0/reticulate/python/rpytools/loader.py", line 24, in _import_hook
    level=level
  File "/home/user/.cache/basilisk/1.2.1/velociraptor-1.0.0/env/lib/python3.7/site-packages/anndata/__init__.py", line 1, in <module>
    from ._core.anndata import AnnData, ImplicitModificationWarning
  File "/home/user/R/x86_64-pc-linux-gnu-library/4.0/reticulate/python/rpytools/loader.py", line 24, in _import_hook
    level=level
  File "/home/user/.cache/basilisk/1.2.1/velociraptor-1.0.0/env/lib/python3.7/site-packages/anndata/_core/anndata.py", line 20, in <module>
    import pandas as pd
  File "/home/user/R/x86_64-pc-linux-gnu-library/4.0/reticulate/python/rpytools/loader.py", line 24, in _import_hook
    level=level
  File "/home/user/.cache/basilisk/1.2.1/velociraptor-1.0.0/env/lib/python3.7/site-packages/pandas/__init__.py", line 52, in

session info:

R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS:   /opt/R-4.0.3/lib64/R/lib/libRblas.so
LAPACK: /opt/R-4.0.3/lib64/R/lib/libRlapack.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] parallel  stats4    stats     graphics  grDevices utils     datasets
[8] methods   base

other attached packages:
 [1] scuttle_1.0.0               velociraptor_1.0.0
 [3] scran_1.18.1                SingleCellExperiment_1.12.0
 [5] SummarizedExperiment_1.20.0 Biobase_2.50.0
 [7] GenomicRanges_1.42.0        GenomeInfoDb_1.26.0
 [9] IRanges_2.24.0              S4Vectors_0.28.0
[11] BiocGenerics_0.36.0         MatrixGenerics_1.2.0
[13] matrixStats_0.57.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.5                compiler_4.0.3
 [3] bluster_1.0.0             XVector_0.30.0
 [5] basilisk.utils_1.2.2      bitops_1.0-6
 [7] BiocNeighbors_1.8.1       tools_4.0.3
 [9] DelayedMatrixStats_1.12.0 zlibbioc_1.36.0
[11] statmod_1.4.35            jsonlite_1.7.1
[13] lattice_0.20-41           pkgconfig_2.0.3
[15] Matrix_1.2-18             igraph_1.2.6
[17] DelayedArray_0.16.0       filelock_1.0.2
[19] GenomeInfoDbData_1.2.4    zellkonverter_1.0.3
[21] rappdirs_0.3.1            locfit_1.5-9.4
[23] grid_4.0.3                reticulate_1.18
[25] basilisk_1.2.1            BiocParallel_1.24.1
[27] limma_3.46.0              irlba_2.3.3
[29] BiocSingular_1.6.0        magrittr_2.0.1
[31] edgeR_3.32.0              sparseMatrixStats_1.2.0
[33] beachmat_2.6.1            rsvd_1.0.3
[35] dqrng_0.2.1               RCurl_1.98-1.2

I've tried setting the conda environment by hand, and pointing using environment variables, but it didn't help.

Any help would be appreciated.

@LTLA
Copy link
Collaborator

LTLA commented Mar 18, 2021

I am bemused. Never seen this one before.

Try to figure out if it's a Conda problem, a reticulate problem or a basilisk problem.

Is it a Conda problem?

Try doing this in the shell:

. ~/.cache/basilisk/1.2.1/0/etc/profile.d/conda.sh
conda activate ~/.cache/basilisk/1.2.1/velociraptor-1.0.0/env/bin/python
python 

Which should open up Conda's copy of Python, and then

import scvelo

Is it a reticulate problem?

Does this work?

library(reticulate)
use_condaenv(path.expand("~/.cache/basilisk/1.2.1/velociraptor-1.0.0/env"), required=TRUE)
import("scvelo")

Is it a basilisk problem?

Does this work?

library(basilisk)
useBasiliskEnv(path.expand("~/.cache/basilisk/1.2.1/velociraptor-1.0.0/env"))

@frenkiboy
Copy link
Author

Dear Aaron,

Seems it's reticulate:

import("scvelo")
Error in py_module_import(module, convert = convert) :
  ImportError: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /home/vfranke/.cache/basilisk/1.2.1/velociraptor-1.0.0/env/lib/python3.7/site-packages/matplotlib/ft2font.cpython-37m-x86_64-linux-gnu.so)

Detailed traceback:
  File "/home/vfranke/R/x86_64-pc-linux-gnu-library/4.0/reticulate/python/rpytools/loader.py", line 24, in _import_hook
    level=level
  File "/home/vfranke/.cache/basilisk/1.2.1/velociraptor-1.0.0/env/lib/python3.7/site-packages/scvelo/__init__.py", line 16, in <module>
    from .read_load import AnnData, read, read_loom, load, read_csv, get_df, DataFrame
  File "/home/vfranke/R/x86_64-pc-linux-gnu-library/4.0/reticulate/python/rpytools/loader.py", line 24, in _import_hook
    level=level
  File "/home/vfranke/.cache/basilisk/1.2.1/velociraptor-1.0.0/env/lib/python3.7/site-packages/scvelo/read_load.py", line 1, in <module>
    from . import logging as logg
  File "/home/vfranke/R/x86_64-pc-linux-gnu-library/4.0/reticulate/python/rpytoo

All other steps do not trigger an error.

Best,

@LTLA
Copy link
Collaborator

LTLA commented Mar 19, 2021

I would suggest creating a simple reproducible example that you can post on the reticulate repository.

  1. Install Conda at https://repo.anaconda.com/miniconda/Miniconda3-py37_4.8.3-Linux-x86_64.sh

  2. Use reticulate to create a Conda environment containing the problematic packages, via:

    library(reticulate)
    conda_create("test", conda=path_to_conda)
    conda_install("test", c("pandas", "matplotlib"), conda=path_to_conda)

    Replacing path_to_conda with wherever your conda installation landed (something like <installation>/bin/conda).

  3. Try to load that environment.

    use_condaenv("test", required=TRUE)
    import("pandas")

    If it truly is a problem with reticulate, then the above should fail.

  4. As a positive control, try to do the same in the shell using the steps similar to that posted in my first response.

Just make sure you're using the latest version of reticulate.

@shijianasdf
Copy link

I am bemused. Never seen this one before.

Try to figure out if it's a Conda problem, a reticulate problem or a basilisk problem.

Is it a Conda problem?

Try doing this in the shell:

. ~/.cache/basilisk/1.2.1/0/etc/profile.d/conda.sh
conda activate ~/.cache/basilisk/1.2.1/velociraptor-1.0.0/env/bin/python
python 

Which should open up Conda's copy of Python, and then

import scvelo

Is it a reticulate problem?

Does this work?

library(reticulate)
use_condaenv(path.expand("~/.cache/basilisk/1.2.1/velociraptor-1.0.0/env"), required=TRUE)
import("scvelo")

Is it a basilisk problem?

Does this work?

library(basilisk)
useBasiliskEnv(path.expand("~/.cache/basilisk/1.2.1/velociraptor-1.0.0/env"))

I have the same problem. my conda was wrong

$ conda activate ~/.cache/basilisk/1.2.1/velociraptor-1.0.0/env/bin/python

I got the following error

Not a conda environment: /home/shijian/.cache/basilisk/1.2.1/velociraptor-1.0.0/env/bin/python

@kevinrue
Copy link
Owner

@shijianasdf

Try this instead (stop the path at "env", i.e. remove the final "bin/python")

conda activate ~/.cache/basilisk/1.2.1/velociraptor-1.0.0/env

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants