Closed Naereen closed 3 years ago
Adding these packages would be relatively easy. But the better solution is probably to base the docker image on one of these Docker images which has the dependencies already. I vaguely remember running into a problem when I tried this originally. Perhaps it is time to try it again.
It looks like the python in the datascience Docker image might be too old to use pip anymore...
Waiting for build to start...
Picked Git content provider.
Cloning into '/tmp/repo2dockerzjy5pyb9'...
HEAD is now at af9e650 Is this newer?
Using DockerBuildPack builder
Step 1/4 : FROM akabe/ocaml-jupyter-datascience:debian_ocaml4.05.0
---> 0dc642ff8666e...
Step 2/4 : RUN sudo pip3 install --upgrade pip
---> Running in 53ecb9670f57
Collecting pip
Downloading https://files.pythonhosted.org/packages/5c/e0/be401c003291b56efc55aeba6a80ab790d3d4cece2778288d65323009420/pip-19.1.1-py2.py3-none-any.whl (1.4MB)
Installing collected packages: pip
Found existing installation: pip 9.0.1
Uninstalling pip-9.0.1:
Successfully uninstalled pip-9.0.1
Successfully installed pip-19.1.1
Removing intermediate container 53ecb9670f57
---> 61fe40a721fa
Step 3/4 : RUN sudo pip3 install nbgitpuller
---> Running in ecb1c83f1509
DEPRECATION: Python 3.4 support has been deprecated. pip 19.1 will be the last one supporting it. Please upgrade your Python as Python 3.4 won't be maintained after March 2019 (cf PEP 429).
Collecting nbgitpuller
Downloading https://files.pythonhosted.org/packages/7b/5b/f7e0bbfad992e1b438cd0ae648185b7d62c4e02e9b9902857397275bfe27/nbgitpuller-0.9.0-py2.py3-none-any.whl
Collecting tornado (from nbgitpuller)
Downloading https://files.pythonhosted.org/packages/e6/78/6e7b5af12c12bdf38ca9bfe863fcaf53dc10430a312d0324e76c1e5ca426/tornado-5.1.1.tar.gz (516kB)
ERROR: Complete output from command python setup.py egg_info:
ERROR: Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named 'setuptools'
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-c_wh9eam/tornado/
Removing intermediate container ecb1c83f1509
The command '/bin/sh -c sudo pip3 install nbgitpuller' returned a non-zero code: 1
Thanks for the reply. I won't have more time to give to this issue, I tried all the notebooks last night and spend already quite some time on this.
If you fix it, good, otherwise too bad.
Maybe the problem is just the binder link on https://github.com/akabe/ocaml-jupyter/#running-ocaml-jupyter-on-binder, which does not load the correct (most up-to-date) Docker version? I don't know.
The problem is that the datascience Docker images are very out of date. I will try to install the packages you suggested in the current version which does not use the datascience images.
I don't know what's the best plan. @akabe do you think there exists more up-to-date Docker images for OCaml + Jupyter + datascience ? If so, maybe the easiest solution is just to update the link and the mybinder badge and link you give in https://github.com/akabe/ocaml-jupyter/#running-ocaml-jupyter-on-binder Thanks in advance!
I've been working on this some more on the develop
branch. We install many more of the dependencies now, but there are still problems. As @naereen noted, the cohttp examples do not work. I believe this is because the modules are now named cohttp-async
instead of cohttp.async
. This is simple enough to fix, but doing so would break the notebooks for the datascience image.
The other problem is that adding all these packages makes the binder build process very slow.
I propose to install the packages required only for the introduction notebook, and to change the link on the ocaml-jupyter
README to only link to that notebook.
@Naereen @edmcman Sorry for late reply. My docker images (especially datascience) are no loger maintained because it takes time and effort. I agree with @edmcman's opinion:
But the better solution is probably to base the docker image on one of these Docker images which has the dependencies already.
However, I note that installing and updating many packages will consume your time. I recommend to include only popular libraries in a new datascience image if you try to create it.
Hi @akabe, Thanks for the reply, and I completely understand that this takes time. I've never been convinced by Docker images for a local personal usage, and find them completely useless for data-science in general... except that MyBinder is based on them!! So my issue and question was only opened with the goal of improving/fixing the possible usage of ocaml-jupyter in MyBinder.
I don't want to take the responsibility of keeping the Docker image(s) up-to-date either, sorry... I'm teaching introduction to computer science classes and introduction to OCaml, not advanced data science using OCaml, so for my teaching activities this project is not "vital".
Regards, @Naereen
I've changed the image so that archimedes is installed and the introduction notebook is now fully functional. I also created a pull request against akabe/ocaml-jupyter#170 to link directly to the introduction notebook. Hopefully all agree this is a reasonable solution for now since it seems like none of us want to devote a lot of time to create a new up-to-date image for the example notebooks.
Hello there @edmcman and @akabe and @sei-eschwartz, (long time user of ocaml-jupyter here)
I just tried again the binder environment based on this Docker image, and all the notebooks. Lots of missing packages, some notebooks are broken, here are the errors I got, with screenshots and the detailed list of notebooks:
plplot.ipynb
introduction.ipynb
Apparently, it's enough to add the
jupyter-archimedes
package to opam, as runningworked from the notebook itself!
slap_two_layer_neural_network
Again, it seems that it's easy to fix:
So it should just be a matter of adding these two packages
core
andslap
in the Docker file... I don't know why it broke, but here's the full output: failed_install_of_Core.txtsimple_image_filtering.ipynb
__width__
shows the part which is underlined by the error message)File "[3]", line 4, characters 65-70: Error: The function applied to this argument has type w:int -> h:int -> Cairo.Surface.t This argument cannot be applied without label 3: let pixels = reshape_1 (genarray_of_array3 rgba) (height width 4) in 4: Cairo.Image.(create_for_data8 ~stride:(width * 4) pixels RGB24 width height)
File "[7]", line 8, characters 28-49: Error: This expression has type string -> unit but an expression was expected of type Cairo.Surface.t 7: let b = Buffer.create 256 in 8: Cairo.PNG.write_to_stream __(Buffer.add_string b)__ (create_rgba_image rgba) ;
The next of
~output:(...)
should remove the label, it's not available inCairo
library anymore.random_dataset_generation.ipynb
Again same problem, I don't include screenshots:
I tried
Sys.command "opam install gsl";;
which couldn't compile as the linux packagelibgsl-dev
is not installed. I think it should be easy to add aapt install libgsl-dev
to the Dockerfile.formant_estimation_by_AR.ipynb
I thought it will have the same problem with
Core
module unavailable, but no it worked! However, loadingFFTW3
failed here too, like in the next notebook.In the next code cell, there is a
Sys.command ...
callingffmpeg
which is unavailable in the Docker image! Again I think it should be easy to add aapt install ffmpeg
to the Dockerfile.The next cells are broken but I think correct, they just don't have the Fftw3 module and the sound file, as
ffpmeg
was unavaible.fftw3_example.ipynb
I could ask to install it using
Sys.command "opam install fftw3
again, but the compilation failed, as the system (linux) packagebfftw3-dev
is missing. Again I think it should be easy to add aapt install bfftw3-dev
to the Dockerfile. RunningSys.command "apt search bfftw3-dev"
gaveso it's indeed available in the apt repository for this Docker image.
owl.ipynb
Again,
No such package: owl
. And runningSys.command "opam install owl";;
took a long time, apparently it works for most steps butTherefore
liblapacke-dev
andlibopenblas-dev
linux/Debian package are missing.gaussian_random_walk.ipynb
Same problem with
gsl
package not present, andlibgsl-dev
not present on the system.cohttp_lwt_DuckDuckGoAPI.ipynb
No such package: cohttp.lwt
, butSys.command "opam install cohttp";;
worked!Then
open Lwt.Infix ;;
failed, but it's easy to fix it: just run#require "lwt";;
the cell before.Later,
Lwt_main
was missing, so I ranSys.command "opan install cohttp-lwt cohttp-lwt-unix
(which takes a long time!) but then#require "Cohttp_lwt";;
failed (missing). I have no idea, even after reading the OCaml-Cohttp GitHub page and its page on OPAM...It's possible that the OPAM packages index on the Docker image are outdated, as the system gave me a warning, and I saw that the versions of cohttp which were being installed were
2.4.0
but it's 3.0.0 on OPAM... So, I tried to runSys.command "opam update"
, but couldn't upgrade to more recent version of Cohttp:cohttp_async_DuckDuckGoAPI.ipynb
Same problem but with
cohttp-async
. I didn't try.Conclusion
To all the changes that are in Jupyter notebook code, I can submit a pull request for them, if you think the changes explained here are good and the PR will be merged ;
I'm not an expert of Docker and Dockerfile but I could try to add the missing dependencies, if you don't have time to try yourself!
These OPAM packages are missing:
gsl Core jupyter-archimedes core slap fftw3 owl
These linux/Debian packages are missing:
libgsl-dev ffpmeg libfftw3-dev liblapacke-dev libopenblas-dev libblas-dev liblapack-dev
Adding these should solve all the issues detailed above, except the Cohttp_lwt problem.
Cheers, regards from France, @NaereenHello there @edmcman and @akabe and @sei-eschwartz, (long time user of ocaml-jupyter here)
I just tried again the binder environment based on this Docker image, and all the notebooks. Lots of missing packages, some notebooks are broken, here are the errors I got, with screenshots and the detailed list of notebooks:
plplot.ipynb
introduction.ipynb
Apparently, it's enough to add the
jupyter-archimedes
package to opam, as runningworked from the notebook itself!
slap_two_layer_neural_network
Again, it seems that it's easy to fix:
So it should just be a matter of adding these two packages
core
andslap
in the Docker file... I don't know why it broke, but here's the full output: failed_install_of_Core.txtsimple_image_filtering.ipynb
__width__
shows the part which is underlined by the error message)File "[3]", line 4, characters 65-70: Error: The function applied to this argument has type w:int -> h:int -> Cairo.Surface.t This argument cannot be applied without label 3: let pixels = reshape_1 (genarray_of_array3 rgba) (height width 4) in 4: Cairo.Image.(create_for_data8 ~stride:(width * 4) pixels RGB24 width height)
File "[7]", line 8, characters 28-49: Error: This expression has type string -> unit but an expression was expected of type Cairo.Surface.t 7: let b = Buffer.create 256 in 8: Cairo.PNG.write_to_stream __(Buffer.add_string b)__ (create_rgba_image rgba) ;
The next of
~output:(...)
should remove the label, it's not available inCairo
library anymore.random_dataset_generation.ipynb
Again same problem, I don't include screenshots:
I tried
Sys.command "opam install gsl";;
which couldn't compile as the linux packagelibgsl-dev
is not installed. I think it should be easy to add aapt install libgsl-dev
to the Dockerfile.formant_estimation_by_AR.ipynb
I thought it will have the same problem with
Core
module unavailable, but no it worked! However, loadingFFTW3
failed here too, like in the next notebook.In the next code cell, there is a
Sys.command ...
callingffmpeg
which is unavailable in the Docker image! Again I think it should be easy to add aapt install ffmpeg
to the Dockerfile.The next cells are broken but I think correct, they just don't have the Fftw3 module and the sound file, as
ffpmeg
was unavaible.fftw3_example.ipynb
I could ask to install it using
Sys.command "opam install fftw3
again, but the compilation failed, as the system (linux) packagebfftw3-dev
is missing. Again I think it should be easy to add aapt install bfftw3-dev
to the Dockerfile. RunningSys.command "apt search bfftw3-dev"
gaveso it's indeed available in the apt repository for this Docker image.
owl.ipynb
Again,
No such package: owl
. And runningSys.command "opam install owl";;
took a long time, apparently it works for most steps butTherefore
liblapacke-dev
andlibopenblas-dev
linux/Debian package are missing.gaussian_random_walk.ipynb
Same problem with
gsl
package not present, andlibgsl-dev
not present on the system.cohttp_lwt_DuckDuckGoAPI.ipynb
No such package: cohttp.lwt
, butSys.command "opam install cohttp";;
worked!Then
open Lwt.Infix ;;
failed, but it's easy to fix it: just run#require "lwt";;
the cell before.Later,
Lwt_main
was missing, so I ranSys.command "opan install cohttp-lwt cohttp-lwt-unix
(which takes a long time!) but then#require "Cohttp_lwt";;
failed (missing). I have no idea, even after reading the OCaml-Cohttp GitHub page and its page on OPAM...It's possible that the OPAM packages index on the Docker image are outdated, as the system gave me a warning, and I saw that the versions of cohttp which were being installed were
2.4.0
but it's 3.0.0 on OPAM... So, I tried to runSys.command "opam update"
, but couldn't upgrade to more recent version of Cohttp:cohttp_async_DuckDuckGoAPI.ipynb
Same problem but with
cohttp-async
. I didn't try.Conclusion
To all the changes that are in Jupyter notebook code, I can submit a pull request for them, if you think the changes explained here are good and the PR will be merged ;
I'm not an expert of Docker and Dockerfile but I could try to add the missing dependencies, if you don't have time to try yourself!
These OPAM packages are missing:
gsl Core jupyter-archimedes core slap fftw3 owl
These linux/Debian packages are missing:
libgsl-dev ffpmeg libfftw3-dev liblapacke-dev libopenblas-dev libblas-dev liblapack-dev
Adding these should solve all the issues detailed above, except the Cohttp_lwt problem.
Cheers, regards from France, @Naereen