juliapy / pycalljld.jl Goto Github PK
View Code? Open in Web Editor NEWJLD support for PyCall objects
License: Other
JLD support for PyCall objects
License: Other
I'm having a similar issue to #18 while saving PyObject
arrays. I have seen that in that issue they mention than deleting the environment solved it. I would very much like to avoid that, since messing with conda environments is always dangerous.
I'm just doing:
JLD.save(joinpath(ODINN.root_dir, "test/data/gdirs.jld"), "gdirs", gdirs)
Is this normal? What is the issue here?
Hello, I cannot precompile the module when using python 3.6 because it cannot found the cPickle
module.
Here is the error code:
ERROR: LoadError: InitError: PyError (ccall(@pysym(:PyImport_ImportModule), PyPtr, (Cstring,), name)) <class 'ModuleNotFoundError'>
ModuleNotFoundError("No module named 'cPickle'",)
Stacktrace:
[1] pyerr_check at /home/gluon/.julia/v0.6/PyCall/src/exception.jl:56 [inlined]
[2] pyerr_check at /home/gluon/.julia/v0.6/PyCall/src/exception.jl:61 [inlined]
[3] macro expansion at /home/gluon/.julia/v0.6/PyCall/src/exception.jl:81 [inlined]
[4] pyimport(::String) at /home/gluon/.julia/v0.6/PyCall/src/PyCall.jl:374
[5] __init__() at /home/gluon/.julia/v0.6/PyCallJLD/src/PyCallJLD.jl:11
[6] _include_from_serialized(::String) at ./loading.jl:157
[7] _require_from_serialized(::Int64, ::Symbol, ::String, ::Bool) at ./loading.jl:200
[8] _require_search_from_serialized(::Int64, ::Symbol, ::String, ::Bool) at ./loading.jl:236
[9] _require(::Symbol) at ./loading.jl:441
[10] require(::Symbol) at ./loading.jl:405
[11] include_from_node1(::String) at ./loading.jl:576
[12] include(::String) at ./sysimg.jl:14
[13] anonymous at ./<missing>:2
during initialization of module PyCallJLD
I have searched across the internet and found that for python 3.x one has to import pickle
and it will fall down to cPickle
when possible.
Indeed changing the import function in PyCallJLD.jl
to pickle
allows to compile probably. Any Chance to have it in the version installed by Pkg
?
┌ Warning: JLD incorrectly extends FileIO functions (see FileIO documentation)
└ @ FileIO ~/.julia/packages/FileIO/u9YLx/src/loadsave.jl:217
Error encountered while save File{DataFormat{:JLD}, String}("saved_file.jld").
Fatal error:
ERROR: LoadError: type DataType has no field mutable
Stacktrace:
[1] getproperty
@ ./Base.jl:37 [inlined]
[2] write_ref(parent::JLD.JldFile, data::Vector{UInt8}, wsession::JLD.JldWriteSession)
@ JLD ~/.julia/packages/JLD/jeGJb/src/JLD.jl:673
[3] macro expansion
@ ~/.julia/packages/JLD/jeGJb/src/jld_types.jl:639 [inlined]
[4] h5convert!(out::Ptr{UInt8}, file::JLD.JldFile, x::PyCallJLD.PyObjectSerialization, wsession::JLD.JldWriteSession)
@ JLD ~/.julia/packages/JLD/jeGJb/src/jld_types.jl:654
[5] write_compound(parent::JLD.JldFile, name::String, s::PyCallJLD.PyObjectSerialization, wsession::JLD.JldWriteSession; kargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ JLD ~/.julia/packages/JLD/jeGJb/src/JLD.jl:710
[6] write_compound
@ ~/.julia/packages/JLD/jeGJb/src/JLD.jl:704 [inlined]
[7] #_write#23
@ ~/.julia/packages/JLD/jeGJb/src/JLD.jl:700 [inlined]
[8] _write
@ ~/.julia/packages/JLD/jeGJb/src/JLD.jl:700 [inlined]
[9] #write#17
@ ~/.julia/packages/JLD/jeGJb/src/JLD.jl:524 [inlined]
[10] write
@ ~/.julia/packages/JLD/jeGJb/src/JLD.jl:524 [inlined]
[11] (::JLD.var"#41#42"{String, PyObject, Tuple{}})(file::JLD.JldFile)
@ JLD ~/.julia/packages/JLD/jeGJb/src/JLD.jl:1235
[12] jldopen(::JLD.var"#41#42"{String, PyObject, Tuple{}}, ::String, ::Vararg{String}; kws::Base.Pairs{Symbol, Bool, Tuple{Symbol, Symbol}, NamedTuple{(:compatible, :compress), Tuple{Bool, Bool}}})
@ JLD ~/.julia/packages/JLD/jeGJb/src/JLD.jl:243
[13] #save#40
@ ~/.julia/packages/JLD/jeGJb/src/JLD.jl:1233 [inlined]
[14] save(::File{DataFormat{:JLD}, String}, ::String, ::PyObject)
@ JLD ~/.julia/packages/JLD/jeGJb/src/JLD.jl:1230
[15] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Base ./essentials.jl:716
[16] invokelatest(::Any, ::Any, ::Vararg{Any})
@ Base ./essentials.jl:714
[17] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::Formatted, ::String, ::Vararg{Any}; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ FileIO ~/.julia/packages/FileIO/u9YLx/src/loadsave.jl:219
[18] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::Formatted, ::String, ::PyObject)
@ FileIO ~/.julia/packages/FileIO/u9YLx/src/loadsave.jl:197
[19] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::Symbol, ::String, ::String, ::Vararg{Any}; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ FileIO ~/.julia/packages/FileIO/u9YLx/src/loadsave.jl:185
[20] action
@ ~/.julia/packages/FileIO/u9YLx/src/loadsave.jl:185 [inlined]
[21] #save#20
@ ~/.julia/packages/FileIO/u9YLx/src/loadsave.jl:129 [inlined]
[22] save(::String, ::String, ::PyObject)
@ FileIO ~/.julia/packages/FileIO/u9YLx/src/loadsave.jl:126
[23] top-level scope
@ ~/Documents/CODE/CompModelCode/lab2.jl:38
Stacktrace:
[1] handle_error(e::ErrorException, q::Base.PkgId, bt::Vector{Union{Ptr{Nothing}, Base.InterpreterIP}})
@ FileIO ~/.julia/packages/FileIO/u9YLx/src/error_handling.jl:61
[2] handle_exceptions(exceptions::Vector{Tuple{Any, Union{Base.PkgId, Module}, Vector}}, action::String)
@ FileIO ~/.julia/packages/FileIO/u9YLx/src/error_handling.jl:56
[3] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::Formatted, ::String, ::Vararg{Any}; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ FileIO ~/.julia/packages/FileIO/u9YLx/src/loadsave.jl:228
[4] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::Formatted, ::String, ::PyObject)
@ FileIO ~/.julia/packages/FileIO/u9YLx/src/loadsave.jl:197
[5] action(::Symbol, ::Vector{Union{Base.PkgId, Module}}, ::Symbol, ::String, ::String, ::Vararg{Any}; options::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ FileIO ~/.julia/packages/FileIO/u9YLx/src/loadsave.jl:185
[6] action
@ ~/.julia/packages/FileIO/u9YLx/src/loadsave.jl:185 [inlined]
[7] #save#20
@ ~/.julia/packages/FileIO/u9YLx/src/loadsave.jl:129 [inlined]
[8] save(::String, ::String, ::PyObject)
@ FileIO ~/.julia/packages/FileIO/u9YLx/src/loadsave.jl:126
[9] top-level scope
@ ~/Documents/CODE/CompModelCode/lab2.jl:38```
PyCall 1.90.0 is now released, which change o[:foo]
and o["foo"]
to o.foo
and o."foo"
, respectively, for python objects o
; see also JuliaPy/PyCall.jl#629.
The old getindex
methods still work but are deprecated, so you'll want to put out a new release that uses the new methods and REQUIREs PyCall 1.90.0 to avoid having zillions of deprecation messages.
This issue is used to trigger TagBot; feel free to unsubscribe.
If you haven't already, you should update your TagBot.yml
to include issue comment triggers.
Please see this post on Discourse for instructions and more details.
If you'd like for me to do this for you, comment TagBot fix
on this issue.
I'll open a PR within a few hours, please be patient!
See the discussion in JuliaPy/PyCall.jl#388 about avoiding copies of buffers; maybe some code can be shared.
@JuliaRegistrator register
cleaning up after yourself is appreciated, but deleting the entire temp dir is overstepping that a bit - shouldn't delete anything that the package tests don't create themselves
@pydef type Store
__init__(self, a) = (self[:a] = a)
end
save("dummy.jld", "x", Store(10))
> PyError (ccall(@pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, arg, C_NULL)) <class 'cPickle.PicklingError'>
> PicklingError("Can't pickle <class 'Store'>: attribute lookup __main__.Store failed",)
I don't think anything can be done about it, though.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.