Custom Search

Sunday, July 9, 2017

golang How to Install and Setup Jupyter notebook

1)
Download Go compiler from https://golang.org/dl/

2)
Extract it ($HOME/gocompiler/)

3)
Create a new directory for your go project ($HOME/golexamples/myproject1)

4)
Add the following lines to your $HOME/.bashrc

export GOROOT=$HOME/gocompiler/go
export PATH=$GOROOT/bin:$PATH

export GOPATH=$HOME/golexamples/myproject1
export PATH=$GOPATH/bin:$PATH



5)
$go help

6)
#we need pip >= 9
pip —version

7)
sudo pip install —upgrade pip

8)
pip —version

i)
sudo pip install jupyter

9)
#Run server
jupyter notebook

10)
Install goimports
go get golang.org/x/tools/cmd/goimports

11)
sudo apt-get install libzmq3-dev

12)
Install golang kernel
go get -tags zmq_4_x github.com/gopherds/gophernotes

Ref:
https://github.com/gopherdata/gophernotes

13)
Create a directory for the new kernel config:
mkdir -p ~/.local/share/jupyter/kernels/gophernotes

14)
Copy the kernel config into the .ipython directory:
cp -r $GOPATH/src/github.com/gopherds/gophernotes/kernel/* ~/.local/share/jupyter/kernels/gophernotes

15)
Start the jupyter notebook:
jupyter notebook

16)
Then, select “Golang” from the “New” drop down menu

17)
import "fmt"
world := "world"
fmt.Sprintf("Hello %s", world)





No comments:

Post a Comment