For Linux, change default python version...

Create issue
Issue #18 new
Former user created an issue

I am looking to change the version of Python used when loading PythonInR. Currently, when I load the library, I receive:

Initialize Python Version 2.6.6 (r266:84292, Aug 9 2016, 06:11:56) [GCC 4.4.7 20120313 (Red Hat 4.4.7-17)]

I need to use version 2.7.13 that I have setup:

$ python Python 2.7.13 (default, Apr 12 2017, 06:53:51) [GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux2

When loading the library in Linux, the default python is loaded. How do I change the python version that is started? Is there another command other than pyConnect() to use in Linux? How does PythonInR determine which version of Python to use?

Comments (3)

  1. Florian Schwendinger repo owner

    In Linux the python version is always determined at the installation, essentially PythonInR always uses the python version you get when you type python into the terminal.

    The system variable USESPECIALPYTHONVERSION can be used to link to a special python version.

    Either do e.g.

    export USESPECIALPYTHONVERSION="python3.4"



    When USESPECIALPYTHONVERSION is defined it sets a new alias in the configure script.


    But when you change the version you have to ensure that also the appropriate pythonXY-dev are installed e.g.

    apt-get install python3-dev
  2. Richard Shannon

    Thanks. We did as you suggested, but encounter this exception and the build does not complete:

    gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -o CToR.o CastPyObjects.o CastRObjects.o GetPyObjects.o PyCall.o PyRunString.o PythonFunctions.o PythonInR.o Python_Explicit_Linking.o SetPyObjects.o -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -L/usr/lib64/R/lib -lR /usr/bin/ld: /usr/local/lib/libpython2.7.a(getbuildinfo.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libpython2.7.a: could not read symbols: Bad value

    Any ideas?

  3. Richard Shannon

    I was able to track down the issue. It has to do with having multiple version of python, and according to this site there is an issue with script. Additionally, this site suggested adding a link to from the python location from /usr/lib.

  4. Log in to comment