Repository navigation
Description
Biopython releases until now have not attempted to compile any C extension code under PyPy. During the early days of PyPy we deliberately excluded them:
However, in experiments with PyPy2 v5.6 and v5.7 compiling our C code mostly works, with the exception of:
Extension('Bio.trie',
['Bio/triemodule.c',
'Bio/trie.c'],
include_dirs=["Bio"]
),The following tests are from peterjc@ce5eed1 which is/was a test branch with a modified setup.py to remove the PyPy skipping code.
e.g. https://travis-ci.org/peterjc/biopython/builds/214701332 vs https://travis-ci.org/peterjc/biopython/builds/214709981 where PyPy2 v5.7 (and PyPy3.5 v5.7 beta) both fail to compile Bio.trie
Run locally to show the full details:
$ rm -rf build && ~/Downloads/pypy-5.7-linux_x86_64-portable/bin/pypy setup.py build
...
building 'Bio.trie' extension
gcc -pthread -DNDEBUG -O2 -fPIC -IBio -I/home/pc40583/Downloads/pypy-5.7-linux_x86_64-portable/include -c Bio/triemodule.c -o build/temp.linux-x86_64-2.7/Bio/triemodule.o
Bio/triemodule.c:2:21: error: marshal.h: No such file or directory
Bio/triemodule.c: In function ‘_write_value_to_handle’:
Bio/triemodule.c:630: warning: assignment makes pointer from integer without a cast
Bio/triemodule.c: In function ‘_read_value_from_handle’:
Bio/triemodule.c:735: warning: assignment makes pointer from integer without a cast
error: command 'gcc' failed with exit status 1
#include <Python.h>
#include <marshal.h>
#include "trie.h"The C code references functions PyMarshal_WriteObjectToString and PyMarshal_ReadObjectFromString, and constant Py_MARSHAL_VERSION.
It appears PyPy only supports the Python level marshal interface defined in pypy/lib_pypy/_marshal.py, and not the C level API?
Logged with PyPy as https://bitbucket.org/pypy/pypy/issues/2520/missing-marshalh-for
Activity
[-]PyPy cannot build Bio.Trie[/-][+]PyPy cannot build Bio.trie[/+]peterjc commentedon Mar 26, 2017
It seems unlikely that PyPy will support the Python Marshal C API soon.
Would anyone be interested in writing some (or all) of
Bio.triein pure python as they suggest?Writing the whole thing in Python would also let it run under Jython too, and might be simpler than trying to this piece by piece...
Can also build Bio.cpairwise2 and Bio.Nexus.cnexus on PyPy2
Can also build Bio.cpairwise2 and Bio.Nexus.cnexus on PyPy2
Can also build Bio.cpairwise2 and Bio.Nexus.cnexus on PyPy2
mdehoon commentedon Mar 23, 2018
The Python documentation discourages using PyMarshal_WriteObjectToString and PyMarshal_ReadObjectFromString for serialization, and recommends using pickle instead. It is possible to pickle a trie as a dictionary (see issue #912 ). So we could just remove the load/save methods and recommend using pickle instead.
peterjc commentedon Jul 24, 2020
Closing - We removed
Bio.triein #2501Thank you @chebizarro for issue triage.