You are here

Pypy not working, python works...

5 posts / 0 new
Last post
Pypy not working, python works...

Hi all,

I'm getting the following error when trying to run my script with pypy. I can run the script fine with python 2.7.9.

File "", line 75, in run_toplevel
File "", line 22, in <module>
from toolbox import cleanATOM
File "D:\rosetta\pyrosettanew\toolbox\", line 35, in <module>
import rosetta
File "D:\rosetta\pyrosettanew\rosetta\", line 21, in <module>
import utility
File "D:\rosetta\pyrosettanew\rosetta\utility\", line 1, in <module
from __utility_all_at_once_ import *
ImportError: No module named __utility_all_at_once_

The file "__utility_all_at_once_.pyd" is there in that folder but it doesn't seem to work, and yet it works fine with no changes with regular python. I understand there are different namespaces with pypy, yet paths seems to be ok...

Any ideas appreciated


Post Situation: 
Thu, 2015-03-05 05:15

PyPy uses a different interpreter than the standard "CPython" system. This means that modules which are not pure python which are compiled for the standard python system don't (quite) work with the PyPy interpreter. As notes: "C extensions need to be recompiled for PyPy in order to work."

However, there are ways around it. The page notes several, including the Reflex option, which from my preliminary reading might work - I don't know if anyone has tried it with Rosetta yet, though. Note that you would use that with the regular Rosetta source download, rather than the pre-wrapped PyRosetta download, as the cppyy/Reflex system is doing the wrapping for you.

If you try it, please let us know how it works.

Thu, 2015-03-05 06:19

Thx for the prompt reply.

A bit more involved than I hoped for at the moment! I am re-writing the various functions for searching, fragment insertion, small mover (all now done) with rotamer packing and loops still to do, all in Pyrosetta/python. As performance is always an issue I hoped the pypy method would be a simple and obvious one. The old rule, nothing is simple gets applied again here by the looks of it. I'll revisit it another time when I get the rest of the stuff working.

Thx again for the info


Thu, 2015-03-05 12:26

Did this resolve your issue @MarkW

please let me know!

Ashish Gupta
Web Dev

Wed, 2015-08-05 22:39

Well kind of! It gave an explanation for what was going on, but the solution looked too time consuming for what I wanted to do. Instead, I used ctypes to speed up sections that I identified with profiling as slow (mainly random number generation) and got some speed up there. I have also been using multiple cores simultaneously to crunch through the calcs quicker as well. So as of now I haven't gone any further with pypy

Mon, 2015-08-24 04:43