rpy2 installation error (OS: linux mint 17 | R 3.1.2 | python 2.7.6) - rpy2

When I run 'sudo pip install rpy2' I get the a lot of compilation errors.
Here is the full dump of all the errors and here is an example except:
Compilation parameters for rpy2's C components:
include_dirs = ['/usr/share/R/include']
library_dirs = ['/usr/lib/R/lib']
libraries = ['R', 'pcre', 'lzma', 'bz2', 'z', 'rt', 'dl', 'm']
extra_link_args = ['-Wl,--export-dynamic', '-fopenmp']
R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet"
building 'rpy2.rinterface._rinterface' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DR_INTERFACE_PTRS=1 -DHAVE_POSIX_SIGJMP=1 -DRIF_HAS_RSIGHAND=1 -DCSTACK_DEFNS=1 -DHAS_READLINE=1 -I./rpy/rinterface -I/usr/share/R/include -I/usr/include/python2.7 -c ./rpy/rinterface/_rinterface.c -o build/temp.linux-x86_64-2.7/./rpy/rinterface/_rinterface.o
In file included from /usr/share/R/include/R.h:46:0,
from ./rpy/rinterface/_rinterface.h:8,
from ./rpy/rinterface/_rinterface.c:58:
/usr/share/R/include/R_ext/Memory.h:40:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
int R_gc_running();
^
In file included from ./rpy/rinterface/_rinterface.h:9:0,
from ./rpy/rinterface/_rinterface.c:58:
/usr/share/R/include/Rinternals.h:831:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
const char *R_curErrorBuf();
^
In file included from ./rpy/rinterface/_rinterface.c:70:0:
/usr/share/R/include/Rinterface.h:129:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
extern void (*ptr_R_ProcessEvents)();
^
In file included from ./rpy/rinterface/_rinterface.c:79:0:
/usr/share/R/include/R_ext/Rdynload.h:32:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
typedef void * (*DL_FUNC)();
^
./rpy/rinterface/_rinterface.c:86:31: fatal error: readline/readline.h: No such file or directory
#include <readline/readline.h>
^
compilation terminated.
Some background. Previously botched the installation of ipython notebook dev version and have reverted back to the pip repository version. Not sure if that plays a role. Was able to get R magic working a little before that.
I had made sure to run 'apt-get updates', 'pip uninstall rpy2', 'apt-get purge python-rpy2 && apt-get remove python-rpy2' before attempt to re-install. To check if there was any residual files, I ran 'import rpy2' in ipython and that resulted in an module not found error (good, nothing was lingering).
Not sure where to begin troubleshooting. Advice is appreciated.
Edit: Nov 26, 2014
It worked after installing the following dependencies:
apt-get install libreadline-dev
apt-get install r-base r-base-dev python-dev python-setuptools

You need the headers for the readline library:
apt-get install libreadline-dev

Related

Pyenv BUILD FAILED while Integrate Spark (Scala) and Jupyter Notebook

Does anyone know how to solve this problem?
pyenv build fails. Trying to integrate spark scala with jupyter notbook as described hereenter link description here
➜ ~ pyenv install 3.8.2
python-build: use openssl#1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.2.tar.xz...
-> https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tar.xz
Installing Python-3.8.2...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
^D
BUILD FAILED (OS X 11.2.1 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/_v/qvsxvlw51rxb43z929hyv45w0000gn/T/python-build.20210222233923.72853
Results logged to /var/folders/_v/qvsxvlw51rxb43z929hyv45w0000gn/T/python-build.20210222233923.72853.log
Last 10 log lines:
extern int _NSGetExecutablePath(char* buf, uint32_t* bufsize) __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0);
^
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -I./Include/internal -I. -I./Include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/quais/.pyenv/versions/3.8.2/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/quais/.pyenv/versions/3.8.2/include -DPy_BUILD_CORE_BUILTIN -DPy_BUILD_CORE_BUILTIN -I./Include/internal -c ./Modules/posixmodule.c -o Modules/posixmodule.o
./Modules/posixmodule.c:9197:15: error: implicit declaration of function 'sendfile' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
ret = sendfile(in, out, offset, &sbytes, &sf, flags);
^
1 error generated.
make: *** [Modules/posixmodule.o] Error 1
make: *** Waiting for unfinished jobs....
1 warning generated.
➜ ~
Saving session...completed.
Deleting expired sessions...none found.
[Process completed]
I could solve this by getting an older version the environment. Apparently the latest version is not supported even if i have the 12+ version of Xcode
pyenv install 3.7.9

