Installing Pytorch in PyPy Implementation rather than CPython

I am assuming that Pytorch is not supported in Pypy environment. I had an existing system which was slow in CPython so we moved to Pypy. Now I need to integrate that system with some Pytorch model. Turns out the default wheel is built for CPython. Is there any way I can install the Pytorch (any version) in Pypy implementation?

3 Likes

Hi,

I can’t speak for anyone, but it seems that far as pytorch is concerned, pypy is not supported. And the reason is that pypy is fairly closely written for the C python extension api, which is not how pypy usually supports extensions.

Now, it seems that even though this has not fully arrived in the pypy documentation, pypy moved from modifying numpy to actually providing a C extension api close enough to cpython to run numpy as is in pypy. (With stuff still to do etc.) So it is apparently possible to compile c extensions for pypy, they have a compatibility wiki page.

Now if that works for pytorch is anyones guess. If you wanted to try (and if successful the result could be truly awesome), you will probably need more pypy help than pytorch. The pytorch blog features a tour of pytorch internals, that might be useful to you.

Best regards and good look!

Thomas

4 Likes