Running Jupyter Notebook in Ubuntu on VirtualBox

Get vagrant box running

Make a directory to store vagrant files. I have called it UbuntuProject.

mkdir UbuntuProject

cd into the new directory.

cd UbuntuProject

Use the box with Vagrant (Code from https://app.vagrantup.com/ubuntu/boxes/trusty64 )

vagrant init ubuntu/trusty64

Open explorer from command line:

explorer .

create data directory in UbuntuProject

mkdir data

open folder with the vagrant files, edit Vagrantfile in Notepad++: remove # from lines 40, 46, 52-58, 70. change line 46 from “../data” to “./data”. save.

vagrant up (turns vm, cd UbuntuProject and then do vagrant up every time restart computer)

Vagrant up

In UbuntuPrject dir, now can start vagrant box ubuntu bash connection (do every time restart computer):

vagrant ssh

cd into vagrant_data. here can create conda environment and files and it can be visible in explorer.

cd /vagrant_data

to close ubuntu vagrant box connection:

exit

Once vagrant box running

install miniconda

restart vagrant box so that could use update

vagrant up # only if restarted laptop
vagrant ssh

create conda environment with python 3.6.

conda create -n entitylinks python=3.6

activate with conda activate entitylinks.

install the following dependencies with conda

jupyter

run jupyter notebook. make sure in entity links environment. if not, conda activate entitylinks.

jupyter notebook --generate-config

edit certain things ( https://stackoverflow.com/questions/38545198/access-jupyter-notebook-running-on-vm/38545410#38545410 ) in the jupyter_notebook_config.py file and save

nano ~/.jupyter/jupyter_notebook_config.py

activate env

conda activate entitylinks
cd /vagrant_data

Get the IP address of the notebook in the directory (see next to inet under eth1.

ip addr

run jupyter notebook

jupyter notebook

use link but replace what is before 8888 with ip address from ip addr

if when running code in jupyter notebook get this error: “OSError: dlopen: cannot load any more object with static TLS”:

make sure ubuntu is at least 18, check your version:

lsb_release -a

if not 18 at least, do these steps:

open Vagrant file and replace “ubuntu/trusty64” with “bento/ubuntu-18.04”

vagrant destroy
vagrant up
vagrant ssh

Leave a Reply

Your email address will not be published. Required fields are marked *