Installation of Kaldi, error on compiling gst-kaldi-nnet2-online on ubuntu 16.04

What i try to do is to install silvius-backend on my ubuntu 16.04 virtual machine, but unfortunately it is not working without the proper compile of both of kaldi and gst-kaldi-nnet2-online .
I have compiled kaldi successfully but I am experiencing a error when i try to compile gst-kaldi-nnet2-online.
I follow these instructions.
Here is what i do:
I am using Ubuntu 16.04.
I have compiled kaldi successfully with the following commands:
in kaldi/tools --> sudo make CXX=g++-5
in kaldi/src --> sudo CXX=g++-5 ./configure --shared, sudo make clean CXX=g++-5 ,sudo make depend CXX=g++-5 ,sudo make CXX=g++-5
I tried to do sudo make depend from ~/gst-kaldi-nnet2-online/src and i got an error like this:
Makefile:6: * Cannot find Kaldi's makefile /home/tanel/tools/kaldi- trunk/src/kaldi.mk. Specify Kaldi's root directory using KALDI_ROOT when issuing make, e.g.: KALDI_ROOT=/home/tanel/tools/kaldi-trunk make . Stop.
So In this path i have changed the path to: "KALDI_ROOT=~/kaldi"
And now i am getting an error like this :
g++-5 -M -std=c++11 -I.. -I/home/silvius/kaldi/tools/openfst/include -pthread -I/usr/include/gstreamer-1.0 -I/usr/lib/x86_64-linux-gnu/gstreamer-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Wall -Wno-sign-compare -Wno-unused-local-typedefs -Wno-deprecated-declarations -Winit-self -DKALDI_DOUBLEPRECISION=0 -DHAVE_EXECINFO_H=1 -DHAVE_CXXABI_H -DHAVE_ATLAS -I/home/silvius/kaldi/tools/ATLAS_headers/include -msse -msse2 -pthread -g -fPIC -I~/kaldi/src *.cc > .depend.mk
In file included from gst-audio-source.cc:22:0:
./gst-audio-source.h:23:33: fatal error: matrix/kaldi-vector.h: No such file or directory
compilation terminated.
In file included from ./gstkaldinnet2onlinedecoder.h:26:0,
from gstkaldinnet2onlinedecoder.cc:49:
././simple-options-gst.h:25:33: fatal error: util/simple-options.h: No such file or directory
compilation terminated.
In file included from simple-options-gst.cc:20:0:
./simple-options-gst.h:25:33: fatal error: util/simple-options.h: No such file or directory
compilation terminated.
Makefile:76: recipe for target 'depend' failed
make: [depend] Error 1 (ignored)
You can see the error on a picture aswell on this link
PS: the path to my Folders is that ones:
`~/kaldi` for kaldi's folder , and
`~/gst-kaldi-nnet2-online` for the gst-kaldi-nnet2-online.
(i cloned them from github inside `~/` in separated folders)
I dont know what to do next or what is the problem. I've been looking for a solution since days on the internet but i found nothing. Can someone help me?

how to set the gcc compiler version in my makefile when installing ns2?

