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

SSL errors when importing a python module in RStudio's ression #76

Closed
bhaskarvk opened this issue Jul 10, 2017 · 2 comments
Closed

SSL errors when importing a python module in RStudio's ression #76

bhaskarvk opened this issue Jul 10, 2017 · 2 comments

Comments

@bhaskarvk
Copy link
Contributor

OS : Linux Mint 18.1, a Ubuntu 16.04 derivative.

Python Distribution: Intel Python 3.5.3 (This is basically conda with python compiled using Intel MKL, otherwise identical in behavior to conda).

Python Library required to import: docker (https://docker-py.readthedocs.io/en/stable/)

I first created a conda env for docker

$> conda create -n docker python=3.5 numpy
Fetching package metadata ...........
Solving package specifications: .

Package plan for installation in environment /home/bhaskar/.conda/envs/docker:

The following NEW packages will be INSTALLED:

    mkl:        2017.0.3-0   
    numpy:      1.13.1-py35_0
    openssl:    1.0.2l-0     
    pip:        9.0.1-py35_1 
    python:     3.5.3-1      
    readline:   6.2-2        
    setuptools: 27.2.0-py35_0
    sqlite:     3.13.0-0     
    tk:         8.5.18-0     
    wheel:      0.29.0-py35_0
    xz:         5.2.2-1      
    zlib:       1.2.8-3      

$> source activate docker
$> pip install docker

Next test this out from command line

$> R
> library(reticulate)
> docker <- import("docker")

This works and I can now access the Python SDK from this point on wards , but when I do the R part in a Rstudio R session I get

docker <- import("docker")

I get ...

Error in py_module_import(module, convert = convert) : 
  AttributeError: module 'websocket._ssl_compat' has no attribute 'ssl'

The rstudio bin is started from the command-line after activating the conda environment. Here's the output of py_config()

python:         /home/bhaskar/.conda/envs/docker/bin/python
libpython:      /home/bhaskar/.conda/envs/docker/lib/libpython3.5m.so
pythonhome:     /home/bhaskar/.conda/envs/docker:/home/bhaskar/.conda/envs/docker
version:        3.5.3 |Intel Corporation| (default, Apr 27 2017, 18:08:47)  [GCC 4.8.2 20140120 (Red Hat 4.8.2-15)]
numpy:          /home/bhaskar/.conda/envs/docker/lib/python3.5/site-packages/numpy
numpy_version:  1.12.1
docker:         /home/bhaskar/.conda/envs/docker/lib/python3.5/site-packages/docker

python versions found: 
 /home/bhaskar/.conda/envs/docker/bin/python
 /usr/bin/python
 /usr/bin/python3

I even tried with use_condaenv("docker") but again no luck.

After this I also installed the 'websocket' python module, which I don't think is necessary but just to rule that possibility out

$> pip install websocket
$> r
> library(reticulate)
> c <- import("docker")

And this time I got a different error

docker <- import("docker")
Error in py_module_import(module, convert = convert) : 
  ImportError: /home/bhaskar/.conda/envs/docker2/lib/python3.5/lib-dynload/_ssl.cpython-35m-x86_64-linux-gnu.so: undefined symbol: SSLv2_method

FWIW I get no error when running the above from command line with or without 'websocket' being explicitly installed.

Obligatory sessionInfo()

sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 18.1

Matrix products: default
BLAS: /usr/lib/openblas-base/libblas.so.3
LAPACK: /usr/lib/libopenblasp-r0.2.18.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             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_0.9 magrittr_1.5  

loaded via a namespace (and not attached):
[1] compiler_3.4.1    clisymbols_1.2.0  tools_3.4.1       withr_1.0.2      
[5] yaml_2.1.14       Rcpp_0.12.11     
@bhaskarvk
Copy link
Contributor Author

This seems to be an issue with Intel Python distribution or just conda in general. I ran the same stuff with system python 3 + virtualenv and it works in both cases. So I am fine closing this issue unless someone wants to debug why the error in conda.

@jjallaire
Copy link
Member

Thanks for the report. Perhaps something to do with the LD_LIBRARY_PATH needing to have additional entries to accommodate the SSL linked to in the Intel Python distribution? You are correct that it's impossible for us to run all of these types of issues down as they are so often system-configuration specific.

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