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

Can't pyimport ssl #58

Closed
tbreloff opened this issue Nov 28, 2016 · 3 comments
Closed

Can't pyimport ssl #58

tbreloff opened this issue Nov 28, 2016 · 3 comments

Comments

@tbreloff
Copy link

I've traced an unrelated issue back to the ssl package. For some reason I can import ssl from the python executable in the Conda.jl directory, but it errors when I try to: using PyCall; pyimport("ssl")

Any ideas would be greatly appreciated! Here's the full output:

tom@tom-desktop:~/.julia/v0.5/Plots$ ~/.julia/v0.5/Conda/deps/usr/bin/python
Python 2.7.12 |Continuum Analytics, Inc.| (default, Jul  2 2016, 17:42:40) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import ssl
>>> 
KeyboardInterrupt
>>> 
tom@tom-desktop:~/.julia/v0.5/Plots$ julia
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.5.1-pre+27 (2016-11-04 08:41 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 25f7066 (24 days old release-0.5)
|__/                   |  x86_64-linux-gnu

julia> using PyCall; pyimport("ssl")
ERROR: PyError (:PyImport_ImportModule) <type 'exceptions.ImportError'>
ImportError('/home/tom/.julia/v0.5/Conda/deps/usr/lib/python2.7/lib-dynload/_ssl.so: undefined symbol: SSLv2_method',)
  File "/home/tom/.julia/v0.5/Conda/deps/usr/lib/python2.7/ssl.py", line 97, in <module>
    import _ssl             # if we can't import it, let the error propagate

 in pyerr_check at /home/tom/.julia/v0.5/PyCall/src/exception.jl:56 [inlined]
 in pyerr_check at /home/tom/.julia/v0.5/PyCall/src/exception.jl:61 [inlined]
 in macro expansion at /home/tom/.julia/v0.5/PyCall/src/exception.jl:81 [inlined]
 in pyimport(::String) at /home/tom/.julia/v0.5/PyCall/src/PyCall.jl:387

@isuruf
Copy link
Collaborator

isuruf commented Nov 29, 2016

This seems to be because when loading _ssl.so, it also tries to load ssl.so and it finds a system ssl version. Ubuntu seems to ship an ssl library with no SSLv2_method (http://stackoverflow.com/a/8219807/4768820)
Other distros might be doing the same.
I don't know how to fix this and load the ssl version shipped by python.

Workaround I found was to do,

Libdl.dlopen("/home/tom/.julia/v0.5/Conda/deps/usr/lib/python2.7/lib-dynload/../../libssl.so")
Libdl.dlopen("/home/tom/.julia/v0.5/Conda/deps/usr/lib/python2.7/lib-dynload/_ssl.so")
using PyCall; pyimport("ssl")

@isuruf
Copy link
Collaborator

isuruf commented Nov 29, 2016

Similar issue here, JuliaPy/PyCall.jl#65
Following also works

LD_PRELOAD=/home/tom/.julia/v0.5/Conda/deps/usr/lib/libssl.so  julia

@tbreloff
Copy link
Author

Thanks so much @isuruf! This got me past the ssl error. 👍

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