problems building rpy2 (hg repository) on centos 6.4 running python 3.4.1

Issue #203 wontfix
epifanio created an issue


trying to build rpy2 from repository i got this log :

running install
running build
running build_py
running build_ext
Traceback (most recent call last):
  File "", line 463, in <module>
    'rpy2': ['doc/source/rpy2_logo.png', ]}
  File "/home/epi/Envs/env1/lib/python3.4/distutils/", line 148, in setup
  File "/home/epi/Envs/env1/lib/python3.4/distutils/", line 955, in run_commands
  File "/home/epi/Envs/env1/lib/python3.4/distutils/", line 974, in run_command
  File "/home/epi/Envs/env1/lib/python3.4/distutils/command/", line 554, in run
  File "/home/epi/Envs/env1/lib/python3.4/distutils/", line 313, in run_command
  File "/home/epi/Envs/env1/lib/python3.4/distutils/", line 974, in run_command
  File "/home/epi/Envs/env1/lib/python3.4/distutils/command/", line 126, in run
  File "/home/epi/Envs/env1/lib/python3.4/distutils/", line 313, in run_command
  File "/home/epi/Envs/env1/lib/python3.4/distutils/", line 973, in run_command
  File "/home/epi/Envs/env1/lib/python3.4/distutils/", line 107, in ensure_finalized
  File "", line 121, in finalize_options
    rversion = get_rversion(r_home)
  File "", line 177, in get_rversion
    if rversion.startswith(b"WARNING"):
TypeError: startswith first arg must be str or a tuple of str, not bytes

while trying the "pip3 install rpy2" i got :

thanks for help!

Comments (18)

  1. Laurent Gautier

    Which branch are you trying to build from ? default is hopelessly broken (not ideal, I hope get this back on track soon).

    At the moment, version_2.4.x is what you want:

    hg update version_2.4.x
  2. massimo di stefano

    thanks for looking into this. please let me know if i can be of any help in testing changes to the code.

  3. Laurent Gautier

    I looked at and it is choking on things like

    PyObject *key = PyLong_FromVoidPtr((void *)object);

    because is it mixing declarations and code.

    I would recommend you to use a C compiler that accept C99... which leads me to the question: what version of gcc are you using ?

  4. Laurent Gautier

    Change the compiling flags. The current problem seems to be that gcc insists on C90.

    (gcc-4.4 is releatively old - you might want to consider an update)

  5. epifanio reporter

    Thanks Laurent for the hints. Unfortunately on the machine where rpy has to be installed i do not have root so i had to build gcc from src and then rebuild all the software i was building with the old GCC. I can confirm that rpy build fine on centos using gcc 4.9.

  6. Laurent Gautier

    Ouch. This is a Python 3.4 thing, it seems. I have (finally) installed it and I am experiencing the same problem with gcc 4.8.1.

    I could set the flag -std=c99 in, but I am unsure this is playing well with other C compilers (most notably, clang... may be icc as well ?)

    In meantime, the workaround for me is:

    export CFLAGS="-std=c99"; pip install rpy2

    edit: This was with Python 3.4.0. Working with Python 3.4.1.

  7. Laurent Gautier

    There is a bug report of the change in Python 3.4, along with a patch:

    The comments say that the patch landed too late for 3.4.1, and my understanding is that it will be included in Python 3.4.2 (given the massive annoyance that this is, and the number of packages this is breaking, I hope that 3.4.2 will be released soon)

  8. ferdy wallinx

    Hi Laurent,

    I've just been trying to install Rpy2-2.4.4 with python 3.4.2 with pycharm IDE from the repository Still I got the error

    mp\rpy2\", line 168, in get_rversion

    if rversion.startswith("WARNING"):

    TypeError: startswith first arg must be bytes or a tuple of bytes, not str

    Are you sure the problem is fixed?

  9. Laurent Gautier

    Ah, yes. 2 problems in one issue report: 1 one of the problems gets solved, the issue gets closed. I am unable to reproduce the issue

    if rversion.startswith("WARNING"):

    Are you on Windows ?

  10. ferdy wallinx

    Yes I am on Windows. In the meantime I worked around RPY2 so at the moment I won't need it but maybe other people have the same problem. Thanks for responding anyways.

    2014-10-31 1:37 GMT+01:00 Laurent Gautier [Masked]

  11. Laurent Gautier

    There is currently no official support of Windows, and one should use the contributed binaries (see rpy2 doc) if unsure about how to compile python packages with C code.

  12. Log in to comment