Repository: deno
Issue: jupyter deno notebook - ffi issue
Labels: bug,deno jupyter


```bash
~/poc-data-visualization$ docker-compose exec -T jupyter_deno bash -c "source ~/.bashrc && deno --version"
deno 1.40.5 (release, x86_64-unknown-linux-gnu)
v8 12.1.285.27
typescript 5.3.3

```

## Issue Description

Hello awesome `deno` team, I recently am running a jupyter/deno notebook, inside a container.

I designed the `Dockerfile` myself, and in my notebook, I try and use an HTML canvas. As I do so, I stumble upon an issue I caan't fathom how to solve.

First, here is the startup script I use as `CMD` in my docker file:

```bash
#!/bin/bash

export PATH="$PATH:$HOME/.cargo/bin"
source ~/.bashrc

pwd

cargo --version


deno --version
deno jupyter --install --unstable-ffi




# tested works # jupyter notebook --unstable true --ip 0.0.0.0 --allow-root
export NOTEBOOKS_DIR=$DATAVIZ_NOTEBOOKS_HOME
jupyter lab --unstable-ffi=true --ip=0.0.0.0 --allow-root --NotebookApp.token='pesto' --NotebookApp.password='pesto' --notebook-dir="$NOTEBOOKS_DIR"

```


The error I get as I execute my notebook is visible in the webbrowser, and no error shows up in my docker container logs (as you can see, it definitely is the canvas deno which throws the error) : 

![image](https://github.com/denoland/deno/assets/35227860/d454e4c3-bb1f-4ce8-b57b-fa0a8588e136)

Note:
* As you can see, I did use, as [instructed by the deno documentation](https://docs.deno.com/runtime/manual/tools/jupyter), the `--unstable` option flag. 
* In my `Dockerfile`, I install the kernel with `deno jupyter --install --unstable`, also as [instructed by the deno docs](https://docs.deno.com/runtime/manual/tools/jupyter)
* That's why, I also added in the startup script above, to even add the `deno jupyter --install --unstable-ffi` kernel installation command (and i kept the `deno jupyter --install --unstable` in my `Dockerfile`): I still get the exact same error
* also note that i do install in my `Dockerfile` (debian based), the `libffi-dev` package.
* Finally, i found https://github.com/denoland/deno/issues/21907#issuecomment-1888771423 : 
  * In my `Dockerfile`, I am in a GNU/linux Debian , plus i run the container on a GNU/Linux Debian VM. 
  * Does it mean it is not possible to solve my issue, and to use ffi in my notebook, while i run it in a GNU/Linux docker container context ? 
  * If so, is there any plan to solve this, I can't afford to ask my users to run their notebooks locally, and only on a windows machine...


## The Dockerfile

please forgive me for it is messy, I'm in an early stage:

```Dockerfile
## ARG BASE_IMAGE=denoland/deno:debian-1.40.5
# inspired by:
#  - https://blog.logrocket.com/deno-jupyter-notebook-data-dashboard/
#  - https://blog.jupyter.org/bringing-modern-javascript-to-the-jupyter-notebook-fc998095081e
#  - https://docs.deno.com/runtime/manual/tools/jupyter
#
# https://hub.docker.com/layers/library/python/3.13.0a4-slim-bookworm/images/sha256-225ac4a4b47349833efc94d61b93c8784279341aff99e714f6ca455ca9232509?context=explore
# ARG BASE_IMAGE=python:3.13.0a4-slim-bookworm
ARG BASE_IMAGE=python:3.10-slim

FROM $BASE_IMAGE as build

ARG BASE_IMAGE=$BASE_IMAGE
ARG DATAVIZ_NOTEBOOKS_HOME=/usr/dataviz/notebooks/decoderleco
ENV DATAVIZ_NOTEBOOKS_HOME=$DATAVIZ_NOTEBOOKS_HOME

RUN apt-get update -y && \
    echo " >>>>>> OK UPDATE COMPLETE " && \
    apt-get install -y curl && \
    echo " >>>>>> OK INSTALL [curl] COMPLETE " && \
    apt-get install -y jq && \
    echo " >>>>>> OK INSTALL [jq] COMPLETE " && \
    apt-get install -y build-essential && \
    echo " >>>>>> OK INSTALL [build-essential] COMPLETE " && \
    apt-get install -y unzip && \
    echo " >>>>>> OK INSTALL [unzip] COMPLETE " && \
    curl -fsSL https://deno.land/install.sh | sh && \
    echo " >>>>>> OK INSTALL [DENO] COMPLETE "
RUN echo " >>>>>> start rust install" && curl https://sh.rustup.rs -sSf | sh -s -- -y && \
    echo " >>>>>> OK INSTALL [RUST +CARGO] COMPLETE "
RUN echo "export PATH=\"\$PATH:\$HOME/.cargo/bin\"" | tee -a ~/.shrc | tee -a ~/.bashrc && bash -c 'source "$HOME/.cargo/env"'
RUN ls $HOME/.cargo/bin
RUN export PATH="$PATH:$HOME/.cargo/bin" && cargo --version
RUN apt-get install -y build-essential libssl-dev libffi-dev libzmq3-dev
# >> reparations
# RUN apt-get install -y build-essential libssl-dev libffi-dev libzmq3-dev && apt-get install -y --fix-broken
RUN apt-get install -y build-essential libssl-dev libffi-dev libzmq3-dev

# RUN export PATH="$PATH:$HOME/.cargo/bin" && export PIP_DEFAULT_TIMEOUT=200 && python --version && python -m pip install pyzmq --trusted-host pypi.org --trusted-host files.pythonhosted.org

WORKDIR /app
COPY requirements.txt /app
# RUN pip install -r requirements.txt
RUN python -m pip install --upgrade pip
RUN export PATH="$PATH:$HOME/.cargo/bin" && export PIP_DEFAULT_TIMEOUT=200 && pip install -r requirements.txt

RUN export PATH="$PATH:$HOME/.cargo/bin" && export PIP_DEFAULT_TIMEOUT=200 && pip install jupyterlab notebook && \
    echo " >>>>>> OK INSTALL [pip install jupyterlab notebook] COMPLETE "
RUN curl -fsSL https://deno.land/install.sh | sh && \
    echo 'export DENO_INSTALL="/root/.deno"' | tee -a ~/.bashrc | tee -a ~/.shrc && \
    echo 'export PATH="$DENO_INSTALL/bin:$PATH"' | tee -a ~/.bashrc | tee -a ~/.shrc && \
    echo " >>>>>> OK INSTALL [DENO] COMPLETE "
RUN bash -c 'source ~/.bashrc && deno jupyter --unstable --install' && \
    echo " >>>>>> OK INSTALL [deno jupyter --unstable --install] COMPLETE "

RUN mkdir -p $DATAVIZ_NOTEBOOKS_HOME


FROM build as runner

RUN mkdir -p /run


COPY start.sh .
RUN chmod +x ./start.sh && mv ./start.sh /run

# CMD [ "jupyter", "notebook" ]

WORKDIR /usr/dataviz/notebooks/decoderleco
EXPOSE 8888
# CMD [ "jupyter", "notebook", "--unstable" ]
CMD [ "/run/start.sh" ]

```