while installing ns2 according to the steps mentioned here:
http://stanjuly.wordpress.com/2011/12/22/install-ns2-ns-allinone-2-35-on-ubuntu-11-04-for-beginners/
In Step 4, when i opened my make file, my make file looks like this:
CC= #CC#
CFLAGS= #CFLAGS#
RANLIB= #RANLIB#
INSTALL= #INSTALL#
#
# how to compile, link, and name shared libraries
#
SHLIB_LD= #SHLIB_LD#
SHLIB_CFLAGS= #SHLIB_CFLAGS#
SHLIB_SUFFIX= #SHLIB_SUFFIX#
SHLD_FLAGS= #DL_LD_FLAGS#
DL_LIBS= #DL_LIBS#
SHLIB_LD_LIBS = #SHLIB_LD_LIBS#
#
# where to install shells, libraries, and includes
#
INST_OTCLSH= #prefix#/bin
INST_OWISH= #prefix#/bin
INST_OLIB= #prefix#/lib
INST_OLIBSH= #INST_OLIBSH#
INST_OINC= #prefix#/include
#
# ------------ you shouldn't need to configure below here -----------------
#
the instructions say that i am supposed to change CC = #CC# to CC = #CC# -V 4.7.0 (4.7.0 because when i type gcc --version on my terminal it says):
gcc (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3
But when instlaiing ns2 (step5): sudo ./install i get the following error:
config.status: creating Makefile
rm -f libotcl.a otcl.o
gcc -V 4.7 -c -g -O2 -DNDEBUG -DUSE_SHM -DHAVE_UNISTD_H=1 -I. -I/home/me/ns-
allinone-2.35/include -I/home/me/ns-allinone-2.35/include -I/home/me/ns-
allinone-2.35/include -I/include otcl.c
gcc: error: unrecognized command line option ‘-V’
gcc: error: 4.7: No such file or directory
make: *** [libotcl.a] Error 1
otcl-1.14 make failed! Exiting ...
How am i supposed to modify makefile that i dont get this error? Do i have the gcc compiler installed? I dont understand. I dont know how to check if it is installed.
This means your compiler is not compatible and if you don't want to install
gcc 4.4 than change
CC = gcc-4.4
to
CC = #CC#
in makefile and makefile.in present in otcl folder and also change
SHLIB_LD="ld -shared"
to
SHLIB_LD="gcc -shared"
in configure file
You need to install an old version of gcc: (Newer versions dosent work)
apt-get install gcc-4.4 (4.4 is the older version that I found on my repository)
And change
CC= #CC#
for:
CC=gcc-4.4

Pyhunspell installation in virtualnev

I have a problem with installation of pyhunspell bindings for hunspell library in python 3.2 virtualenv. I downloaded hunspell from here. I issued ./configure and make and it run all right. I avoided however to do make install because my purpose is to install it on virtualenv on a web server, where I have no root permissions.
Thus I downloaded pyhunspell bindings and unzipped it to the directory, where hunspell is made. I modified include_dir path in setup.py by adding correct destination and applied the patch which allows to build pyhunspell with Python 3. Then I ran python setup.py install (having activated the target virtualenv before), but I got this:
$ python setupy.py install
running install
running build
running build_ext
building 'hunspell' extension
gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -fPIC -D_LINUX -I./src/hunspell -I/usr/include/hunspell -I/usr/include/python3.2mu -c hunspell.c -o build/temp.linux-x86_64-3.2/hunspell.o -Wall
creating build/lib.linux-x86_64-3.2
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-3.2/hunspell.o -lhunspell-1.2 -o build/lib.linux-x86_64-3.2/hunspell.cpython-32mu.so
/usr/bin/ld: cannot find -lhunspell-1.2
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1
It seems that linker cannot link something because it looks for it in system path, while I didn't install the library in the system. Can someone wiser than me in the arcana of C devise any workaround to this issue?
I'll add that I have no access to the real server yet, but I know it will have the system pretty much similar to my local one (Debian 7.0 Wheezy), so I decided to give it a try before I actually log in to the server. Is it possible that the library compiled on my computer would work also on the server, assuming it would also be some (stable probably) version of Debian?
There's no need to build Hunspell. Install the Wheezy packages libhunspell-1.3-0 and libhunspell-dev. It should work with HunSpell 1.3. Just modify setup.py to use libraries = ['hunspell'].
FYI, the posted patch has a problem. It adds the methods of HunSpell as module functions. These receive the module as the first argument instead of the expected HunSpell instance. For example, if you call hunspell.spell, the process will probably segfault when it tries to use self->handle. You should fix the PyModuleDef to get rid of these mal-functions. Change line 273 of hunspell.c to use NULL instead of HunSpell_methods.

ruby-debug won't install / build native extensions

I have searched high and low for a solution. I have both linecache19 and ruby_core_source installed.
Neither of these commands will work:
gem install ruby-debug19
gem install ruby-debug19 -- --with-ruby-include=/Users/benjohnson/.rvm/src/ruby-1.9.1-p378
Here is the error I keep getting:
Building native extensions. This could take a while...
ERROR: Error installing ruby-debug19:
ERROR: Failed to build gem native extension.
/Users/benjohnson/.rvm/rubies/ruby-1.9.1-p378/bin/ruby extconf.rb
checking for rb_method_entry_t.body in method.h... no
checking for vm_core.h... no
checking for rb_method_entry_t.body in method.h... no
checking for vm_core.h... yes
checking for iseq.h... yes
checking for insns.inc... yes
checking for insns_info.inc... yes
checking for eval_intern.h... yes
creating Makefile
make
gcc -I. -I/Users/benjohnson/.rvm/rubies/ruby-1.9.1-p378/include/ruby-1.9.1/i386-darwin10.4.0 -I/Users/benjohnson/.rvm/rubies/ruby-1.9.1-p378/include/ruby-1.9.1/ruby/backward -I/Users/benjohnson/.rvm/rubies/ruby-1.9.1-p378/include/ruby-1.9.1 -I. -DHAVE_VM_CORE_H -DHAVE_ISEQ_H -DHAVE_INSNS_INC -DHAVE_INSNS_INFO_INC -DHAVE_EVAL_INTERN_H -I/Users/benjohnson/.rvm/rubies/ruby-1.9.1-p378/include/ruby-1.9.1/ruby-1.9.1-p378 -fno-common -O2 -g -Wall -Wno-parentheses -fno-common -pipe -fno-common -o breakpoint.o -c breakpoint.c
gcc -I. -I/Users/benjohnson/.rvm/rubies/ruby-1.9.1-p378/include/ruby-1.9.1/i386-darwin10.4.0 -I/Users/benjohnson/.rvm/rubies/ruby-1.9.1-p378/include/ruby-1.9.1/ruby/backward -I/Users/benjohnson/.rvm/rubies/ruby-1.9.1-p378/include/ruby-1.9.1 -I. -DHAVE_VM_CORE_H -DHAVE_ISEQ_H -DHAVE_INSNS_INC -DHAVE_INSNS_INFO_INC -DHAVE_EVAL_INTERN_H -I/Users/benjohnson/.rvm/rubies/ruby-1.9.1-p378/include/ruby-1.9.1/ruby-1.9.1-p378 -fno-common -O2 -g -Wall -Wno-parentheses -fno-common -pipe -fno-common -o ruby_debug.o -c ruby_debug.c
ruby_debug.c: In function ‘ruby_method_ptr’:
ruby_debug.c:141: error: ‘rb_method_entry_t’ undeclared (first use in this function)
ruby_debug.c:141: error: (Each undeclared identifier is reported only once
ruby_debug.c:141: error: for each function it appears in.)
ruby_debug.c:141: error: ‘method’ undeclared (first use in this function)
ruby_debug.c:142: warning: implicit declaration of function ‘rb_method_entry’
ruby_debug.c: In function ‘debug_event_hook’:
ruby_debug.c:719: error: ‘rb_method_entry_t’ undeclared (first use in this function)
ruby_debug.c:719: error: ‘me’ undeclared (first use in this function)
make: *** [ruby_debug.o] Error 1
Gem files will remain installed in /Users/benjohnson/.rvm/gems/ruby-1.9.1-p378/gems/ruby-debug-base19-0.11.24 for inspection.
Results logged to /Users/benjohnson/.rvm/gems/ruby-1.9.1-p378/gems/ruby-debug-base19-0.11.24/ext/ruby_debug/gem_make.out
I have had the same issue (on 1.9.1 and 1.9.2). Even trying to install 0.11.23 triggered the error. I found that it was necessary to:
Uninstall the gem (all versions for me):
gem uninstall ruby-debug-base19
Delete the 0.11.24 directory (in my case: ~/.rvm/gems/ruby-1.9.2-p0/gems/ruby-debug-base19-0.11.24/)
install 0.11.23 explicitly:
gem install ruby-debug-base19 --version=0.11.23
This is where I got most of the solution: http://rails.brentsowers.com/2010_08_01_archive.html
Additionally, if you use Bundler:
I had problems until I upgraded to latest Bundler (1.0.2 => 1.0.7) as it insisted on installing ruby-debug-base19 v 0.11.24).
In your Gemfile, make sure you've pinned the version of ruby-debug-base19:
gem "ruby-debug-base19", "0.11.23", :require => nil
This one works best for me, because it don't seems too hackish:
gem install ruby-debug19 -- --with-ruby-include=$rvm_path/src/ruby-1.9.2-head/
don't forget to set $rvm_path.
In my case, the last folder was ruby-1.9.3-head - pick the right one for you.
got this answer from here: ruby-debug install error: failed to build gem native extension
on Debian/Ubuntu/Mint this issue could be solved by installing some of these packages (I'm not sure which is causing the problem)
apt-get install libcurl4-openssl-dev libgcrypt11-dev libgnutls-dev
libidn11-dev libldap2-dev librtmp-dev libtasn1-3-dev m4
Do you have gcc installed and path to gcc.exe referenced in your PATH environment variable?
This solved similar problem for me, probably this could your solution too!
For the version of ruby I was working with I had to add both of these lines to my Gemfile
gem 'ruby-debug-base19', '0.11.23'
gem "ruby-debug19"

Resources