Cannot use MacPorts PyPy to Translate pypy-c

Hi, I am following the instructions here: http://doc.pypy.org/en/latest/cppyy.html#installation and here: http://root.cern.ch/phpBB3/viewtopic.php?f=14&t=17018 In the first link, it says I can use a "built-in pypy" to do the translation to make it go faster. I have pypy 2.1.0 from MacPorts, but it fails with the following message: <<< jfcaron@jfcaron-MacBook:~/Projects/PyPyRoot/pypy$ pypy rpython/translator/goal/translate.py --opt=jit pypy/goal/targetpypystandalone.py --withmod-cppyy Traceback (most recent call last): File "app_main.py", line 72, in run_toplevel File "rpython/translator/goal/translate.py", line 89, in <module> log = py.log.Producer("translation") File "/Users/jfcaron/Projects/PyPyRoot/pypy/py/_apipkg.py", line 114, in __makeattr result = importobj(modpath, attrname) File "/Users/jfcaron/Projects/PyPyRoot/pypy/py/_apipkg.py", line 37, in importobj module = __import__(modpath, None, None, ['__doc__']) File "/Users/jfcaron/Projects/PyPyRoot/pypy/py/_log/log.py", line 184, in <module> setattr(Syslog, _prio, getattr(py.std.syslog, _prio)) File "/Users/jfcaron/Projects/PyPyRoot/pypy/py/_std.py", line 13, in __getattr__ m = __import__(name) File "/opt/local/lib/pypy/lib_pypy/syslog.py", line 68, in <module> lib = ffi.verify(""" File "/opt/local/lib/pypy/lib_pypy/cffi/api.py", line 311, in verify lib = self.verifier.load_library() File "/opt/local/lib/pypy/lib_pypy/cffi/verifier.py", line 68, in load_library self.compile_module() File "/opt/local/lib/pypy/lib_pypy/cffi/verifier.py", line 55, in compile_module self._write_source() File "/opt/local/lib/pypy/lib_pypy/cffi/verifier.py", line 117, in _write_source file = open(self.sourcefilename, 'w') IOError: [Errno 2] No such file or directory: '/opt/local/lib/pypy/lib_pypy/__pycache__/_cffi__g7019d5d3xad93c709.c'
I am now doing the slow translation with CPython (also from MacPorts) with no problems so far. Is this just a version mismatch between the MacPorts pypy and that expected by the pypy on mercurial? Jean-François

Hi Jean-François, On Mon, Sep 9, 2013 at 6:08 PM, Jean-François Caron <jfcaron@phas.ubc.ca> wrote:
This is a mis-installed PyPy. To fix it, run PyPy as root and type: import syslog You may have to also import a few other modules as needed. ("syslog" appears in the traceback above.) Note also that cppyy is now included in PyPy by default (on non-Windows platforms), so you don't need to retranslate if that's the only reason. A bientôt, Armin.

Hi Armin,
thanks for the recipe!
Is for the CINT backend. There are a couple of optimizations in RPython for that backend, so those need to be translated, and the latest pieces are on the reflex-support branch, not in trunk at the moment. On the CPython side, we're closing in (finally, yay! :) ) on having an LLVM (Cling, that is: http://root.cern.ch/drupal/content/cling) backend. After that, I can consolidate; dependencies and re-packaging is going to take a bit of time. Way nicer, though. Not only C++11, but also since Cling is dynamic, it is a much better fit to Python. Think cross inheritance, calling Python from C++, automatic template instantiations, the cffi interface for C++ as well, etc. Best regards, Wim -- WLavrijsen@lbl.gov -- +1 (510) 486 6411 -- www.lavrijsen.net

Yes, I was re-translating in order to test the CINT backend for PyPyROOT. After importing syslog as root, I can now import syslog as non-root. I can send an email or bug report to MacPorts, but I'm not sure how to describe the bug, as I'm unfamiliar with the syslog module. Jean-François On 2013-09-10, at 08:02 , wlavrijsen@lbl.gov wrote:

