Code Monkey home page Code Monkey logo

docker-ocaml-jupyter-datascience's Introduction

Travis CI MicroBadger
Build Status Image Status

A ready-to-use environment of Jupyter (IPython notebook) and OCaml Jupyter (OCaml kernel) with libraries for data science and machine learning.

Getting started

First, launch a Jupyter server as follows.

$ docker run -it -p 8888:8888 akabe/ocaml-jupyter-datascience
[I 15:38:04.170 NotebookApp] Writing notebook server cookie secret to /home/opam/.local/share/jupyter/runtime/notebook_cookie_secret
[W 15:38:04.190 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 15:38:04.197 NotebookApp] Serving notebooks from local directory: /notebooks
[I 15:38:04.197 NotebookApp] 0 active kernels
[I 15:38:04.197 NotebookApp] The Jupyter Notebook is running at: http://[all ip addresses on your system]:8888/?token=4df0fee0719115f474c8dd9f9281abed28db140d25f933e9
[I 15:38:04.197 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 15:38:04.198 NotebookApp] No web browser found: could not locate runnable browser.
[C 15:38:04.198 NotebookApp]

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:8888/?token=4df0fee0719115f474c8dd9f9281abed28db140d25f933e9

Second, access to the URL at the above last line to your web browser, then

Screenshot of Jupyter with OCaml

You can create OCaml notebooks!

Notebooks on your host machine can be mounted to a Docker container like

docker run -it -p 8888:8888 -v $PWD:/notebooks akabe/ocaml-jupyter-datascience

Distributions

The default images are built on Debian 8:

Tag OCaml OPAM Command Dockerfile
latest 4.05.0 1.2.2 docker pull akabe/ocaml-jupyter-datascience Dockerfile
4.04.1 4.04.1 1.2.2 docker pull akabe/ocaml-jupyter-datascience:4.04.1 Dockerfile

CentOS

Distribution OCaml OPAM Command Dockerfile
CentOS 7 4.05.0 1.2.2 docker pull akabe/ocaml-jupyter-datascience:centos7_ocaml4.05.0 Dockerfile
CentOS 7 4.04.1 1.2.2 docker pull akabe/ocaml-jupyter-datascience:centos7_ocaml4.04.1 Dockerfile

Debian

Distribution OCaml OPAM Command Dockerfile
Debian 8 4.05.0 1.2.2 docker pull akabe/ocaml-jupyter-datascience:debian8_ocaml4.05.0 Dockerfile
Debian 8 4.04.1 1.2.2 docker pull akabe/ocaml-jupyter-datascience:debian8_ocaml4.04.1 Dockerfile

Pre-installed packages

Standard libraries

The OCaml standard library is too small in practical use. The following packages provide popular data structures, a lot of frequently-used functions such as string operations, various iteration on collections, etc.

  • Jane Street Core (GitHub, API) — A huge extended standard library developed by Jane Street Capital. The library is actively maintained and reliable due to industrial use of Jane Street. Its interface is designed differently from the OCaml standard library.
  • Batteries Included (GitHub, API) — A famous extended standard library compatible with the OCaml standard library. It is smaller than Jane Street Core, but commonly-used functions are implemented.

Numerical computation

Visualization

Data sources

Concurrent programming

Other packages

  • Re (GitHub) — A fast and easy-to-use regular expression library for OCaml. This library supports Glob, POSIX, Perl, PCRE, and OCaml-Str-style syntaxes.
  • Camomile (GitHub, API) — Camomile is a library for character encoding conversion and unicode utilities.
  • LambdaSoup (GitHub, API) — Lambda Soup is a functional HTML scraping and manipulation library for OCaml aimed at being easy to use.
  • OCaml CSV (GitHub, API) — A library to read and write comma-separated-values (CSV) format files.
  • ppx_sexp_conv — Automatic generation of converters between OCaml datatypes and S-expressions.
  • ppx_deriving_yojson — Automatic generation of converters between OCaml datatypes and JSONs.
  • ppx_regexp — Pattern matching by PCRE-style regular expressions.

CUI tools

  • ImageMagick — ImageMagick is a program to create, edit, compose, or convert bitmap images. This supports many formats, e.g., PNG, JPEG, GIF, TIFF, PDF, etc.
  • FFmpeg — FFmpeg is a powerful tool for converting audio and video files.
  • PhantomJS — PhantomJS is a headless WebKit scriptable with a JavaScript API. It has fast and native support for various web standards: DOM handling, CSS selector, JSON, Canvas, and SVG.

