在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:gopherdata/gophernotes开源软件地址:https://github.com/gopherdata/gophernotes开源编程语言:Go 95.5%开源软件介绍:gophernotes - Use Go in Jupyter notebooks and nteract
Acknowledgements - This project utilizes a Go interpreter called gomacro under the hood to evaluate Go code interactively. The gophernotes logo was designed by the brilliant Marcus Olsson and was inspired by Renee French's original Go Gopher design.
ExamplesJupyter Notebook:nteract:Jupyter Notebook Viewer):Example Notebooks (download and run them locally, follow the links to view in Github, or use theInstallationPrerequisites
Linux or FreeBSDThe instructions below should work both on Linux and on FreeBSD. Method 1: quick installation as module $ env GO111MODULE=on go get github.com/gopherdata/gophernotes
$ mkdir -p ~/.local/share/jupyter/kernels/gophernotes
$ cd ~/.local/share/jupyter/kernels/gophernotes
$ cp "$(go env GOPATH)"/pkg/mod/github.com/gopherdata/[email protected]/kernel/* "."
$ chmod +w ./kernel.json # in case copied kernel.json has no write permission
$ sed "s|gophernotes|$(go env GOPATH)/bin/gophernotes|" < kernel.json.in > kernel.json Method 2: manual installation from GOPATH $ env GO111MODULE=off go get -d -u github.com/gopherdata/gophernotes
$ cd "$(go env GOPATH)"/src/github.com/gopherdata/gophernotes
$ env GO111MODULE=on go install
$ mkdir -p ~/.local/share/jupyter/kernels/gophernotes
$ cp kernel/* ~/.local/share/jupyter/kernels/gophernotes
$ cd ~/.local/share/jupyter/kernels/gophernotes
$ chmod +w ./kernel.json # in case copied kernel.json has no write permission
$ sed "s|gophernotes|$(go env GOPATH)/bin/gophernotes|" < kernel.json.in > kernel.json To confirm that the $ "$(go env GOPATH)"/bin/gophernotes and you should see the following: 2017/09/20 10:33:12 Need a command line argument specifying the connection file. Note - if you have the $ jupyter --data-dir MacImportant Note - gomacro relies on the Method 1: quick installation as module $ env GO111MODULE=on go get github.com/gopherdata/gophernotes
$ mkdir -p ~/Library/Jupyter/kernels/gophernotes
$ cd ~/Library/Jupyter/kernels/gophernotes
$ cp "$(go env GOPATH)"/pkg/mod/github.com/gopherdata/[email protected]/kernel/* "."
$ chmod +w ./kernel.json # in case copied kernel.json has no write permission
$ sed "s|gophernotes|$(go env GOPATH)/bin/gophernotes|" < kernel.json.in > kernel.json Method 2: manual installation from GOPATH $ env GO111MODULE=off go get -d -u github.com/gopherdata/gophernotes
$ cd "$(go env GOPATH)"/src/github.com/gopherdata/gophernotes
$ env GO111MODULE=on go install
$ mkdir -p ~/Library/Jupyter/kernels/gophernotes
$ cp kernel/* ~/Library/Jupyter/kernels/gophernotes
$ cd ~/Library/Jupyter/kernels/gophernotes
$ chmod +w ./kernel.json # in case copied kernel.json has no write permission
$ sed "s|gophernotes|$(go env GOPATH)/bin/gophernotes|" < kernel.json.in > kernel.json To confirm that the $ "$(go env GOPATH)"/bin/gophernotes and you should see the following: 2017/09/20 10:33:12 Need a command line argument specifying the connection file. Note - if you have the $ jupyter --data-dir WindowsImportant Note - gomacro relies on the
DockerYou can try out or run Jupyter + gophernotes without installing anything using Docker. To run a Go notebook that only needs things from the standard library, run:
Or to run a Go notebook with access to common Go data science packages (gonum, gota, golearn, etc.), run:
In either case, running this command should output a link that you can follow to access Jupyter in a browser. Also, to save notebooks to and/or load notebooks from a location outside of the Docker image, you should utilize a volume mount. For example:
Getting StartedJupyter
nteract
Special commandsIn addition to Go code, the following special commands are also supported - they must be on a line by their own:
Limitationsgophernotes uses gomacro under the hood to evaluate Go code interactively. You can evaluate most any Go code with gomacro, but there are some limitations, which are discussed in further detail here. Most notably, gophernotes does NOT support:
Also, creation of new named types is emulated, and their methods are visible only to interpreted code. Troubleshootinggophernotes not foundDepending on your environment, you may need to manually change the path to the "Kernel error" in a running notebook
Stop jupyter, if it's already running. Add a symlink to
Restart jupyter, and you should now be up and running. error "could not import C (no metadata for C)" when importing a packageAt a first analysis, it seems to be a limitation of the new import mechanism that supports Go modules.
You can switch the old (non module-aware) mechanism with the command To re-enable modules support, execute Look at Jupyter notebook's logs for debuggingIn order to see the logs for your Jupyter notebook, use the --log-level option
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论