dahn-zk / zsh-jupyter-kernel

Z shell kernel for Jupyter Notebook
Other
80 stars 6 forks source link

SyntaxError: invalid syntax while installing #7

Closed 11philip22 closed 3 years ago

11philip22 commented 4 years ago

Hi, When i try to install the package in my jupyter docker container using:

python3 -m pip install notebook zsh_jupyter_kernel
python3 -m zsh_jupyter_kernel.install --sys-prefix

I get this error:

Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/gopher/.local/lib/python3.5/site-packages/zsh_jupyter_kernel/install.py", line 9, in <module>
    from .config import config
  File "/home/gopher/.local/lib/python3.5/site-packages/zsh_jupyter_kernel/config.py", line 14
    config : Dict[str, Any] = {}
           ^
SyntaxError: invalid syntax

This is my dockerfile

FROM golang:1.9

# Install Jupyter Notebook
# `hash -r pip` is a workaround of pip v10 related issue (https://github.com/pypa/pip/issues/5221#issuecomment-382069604)
RUN apt-get update \
    && apt-get install -y libzmq3-dev python3-pip \
    && rm -rf /var/lib/apt/lists/*
RUN pip3 install --upgrade pip && hash -r pip \
    && pip3 install -U jupyter jupyterlab \
    && jupyter serverextension enable --py jupyterlab --sys-prefix

# Install lgo Jupyter lab extension to support code formatting.
# Please remove this line if you do not use JupyterLab.
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
  apt-get install -y nodejs && \
  jupyter labextension install @yunabe/lgo_extension && jupyter lab clean && \
  apt-get remove -y nodejs --purge && rm -rf /var/lib/apt/lists/*

# Support UTF-8 filename in Python (https://stackoverflow.com/a/31754469)
ENV LC_CTYPE=C.UTF-8

ENV LGOPATH /lgo
RUN mkdir -p $LGOPATH

# Add a non-root user with uid:1000 to follow the convention of mybinder to use this image from mybinder.org.
# https://mybinder.readthedocs.io/en/latest/dockerfile.html
ARG NB_USER=gopher
ARG NB_UID=1000
ENV HOME /home/${NB_USER}
RUN adduser --disabled-password \
    --gecos "Default user" \
    --uid ${NB_UID} \
    --home ${HOME} \
    ${NB_USER}
RUN chown -R ${NB_USER}:${NB_USER} ${HOME} $GOPATH $LGOPATH
USER ${NB_USER}
WORKDIR ${HOME}

# Install lgo
RUN go get github.com/yunabe/lgo/cmd/lgo && go get -d github.com/yunabe/lgo/cmd/lgo-internal \
    && lgo install \
    && python3 $GOPATH/src/github.com/yunabe/lgo/bin/install_kernel

# install bash_kernel
RUN git clone https://github.com/takluyver/bash_kernel.git \
    && python3 bash_kernel/bash_kernel/install.py \
    && rm -rf bash_kernel

# install zsh_kernel
RUN python3 -m pip install notebook zsh_jupyter_kernel
RUN python3 -m zsh_jupyter_kernel.install --sys-prefix

# Notes:
# 1. Do not use ENTRYPOINT because mybinder need to run a custom command.
# 2. To use JupyterLab, replace "notebook" with "lab".
# 3. Set --allow-root in case you want to run jupyter as root.
CMD ["jupyter", "lab", "--ip=0.0.0.0"]
dahn-zk commented 4 years ago

Hey, @11philip22. Sorry for such a long time. You'll be able to solve the issue by installing a newer python in your Dockerfile before installing the kernels, at least version 3.7.

11philip22 commented 4 years ago

Hi @danylo-dubinin, thanks for responfing. I will give it a try!