# Best solution to have multiprocess working in actor?

**URL:** <https://discuss.ray.io/t/best-solution-to-have-multiprocess-working-in-actor/2165>\
**Category:** Ray Core\
**Created:** [May 14, 2021, 11:53pm UTC](https://discuss.ray.io/t/best-solution-to-have-multiprocess-working-in-actor/2165 "2021-05-14T23:53:55Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![sangcho](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/sangcho/32/425_2.png) [@sangcho](https://discuss.ray.io/u/sangcho)\
**Post date:** [May 15, 2021, 12:49am UTC](https://discuss.ray.io/t/best-solution-to-have-multiprocess-working-in-actor/2165/4 "2021-05-15T00:49:38Z")

</div>

Ray’s multi processing lib should be the drop-in replacement of mp library, but it doesn’t support full APIs. So there’s def possibility your application won’t be ported seamlessly. For your issue, it is highly likely you have implicit capture of un-pickleable object in your actor definition. This is an example of implicit capture.

```auto
a = object # Imagine this is a lock object

@ray.remote
class A:
    def __init(self)__:
        # In this case, a is captured from the above reference a, it should be pickelable.
        self.a = a 

```

To help troubleshooting this sort of serialization issue, we support a inspection tool; [Serialization — Ray v2.0.0.dev0](https://docs.ray.io/en/master/serialization.html#troubleshooting)

One other thing you can try is to import multi processing library within an actor like this;

```auto
@ray.remote
class RayServer(object):
def serve(self):
    import [multi processing library]
    test_multi_process()
    return “SSSSSS return”

```

---

_[View the full topic](https://discuss.ray.io/t/best-solution-to-have-multiprocess-working-in-actor/2165)._
