I'm trying Pypy because it shows impressive benchmarks over CPython. Also, I'm mostly using the Twisted library in my code. I can now run a benchmark script which uses the Twisted reactor so I guess my setup is good. However, I do not know how to run the Twisted daemonizer (twistd) using Pypy.
Asked
Active
Viewed 2,687 times
1 Answers
6
You can either do it explicitly at run-time:
~$ /usr/bin/pypy /usr/bin/twistd ...
This works because it specifically starts PyPy and tells it to start interpreting the twistd script.
Or you can do it persistently at install-time:
~/Twisted-11.0.0$ /usr/bin/pypy setup.py install
This works because distutils (what setup.py uses) rewrites the #! line of each script it installs to point to the interpreter used to do the installation. So #!/usr/bin/env python in the installation source becomes #!/usr/bin/pypy in the installed copy.

Jean-Paul Calderone
- 47,755
- 6
- 94
- 122
-
1`~$ /usr/bin/pypy /usr/bin/twistd ...` This only worked when I installed setuptools using pypy. If not, the pkg_resources module in twistd can not be found. – esamson Sep 08 '11 at 08:11
-
1`~/Twisted-11.0.0$ /usr/bin/pypy setup.py install` On Debian testing, this ended with a "Too many open files" error when the .egg was being extracted/installed. I had to use a higher open files limit using ulimit. – esamson Sep 08 '11 at 08:18
-
The "Too many open files" issue is documented here https://bugs.pypy.org/issue878 and is due to the way setuptools deals with files. Because pypy does not do reference counting GC, it might not GC/close files until much later. This is pretty bad, as it might happen when installing twisted alone, or as a dependency in pip - especially when it's a dependency of something else, it breaks everything. – fiorix Jun 13 '12 at 08:30