Skip to content

reticulate::import() gives error where direct python repl works fine #611

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

Closed
leungi opened this issue Oct 17, 2019 · 2 comments
Closed

reticulate::import() gives error where direct python repl works fine #611

leungi opened this issue Oct 17, 2019 · 2 comments

Comments

@leungi
Copy link

leungi commented Oct 17, 2019

Issue, system and session info below.

Tried it with Python 3.5, 3.6 and 2.7, with same outcome.

Issue

[leungi@ohylpyt1-d /bin]$ R

R version 3.6.0 (2019-04-26) -- "Planting of a Tree"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-redhat-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> reticulate::use_python("/home/leungi/miniconda3/envs/stooip-27/bin")
> reticulate::py_config()
python:         /home/leungi/miniconda3/envs/stooip-27/bin/python
libpython:      /home/leungi/miniconda3/envs/stooip-27/lib/libpython2.7.so
pythonhome:     /home/leungi/miniconda3/envs/stooip-27:/home/leungi/miniconda3/envs/stooip-27
version:        2.7.16 |Anaconda, Inc.| (default, Sep 24 2019, 21:51:30)  [GCC 7.3.0]
numpy:          /home/leungi/miniconda3/envs/stooip-27/lib/python2.7/site-packages/numpy
numpy_version:  1.16.5

python versions found:
 /home/leungi/miniconda3/envs/stooip-27/bin/python
 /bin/python
 /usr/bin/python
 /home/leungi/miniconda3/envs/py35/bin/python
 /home/leungi/miniconda3/envs/py36/bin/python
 /home/leungi/miniconda3/envs/stooip/bin/python
 /home/leungi/miniconda3/envs/stooip-36/bin/python
 /home/leungi/miniconda3/bin/python
> pd = reticulate::import("pandas")
Error in py_module_import(module, convert = convert) :
  ImportError: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/leungi/miniconda3/envs/stooip-27/lib/python2.7/site-packages/pandas/_libs/window.so)

Detailed traceback:
  File "/home/leungi/miniconda3/envs/stooip-27/lib/python2.7/site-packages/pandas/__init__.py", line 42, in <module>
    from pandas.core.api import *
  File "/home/leungi/miniconda3/envs/stooip-27/lib/python2.7/site-packages/pandas/core/api.py", line 26, in <module>
    from pandas.core.groupby import Grouper
  File "/home/leungi/miniconda3/envs/stooip-27/lib/python2.7/site-packages/pandas/core/groupby/__init__.py", line 1, in <module>
    from pandas.core.groupby.groupby import GroupBy  # noqa: F401
  File "/home/leungi/miniconda3/envs/stooip-27/lib/python2.7/site-packages/pandas/core/groupby/groupby.py", line 37, in <module>
    from pandas.core.frame import DataFrame
  File "/home/leungi/miniconda3/envs/stooip-27/lib/python2.7/site-packages/pandas/core/frame.py", line 100, in <m
> q()
Save workspace image? [y/n/c]: n
[leungi@ohylpyt1-d /bin]$ bash
(base) bash-4.2$ conda activate stooip-27
(stooip-27) bash-4.2$ python
Python 2.7.16 |Anaconda, Inc.| (default, Sep 24 2019, 21:51:30)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
>>>

System Info

[leungi@ohylpyt1-d /bin]$ uname -a
Linux ohylpyt1-d 3.10.0-514.6.1.el7.x86_64 #1 SMP Sat Dec 10 11:15:38 EST 2016 x86_64 x86_64 x86_64 GNU/Linux

Session Info

> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.3 (Maipo)

Matrix products: default
BLAS/LAPACK: /usr/lib64/R/lib/libRblas.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

other attached packages:
[1] reticulate_1.12

loaded via a namespace (and not attached):
[1] compiler_3.6.0  Matrix_1.2-17   Rcpp_1.0.1      grid_3.6.0
[5] jsonlite_1.6    lattice_0.20-38
@kevinushey
Copy link
Collaborator

  ImportError: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /home/leungi/miniconda3/envs/stooip-27/lib/python2.7/site-packages/pandas/_libs/window.so)

You likely need to configure your environment so that the version of the libstdc++ standard library bundled with Anaconda is loaded, rather than the default one on your system.

@leungi
Copy link
Author

leungi commented Oct 20, 2019

@kevinushey: thanks for prompt response and tip 😄

For future reference, followed this github issue and solved it.

@leungi leungi closed this as completed Oct 20, 2019
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

2 participants