I thought that .Net Interactive only supports .Net Core3, but I was told that it also supports .Net5. It seems that I can go when I tried it.
python
~Abbreviation~
+++ # Install .NET5
+++ RUN wget -O dotnet.tar.gz https://download.visualstudio.microsoft.com/download/pr/a0487784-534a-4912-a4dd-017382083865/be16057043a8f7b6f08c902dc48dd677/dotnet-sdk-5.0.101-linux-x64.tar.gz \
+++ && wget -O dotnet_runtime.tar.gz https://download.visualstudio.microsoft.com/download/pr/6bea1cea-89e8-4bf7-9fc1-f77380443db1/0fb741b7d587cce798ebee80732196ef/aspnetcore-runtime-5.0.1-linux-x64.tar.gz \
+++ && dotnet_sha512='398d88099d765b8f5b920a3a2607c2d2d8a946786c1a3e51e73af1e663f0ee770b2b624a630b1bec1ceed43628ea8bc97963ba6c870d42bec064bde1cd1c9edb' \
&& echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \
+++ && dotnet_runtime_sha512='fec655aed2e73288e84d940fd356b596e266a3e74c37d9006674c4f923fb7cde5eafe30b7dcb43251528166c02724df5856e7174f1a46fc33036b0f8db92688a' \
&& echo "$dotnet_runtime_sha512 dotnet_runtime.tar.gz" | sha512sum -c - \
&& mkdir -p "/usr/share/dotnet" \
&& mkdir -p "/usr/bin/dotnet" \
&& mkdir -p "/root/.dotnet/tools" \
&& tar zxf dotnet.tar.gz -C "/usr/share/dotnet" \
&& rm dotnet.tar.gz \
&& tar zxf dotnet_runtime.tar.gz -C "/usr/share/dotnet" \
&& rm dotnet_runtime.tar.gz \
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
&& dotnet help
+++ RUN dotnet tool install -g --add-source "https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" Microsoft.dotnet-interactive \
&& dotnet interactive jupyter install
~Abbreviation~
Record type was usable.
I didn't know, but it seems that nuget can also be used with # r" nuget: XXXXX "
.
I want to see other things that can be done.
See interactive samples for more information.
I've been using python for a while now, and I've been wondering if I can use jupyterlab. I learned from this article that other languages also work, and I was impressed that I could try various languages immediately if I prepared one environment, so I thought I would make one on my PC. It was.
I often use C #, and I didn't like the number of ConsoleApp 1 and 2 ... increasing every time I executed simple code, so I'm happy that C # can be executed in jupyterlab, so I want to run C #. However, C # was not included in 14 languages, so I added it.
First, clone the repository from @ HeRo's github page.
git clone https://github.com/HeRoMo/jupyter-langs.git
The docker image should be called from the Dockerfile instead of being called in yml.
version: "3"
services:
jupyter:
--- image: ghcr.io/heromo/jupyter-langs:latest
+++ build:
+++ context: .
+++ dockerfile: Dockerfile
volumes:
- ./notebooks:/jupyter/notebooks
ports:
- 8050:8050 # for Dash
- 8888:8888 # for Jupyterlab
Dockerfile
For Dockerfile, either directly rewrite the cloned one or prepare something like the one below with another name.
Read the image with FROM ghcr.io/heromo/jupyter-langs:latest
and add the C # part.
(I also added the jupyterlab extension)
python
# jupyter-langs:latest
FROM ghcr.io/heromo/jupyter-langs:latest
# add jupyter extension
RUN jupyter labextension install \
@lckr/jupyterlab_variableinspector \
@jupyterlab/toc \
@jupyterlab/debugger
ENV DOTNET_ROOT=/usr/share/dotnet
ENV PATH=/usr/share/dotnet:/root/.dotnet/tools:$PATH
# Install .NET Core SDK
RUN wget -O dotnet.tar.gz https://download.visualstudio.microsoft.com/download/pr/ec187f12-929e-4aa7-8abc-2f52e147af1d/56b0dbb5da1c191bff2c271fcd6e6394/dotnet-sdk-3.1.404-linux-x64.tar.gz \
&& wget -O dotnet_runtime.tar.gz https://download.visualstudio.microsoft.com/download/pr/eca743d3-030f-4b1b-bd15-3573091f1c02/f3e464abc31deb7bc2747ed6cc1a8f5c/aspnetcore-runtime-3.1.10-linux-x64.tar.gz \
&& dotnet_sha512='94d8eca3b4e2e6c36135794330ab196c621aee8392c2545a19a991222e804027f300d8efd152e9e4893c4c610d6be8eef195e30e6f6675285755df1ea49d3605' \
&& echo "$dotnet_sha512 dotnet.tar.gz" | sha512sum -c - \
&& dotnet_runtime_sha512='884ec943eefc8397537a193d48d481eae8869eb82a8149f11b8a8bbca0cd75307e82e4db04a2329f03f8a50519afa27c0caa79193fb35a9c776efe1aff2d07a0' \
&& echo "$dotnet_runtime_sha512 dotnet_runtime.tar.gz" | sha512sum -c - \
&& mkdir -p "/usr/share/dotnet" \
&& mkdir -p "/usr/bin/dotnet" \
&& mkdir -p "/root/.dotnet/tools" \
&& tar zxf dotnet.tar.gz -C "/usr/share/dotnet" \
&& rm dotnet.tar.gz \
&& tar zxf dotnet_runtime.tar.gz -C "/usr/share/dotnet" \
&& rm dotnet_runtime.tar.gz \
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet \
&& dotnet help
RUN dotnet tool install -g Microsoft.dotnet-interactive \
&& dotnet interactive jupyter install
CMD ["jupyter", "lab", "--no-browser", "--ip=0.0.0.0", "--allow-root", "--notebook-dir=/jupyter/notebooks", "--config=$JUPYTER_DIR/jupyter_notebook_config.py"]
Build and launch.
python
docker-compose up -d --build
If you can start it without any problem, you can see the jupyterlab page by accessing http://XXX.XXX.XXX.XXX:8888/lab?
from your browser.
It is OK if .net (C #) etc. are increasing.
I will also try to execute the code.
Did it. I was able to run it without any problems!
https://qiita.com/HeRo/items/61e7f45a5dbb5fd0e4a7 https://github.com/HeRoMo/jupyter-langs https://github.com/JDelemar/dockerfiles/tree/master/jupyterlab-dotnet https://edi.wang/post/2019/9/29/setup-net-core-30-runtime-and-sdk-on-raspberry-pi-4 https://aquasoftware.net/blog/?p=1379
Thanks for the URL above.