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

Initialization error on master branch #178

Closed
bermanmaxim opened this issue Aug 3, 2015 · 10 comments
Closed

Initialization error on master branch #178

bermanmaxim opened this issue Aug 3, 2015 · 10 comments

Comments

@bermanmaxim
Copy link

Using last Julia master 0.4.0-dev+6484 and last PyCall master, I have an error on initialization

   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.0-dev+6484 (2015-08-03 16:18 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit aff076d (0 days old master)
|__/                   |  x86_64-linux-gnu

julia> using PyCall
WARNING: could not import Base.help into PyCall
here
WARNING: error initializing module PyCall:
ReadOnlyMemoryError()

I have narrowed down the line sending responsible for this initialization warning to L.75 on pyinit.jl.

Interestingly, if one builds PyCall before using it, initialization works.

julia> Pkg.build("PyCall")
INFO: Building PyCall
INFO: PyCall is using python (Python 2.7.6) at /usr/bin/python, libpython = libpython2.7

julia> using PyCall
WARNING: could not import Base.help into PyCall

I believe the Base.help error is due to the transition of Julia to the new doc system...

@stevengj
Copy link
Member

stevengj commented Aug 4, 2015

The help thing is fixed in feb4e24.

@stevengj
Copy link
Member

stevengj commented Aug 4, 2015

I just pushed a patch that maybe will help with the readonlyerror; please try it (Pkg.checkout("PyCall"); Pkg.update())

@bermanmaxim
Copy link
Author

Thanks, the error is different now:

julia> using PyCall
WARNING: error initializing module PyCall:
PyCall.PyError(msg=":PyCapsule_Import", T=PyCall.PyObject(o=0x00007f452fe0a8a0), val=PyCall.PyObject(o=0x00007f452f667d88), traceback=PyCall.PyObject(o=0x0000000000000000))

and calling PyCall.__init__ again:

julia> PyCall.__init__()
WARNING: redefining constant inspect
WARNING: redefining constant builtin
WARNING: redefining constant BuiltinFunctionType
WARNING: redefining constant TypeType
WARNING: redefining constant MethodType
WARNING: redefining constant MethodWrapperType
WARNING: redefining constant ufuncType
WARNING: redefining constant format_traceback
WARNING: redefining constant jl_TextIO_methods
WARNING: redefining constant jl_IO_methods
WARNING: redefining constant jl_IO_getset
WARNING: redefining constant pyjlwrap_members
ERROR: PyError (:PyCapsule_Import) <type 'exceptions.ImportError'>
ImportError('PyCapsule_Import could not import module "datetime"',)

 in init_datetime at /home/maxim/.julia/v0.4/PyCall/src/pydates.jl:81
 in __init__ at /home/maxim/.julia/v0.4/PyCall/src/pyinit.jl:109

@stevengj
Copy link
Member

stevengj commented Aug 4, 2015

Can you import datetime.datetime_CAPI from Python?

@bermanmaxim
Copy link
Author

Yes, from datetime import datetime_CAPI gives no error in Python...

@swt30
Copy link

swt30 commented Aug 7, 2015

@bermanmaxim, what OS are you using?

@swt30
Copy link

swt30 commented Aug 10, 2015

I asked because I wondered if it could be something to do with the way the library was linked. You said it was okay after you rebuilt it, which made me think this was the same as #173. I had a similar error where a symbol wasn't being found in libpython and a package (ctypes) couldn't load, though it works in Python. Really, though, I'm in over my head here.

Anyway, I seem to be able to get things working again by putting Libdl.dlopen(libpython, Libdl.RTLD_LAZY|Libdl.RTLD_DEEPBIND|Libdl.RTLD_GLOBAL) at the top of __init__. Hope that's helpful for either you or @stevengj.

@hisham-assi
Copy link

Have the sane problem

@bermanmaxim
Copy link
Author

On last PyPlot master on a fresh julia master installation, I don't have any errors anymore... Sorry, I don't know what fixed it.

@stevengj
Copy link
Member

Closing since the OP can no longer reproduce.

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

Successfully merging a pull request may close this issue.

4 participants