Set Up Data Analysis Environment¶
Download and run the Anaconda installation script. Unless
PATH
is modified permanently, each terminal session needs to redefine
the path as follows
export PATH=<absolute_path_to_anaconda>/bin:$PATH
The Jupyter notebook installation is as easy as running a single command.
In order to enhance the notebook with R, install rpy2.
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
echo "deb http://cran.r-project.org/bin/linux/ubuntu xenial/" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install r-base
sudo apt-get install r-base-dev
export PATH=<absolute-path-to-anaconda>/bin:$PATH
pip install rpy2
R packages can be installed directly or via rpy2. Note that direct installation requires the notebook to be relaunched in order to access the new packages.
PyMathProg¶
PyMathProg is an easy to use solver for linear programming.
ImportError: <path>/anaconda3/lib/libgomp.so.1
: version ‘GOMP_4.0’ not found (required by /usr/lib/R/lib/libR.so)¶
This error may be resolved by telling the run-time shared library loader where to look for the shared library before launching the notebook.
export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
jupyter-notebook
ImportError: <path>/anaconda3/bin/../lib/libreadline.so.6
: undefined symbol: PC¶
This error may be resolved by manually importing readline before executing the notebook rpy2 magic command.
import readline
%load_ext rpy2.ipython
libgfortran.so.3
: version GFORTRAN_1.4 not found¶
This error usually means the library was installed incorrectly.
conda remove libgfortran
conda install libgcc --force