Hi Jean-François, On Tue, Sep 10, 2013 at 5:43 PM, Jean-François Caron <jfcaron@phas.ubc.ca> wrote:
I can send an email or bug report to MacPorts, but I'm not sure how to describe the bug, as I'm unfamiliar with the syslog module.
Just reporting the error is plenty enough. The issue is that it's a CFFI module which gets built (by calling the C compiler) the first time it is imported. The library built is saved into some directory where (after installation) a normal user cannot write. It's supposed to be imported once as part of the installation process, to pregenerate it. It's what our own installation tool does (pypy/tool/release/package.py). A bientôt, Armin.

Hi Armin, On 09/11/2013 09:10 AM Armin Rigo wrote: [...]
(Please excuse ignorance deriving from not having tried to build and install pypy recently ;) Is it not currently possible to build and install everything pypy in user mode, in a user directory, e.g. ~/.pypy/versionstring/... and chmod selectively to protect against accidental mods/deletes? Will it not run properly via symlink from a directory in $PATH, or maybe via an alias defined in ~/.bash_profile? Regards, Bengt Richter

Hi Bengt, On Wed, Sep 11, 2013 at 1:42 PM, Bengt Richter <bokr@oz.net> wrote:
Sure, all this should work fine. The original question I'm answering is about a system-(mis)installed pypy, which of course doesn't have permissions to write extra files in its own libs when run as a user. A bientôt, Armin.

Hi Jean-François, On Mon, Sep 9, 2013 at 6:08 PM, Jean-François Caron <jfcaron@phas.ubc.ca> wrote:
This is a mis-installed PyPy. To fix it, run PyPy as root and type: import syslog You may have to also import a few other modules as needed. ("syslog" appears in the traceback above.) Note also that cppyy is now included in PyPy by default (on non-Windows platforms), so you don't need to retranslate if that's the only reason. A bientôt, Armin.

Hi Armin,
thanks for the recipe!
Is for the CINT backend. There are a couple of optimizations in RPython for that backend, so those need to be translated, and the latest pieces are on the reflex-support branch, not in trunk at the moment. On the CPython side, we're closing in (finally, yay! :) ) on having an LLVM (Cling, that is: http://root.cern.ch/drupal/content/cling) backend. After that, I can consolidate; dependencies and re-packaging is going to take a bit of time. Way nicer, though. Not only C++11, but also since Cling is dynamic, it is a much better fit to Python. Think cross inheritance, calling Python from C++, automatic template instantiations, the cffi interface for C++ as well, etc. Best regards, Wim -- WLavrijsen@lbl.gov -- +1 (510) 486 6411 -- www.lavrijsen.net

Yes, I was re-translating in order to test the CINT backend for PyPyROOT. After importing syslog as root, I can now import syslog as non-root. I can send an email or bug report to MacPorts, but I'm not sure how to describe the bug, as I'm unfamiliar with the syslog module. Jean-François On 2013-09-10, at 08:02 , wlavrijsen@lbl.gov wrote:

Hi Jean-François, On Tue, Sep 10, 2013 at 5:43 PM, Jean-François Caron <jfcaron@phas.ubc.ca> wrote:
I can send an email or bug report to MacPorts, but I'm not sure how to describe the bug, as I'm unfamiliar with the syslog module.
Just reporting the error is plenty enough. The issue is that it's a CFFI module which gets built (by calling the C compiler) the first time it is imported. The library built is saved into some directory where (after installation) a normal user cannot write. It's supposed to be imported once as part of the installation process, to pregenerate it. It's what our own installation tool does (pypy/tool/release/package.py). A bientôt, Armin.

Hi Armin, On 09/11/2013 09:10 AM Armin Rigo wrote: [...]
(Please excuse ignorance deriving from not having tried to build and install pypy recently ;) Is it not currently possible to build and install everything pypy in user mode, in a user directory, e.g. ~/.pypy/versionstring/... and chmod selectively to protect against accidental mods/deletes? Will it not run properly via symlink from a directory in $PATH, or maybe via an alias defined in ~/.bash_profile? Regards, Bengt Richter

Hi Bengt, On Wed, Sep 11, 2013 at 1:42 PM, Bengt Richter <bokr@oz.net> wrote:
Sure, all this should work fine. The original question I'm answering is about a system-(mis)installed pypy, which of course doesn't have permissions to write extra files in its own libs when run as a user. A bientôt, Armin.
participants (4)
-
Armin Rigo
-
Bengt Richter
-
Jean-François Caron
-
wlavrijsen@lbl.gov