Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rPython installation fails, libpython not in linker paths

I got an error in R when building the rPython package, specifically the part that links against libpython2.7:

gcc -std=gnu99 -I/foo/bar/R-3.1.1/lib64/R/include -DNDEBUG  -I/usr/local/include \
  -I/foo/bar/Python-2.7.6/include/python2.7 -I/foo/bar/Python-2.7.6/include/python2.7 \
  -D PYTHONLIBFILE=libpython2.7.so -fpic  -g -O2  -c pycall.c -o pycall.o

gcc -std=gnu99 -shared -L/usr/local/lib64 -o rPython.so pycall.o \
  -lpthread -ldl -lutil -lm -lpython2.7 -Xlinker -export-dynamic

/usr/bin/ld: error: cannot find -lpython2.7

The problem seems to be that while R (or rPython) understood which -I rules to compile with my Python installation, it did not add the corresponding linker flags. I don't know why, suppose it's a bug.

like image 952
John Zwinck Avatar asked Dec 14 '22 20:12

John Zwinck


1 Answers

I had also the same problem and I could solve it simply by installing python-dev package, I saw it in some forums to be honest.

You can install this from the terminal using:

sudo apt-get install python-dev

and then re-try to install rPython again.

It worked for me!

like image 187
Waleed Omer Avatar answered Dec 28 '22 07:12

Waleed Omer