0

So I'm trying to have a remote Pyro5 object receive serialized arbitrary functions to execute them. The remote objects are run on a separate machine, registered on a Pyro5 name-server.

The built in serializer (serpent) in Pyro5 does not support function serialization, so I manually serialize the function with Dill, yielding a bytes type, which I send over when calling the remote object through Pyro5. I subsequently de-serialize the function on the remote-side, which yields the error:

ImportError: cannot import name 'Annotated' from 'typing' (/usr/lib/python3.8/typing.py)

I've tested to implement a separate function which sends the serialized data back to the client from the remote object, where I subsequently de-serialized the data into a function, successfully. This implies that using Dill on the remote end, as opposed to Pyro5, is the culprit.

1 Answers1

0

I'm the dill author. It would help to know what versions of python, dill, etc you are using -- both on the local and remote machines. However, I'm going to guess that you are using python 3.9+ locally, and the remote machine is using python 3.8 (see the traceback you posted). The Annotated class was added to the typing module in python 3.9... hence the error when dill expects to find it in typing.

Mike McKerns
  • 33,715
  • 8
  • 119
  • 139