Ran Cui
Ran Cui

Reputation: 71

Jupyter notebook: error installing R packages

I'm using Ubuntu 16.04.

I have R running on my Jupyter notebook and all the packages comes with "R essentials" work fine.

However, when I try to install additional packages like "mice" or "bigmemory", the installation always fails. When it tries to do

** testing if installed package can be loaded

this is the error message that appears:

Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/home/usr/anaconda3/lib/R/library/bigmemory/libs/bigmemory.so': /home/usr/anaconda3/lib/R/library/Rcpp/libs/../../../../libstdc++.so.6: version 'GLIBCXX_3.4.20' not found (required by /home/usr/anaconda3/lib/R/library/bigmemory/libs/bigmemory.so)

I have tried sudo apt-get install libstdc++6 and it says my libstdc++6 is installed and already is the newest version. I don't know why the R installer cannot find it..

Upvotes: 4

Views: 1383

Answers (1)

Ran Cui
Ran Cui

Reputation: 71

I figured it out!

I got frustrated and uninstalled anaconda3 completely rm -rf ~\anaconda3. After reinstalling it, I looked at the instruction for installing IRkernel. I saw this:

If this fails, search the output for something like:

** testing if installed package can be loaded Error in dyn.load(file, DLLpath = DLLpath, ...) : unable to load shared object '/Users/[you]/anaconda/lib/R/library/rzmq/libs/rzmq.so': dlopen(/Users/[you]/anaconda/lib/R/library/rzmq/libs/rzmq.so, 6): Library not loaded: libzmq.5.dylib Referenced from: /Users/[you]/anaconda/lib/R/library/rzmq/libs/rzmq.so Reason: image not found

This would mean that the R binary package of rzmq was compiled against a different version of libzmq from the one on your system. It can be fixed by installing from source

So following the instruction I then did install.packages('mice','/home/[usr]/anaconda3/lib/R/library/',type = 'source')

It worked! I did the same thing for 'bigmemory'. No error message and I can use them both on Jupyter notebook now.

Upvotes: 3

Related Questions