{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaPy/SymPy.jl/issues/216","repository_url":"https://api.github.com/repos/JuliaPy/SymPy.jl","labels_url":"https://api.github.com/repos/JuliaPy/SymPy.jl/issues/216/labels{/name}","comments_url":"https://api.github.com/repos/JuliaPy/SymPy.jl/issues/216/comments","events_url":"https://api.github.com/repos/JuliaPy/SymPy.jl/issues/216/events","html_url":"https://github.com/JuliaPy/SymPy.jl/issues/216","id":322601837,"number":216,"title":"Parallel pickling of SymFunctions","user":{"login":"fgerick","id":12558460,"avatar_url":"https://avatars2.githubusercontent.com/u/12558460?v=4","gravatar_id":"","url":"https://api.github.com/users/fgerick","html_url":"https://github.com/fgerick","followers_url":"https://api.github.com/users/fgerick/followers","following_url":"https://api.github.com/users/fgerick/following{/other_user}","gists_url":"https://api.github.com/users/fgerick/gists{/gist_id}","starred_url":"https://api.github.com/users/fgerick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fgerick/subscriptions","organizations_url":"https://api.github.com/users/fgerick/orgs","repos_url":"https://api.github.com/users/fgerick/repos","events_url":"https://api.github.com/users/fgerick/events{/privacy}","received_events_url":"https://api.github.com/users/fgerick/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-13T15:10:31Z","updated_at":"2018-05-14T18:33:13Z","closed_at":"2018-05-14T18:33:13Z","author_association":"NONE","body":"Simple example:\r\n\r\n```julia\r\naddprocs(4)\r\n\r\n@everywhere begin\r\nusing SymPy\r\nf = SymFunction(\"f\")\r\nx = symbols(\"x\")\r\nend\r\n\r\n@spawn f(x)\r\n```\r\n\r\ngives a `PicklingError` (with julia-0.6.3 on macos and linux): \r\n\r\n```\r\nERROR: PyError (ccall(@pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, arg, C_NULL)) <class '_pickle.PicklingError'>\r\nPicklingError(\"Can't pickle f: attribute lookup f on __main__ failed\",)\r\n\r\nStacktrace:\r\n [1] pyerr_check at /Users/_/.julia/v0.6/PyCall/src/exception.jl:58 [inlined]\r\n [2] pyerr_check at /Users/_/.julia/v0.6/PyCall/src/exception.jl:62 [inlined]\r\n [3] macro expansion at /Users/_/.julia/v0.6/PyCall/src/exception.jl:82 [inlined]\r\n [4] #_pycall#88(::Array{Any,1}, ::Function, ::PyCall.PyObject, ::PyCall.PyObject, ::Vararg{PyCall.PyObject,N} where N) at /Users/_/.julia/v0.6/PyCall/src/PyCall.jl:710\r\n [5] _pycall(::PyCall.PyObject, ::PyCall.PyObject, ::Vararg{PyCall.PyObject,N} where N) at /Users/_/.julia/v0.6/PyCall/src/PyCall.jl:698\r\n [6] #pycall#91(::Array{Any,1}, ::Function, ::PyCall.PyObject, ::Type{PyCall.PyObject}, ::PyCall.PyObject, ::Vararg{PyCall.PyObject,N} where N) at /Users/_/.julia/v0.6/PyCall/src/PyCall.jl:729\r\n [7] serialize(::Base.Distributed.ClusterSerializer{TCPSocket}, ::PyCall.PyObject) at /Users/_/.julia/v0.6/PyCall/src/serialize.jl:18\r\n [8] serialize_any(::Base.Distributed.ClusterSerializer{TCPSocket}, ::Any) at ./serialize.jl:622\r\n [9] serialize(::Base.Distributed.ClusterSerializer{TCPSocket}, ::Any) at ./serialize.jl:601\r\n [10] serialize_global_from_main(::Base.Distributed.ClusterSerializer{TCPSocket}, ::Symbol) at ./distributed/clusterserialize.jl:149\r\n [11] foreach(::Base.Distributed.##4#6{Base.Distributed.ClusterSerializer{TCPSocket}}, ::Array{Symbol,1}) at ./abstractarray.jl:1733\r\n [12] serialize(::Base.Distributed.ClusterSerializer{TCPSocket}, ::TypeName) at ./distributed/clusterserialize.jl:83\r\n [13] serialize_type_data(::Base.Distributed.ClusterSerializer{TCPSocket}, ::DataType) at ./serialize.jl:514\r\n [14] serialize_type(::Base.Distributed.ClusterSerializer{TCPSocket}, ::DataType, ::Bool) at ./serialize.jl:557\r\n [15] serialize_any(::Base.Distributed.ClusterSerializer{TCPSocket}, ::Any) at ./serialize.jl:618\r\n [16] serialize_msg(::Base.Distributed.ClusterSerializer{TCPSocket}, ::Base.Distributed.CallMsg{:call}) at ./distributed/messages.jl:89\r\n [17] send_msg_(::Base.Distributed.Worker, ::Base.Distributed.MsgHeader, ::Base.Distributed.CallMsg{:call}, ::Bool) at ./distributed/messages.jl:181\r\n [18] #remotecall#138 at ./distributed/remotecall.jl:325 [inlined]\r\n [19] remotecall(::Function, ::Base.Distributed.Worker) at ./distributed/remotecall.jl:324\r\n [20] #remotecall#139(::Array{Any,1}, ::Function, ::Function, ::Int64) at ./distributed/remotecall.jl:336\r\n [21] remotecall(::Function, ::Int64) at ./distributed/remotecall.jl:336\r\n [22] spawn_somewhere(::Function) at ./distributed/macros.jl:17\r\n```\r\n\r\nIs this Julia related or a problem on the Python side?"},"comment":{"url":"https://api.github.com/repos/JuliaPy/SymPy.jl/issues/comments/388918089","html_url":"https://github.com/JuliaPy/SymPy.jl/issues/216#issuecomment-388918089","issue_url":"https://api.github.com/repos/JuliaPy/SymPy.jl/issues/216","id":388918089,"user":{"login":"jverzani","id":421708,"avatar_url":"https://avatars2.githubusercontent.com/u/421708?v=4","gravatar_id":"","url":"https://api.github.com/users/jverzani","html_url":"https://github.com/jverzani","followers_url":"https://api.github.com/users/jverzani/followers","following_url":"https://api.github.com/users/jverzani/following{/other_user}","gists_url":"https://api.github.com/users/jverzani/gists{/gist_id}","starred_url":"https://api.github.com/users/jverzani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jverzani/subscriptions","organizations_url":"https://api.github.com/users/jverzani/orgs","repos_url":"https://api.github.com/users/jverzani/repos","events_url":"https://api.github.com/users/jverzani/events{/privacy}","received_events_url":"https://api.github.com/users/jverzani/received_events","type":"User","site_admin":false},"created_at":"2018-05-14T18:33:13Z","updated_at":"2018-05-14T18:33:13Z","author_association":"COLLABORATOR","body":"I think it is deeper down than SymPy, though not sure where it occurs. Here is the PyCall translation, I believe, showing the same issue:\r\n\r\n```\r\njulia> @everywhere begin\r\n       using PyCall\r\n       sympy = PyCall.pyimport_conda(\"sympy\", \"sympy\")\r\n       G = sympy[\"Function\"](\"G\")\r\n       x = sympy[\"Symbol\"](\"x\")\r\n       end\r\n\r\njulia> @spawn G(x)\r\nERROR: PyError (ccall(@pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, arg, C_NULL)) <type 'exceptions.TypeError'>\r\nTypeError('expected string or Unicode object, NoneType found',)\r\n\r\n```\r\n\r\n"}}
{"actor":{"display_login":"jverzani"}}