Examples

$ git clone https://github.com/akabe/docker-ocaml-jupyter-datascience.git
$ docker run -it -p 8888:8888 -v $PWD/docker-ocaml-jupyter-datascience/notebooks:/notebooks akabe/ocaml-jupyter-datascience

Contribution

If you know a widely-used numerical library in OCaml, find a bug, or have an idea to improve this environment, please create an issue or pull-request your changes.

docker-ocaml-jupyter-datascience's People

Contributors

akabe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-ocaml-jupyter-datascience's Issues

Failed to update notebook.json

I require permission of notebook.json

[E 02:11:27.081 NotebookApp]�(B Unhandled error in API request
    Traceback (most recent call last):
      File "/home/opam/.local/lib/python3.4/site-packages/notebook/base/handlers.py", line 516, in wrapper
        result = yield gen.maybe_future(method(self, *args, **kwargs))
      File "/home/opam/.local/lib/python3.4/site-packages/tornado/web.py", line 2897, in wrapper
        return method(self, *args, **kwargs)
      File "/home/opam/.local/lib/python3.4/site-packages/notebook/services/config/handlers.py", line 33, in patch
        section = self.config_manager.update(section_name, new_data)
      File "/home/opam/.local/lib/python3.4/site-packages/notebook/services/config/manager.py", line 34, in update
        return self.write_config_manager.update(section_name, new_data)
      File "/home/opam/.local/lib/python3.4/site-packages/traitlets/config/manager.py", line 87, in update
        self.set(section_name, data)
      File "/home/opam/.local/lib/python3.4/site-packages/traitlets/config/manager.py", line 74, in set
        f = io.open(filename, 'w', encoding='utf-8')
    PermissionError: [Errno 13] Permission denied: '/home/opam/.jupyter/nbconfig/notebook.json'
[E 02:11:27.085 NotebookApp]�(B {
      "Content-Length": "54",
      "X-Xsrftoken": "2|3a14d2c6|5549e687b33cfb88c1b4bd965e09ce45|1501464047",
      "Connection": "keep-alive",
      "Accept-Encoding": "gzip, deflate, br",
      "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.101 Safari/537.36",
      "Accept-Language": "ja,en-US;q=0.8,en;q=0.6",
      "Origin": "http://localhost:8889",
      "Host": "localhost:8889",
      "X-Requested-With": "XMLHttpRequest",
      "Accept": "application/json, text/javascript, */*; q=0.01",
      "Content-Type": "application/json",
      "Referer": "http://localhost:8889/tree",
      "Cookie": "_xsrf=2|3a14d2c6|5549e687b33cfb88c1b4bd965e09ce45|1501464047; username-localhost-8888=\"2|1:0|10:1503969762|23:username-localhost-8888|44:Y2EwY2YyYjI1MDU1NGYwOTliMzk1NTU2NGQyNmJiYmE=|5712adb5f63bdf6f10082d069c6d9e537f235fe61cb50308804ceee270562c89\"; username-localhost-8889=\"2|1:0|10:1503972674|23:username-localhost-8889|44:MjZiMTQyZGE2ZDk2NDIwMTgwZjkwYjAzZWQ4MWY4OGY=|1a455214b1355b832fd54d2a841fcbeaba2e031343e981c9356f82ffa1e2904c\""
    }
[E 02:11:27.086 NotebookApp]�(B 500 PATCH /api/config/notebook (172.17.0.1) 6.79ms referer=http://localhost:8889/tree

Code Completion Not Working Within Container

I am not able to tab complete code when using Jupyter Ocaml inside docker container.
Here is an example:

#require "core";;
Core.<tab completion>

Pressing tab after "Core." does not bring up list of items.

Perhaps we may need to add merlin into the container. Will this solve the problem?

PhantomJS

$ sudo apt-get install -y phantomjs  # jessie-backports
$ sudo ln -sf /etc/fonts /usr/lib/x86_64-linux-gnu/fonts
$ QT_QPA_PLATFORM=offscreen phantomjs ...

Add multi-language fonts

jupyter.archimedes cannot plot non-ASCII characters.

let vp = A.init ["jupyter"] in
A.Axes.box vp ;
A.Viewport.title vp "こんにちは" ;
A.Viewport.select_font_face_direct vp A.Backend.Upright A.Backend.Normal "Droid" () ;
A.fx vp sin 0.0 10.0 ;
A.close vp ;

non-ascii-plot

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.