JuliaPy / JuliaPy/PythonCall.jl

Pickle doesn't work on julia modules

未关闭
#32 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
bug
主要语言
Julia
星标
1.1k
派生
86
平均合并
1 天 22 小时
30 天内合并 PR
3

描述

Bit of a strange request, but there is a use case. A minimal example is:
```python
import pickle
from juliacall import Base
pickle.dumps(Base)
# Traceback (most recent call last):
# File "", line 1, in
# TypeError: cannot pickle 'juliacall.ModuleValue' object
```

This would be useful for defining functions that are passed around in Python. I initially ran into this when using ray, so a slightly more complex example that has the same behaviour:
```python
import ray
ray.init()
from juliacall import Base
@ray.remote
def v(x):
Base.println(x)
x = ray.get(v.remote(1))
```

I had a look at PyCall as well, but they've got a similar issue here https://github.com/JuliaPy/PyCall.jl/issues/863, with a few comments on how to fix it.

Any ideas? I'll try to have a look into this further, but any help getting this working would be appreciated.

贡献指南

这个仓库没有索引到贡献指南

调研方向

Start by reproducing the minimal pickle.dumps(Base) example and the ray.remote example from the issue. Read the linked PyCall.jl issue for related serialization discussion; done means the reported juliacall module can be passed through the shown Python use cases without the current TypeError.

由索引模型根据 Issue 内容生成。

评估

技术栈
julia, python
领域
backend
Issue 类型
缺陷
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。