JuliaPy / JuliaPy/PythonCall.jl

Pickle doesn't work on julia modules

Open
#32 7 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Julia
Stars
1.1k
Forks
86
Avg merge
1d 22h
Merged PRs (30d)
3

Description

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.

Contributor guide

No contributing guide indexed for this repository

Research direction

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.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia, python
Domain
backend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.