Skip to content

PyPy cannot build Bio.trie #1114

Closed
Closed

Description

@peterjc

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:

https://github.com/biopython/biopython/blob/biopython-168/setup.py#L416

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

https://github.com/biopython/biopython/blob/biopython-168/Bio/triemodule.c starts:

#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

  1. changed the title [-]PyPy cannot build Bio.Trie[/-] [+]PyPy cannot build Bio.trie[/+] on Mar 24, 2017
  2. peterjc commented on Mar 26, 2017

    @peterjc
    MemberAuthor

    It seems unlikely that PyPy will support the Python Marshal C API soon.

    Would anyone be interested in writing some (or all) of Bio.trie in 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...

  3. mdehoon commented on Mar 23, 2018

    @mdehoon
    Contributor

    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.

  4. peterjc commented on Jul 24, 2020

    @peterjc
    MemberAuthor

    Closing - We removed Bio.trie in #2501

    Thank you @chebizarro for issue triage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions