pebbe / zmq4

A Go interface to ZeroMQ version 4
BSD 2-Clause "Simplified" License
1.17k stars 166 forks source link

error: pebbe/zmq4/reactor.go:10:4: undefined: State #157

Open Zireael opened 4 years ago

Zireael commented 4 years ago

Getting error from pebbe as dependency of gophernotes. I've raised an issue with gophernotes, but it might be it's more something to do with pebbe: https://github.com/gopherdata/gophernotes/issues/188 Installation under alpine linux worked for me - not sure what I'm missing for Debian/Ubuntu

During gophernotes install via Debian/Ubuntu dockerfile I get error: image

Dockerfile (based on Ubuntu/jupyterlab) with failing example Trying to go install pebbe or go install gophernotes fails:

FROM jupyter/base-notebook:lab-1.2.1

ENV DEBIAN_FRONTEND=noninteractive

USER root

# installing any dependencies I suspect might be required
RUN apt-get update && \
    apt-get install -yq --no-install-recommends libzmq3-dev

# Go

RUN conda install go git

ENV GOPATH="/go" PATH="$PATH:/opt/conda/go/bin"

RUN go version

RUN apt list --installed
RUN conda list
RUN pip list

# Trying to go install pebbe or go install gophernotes fails here:
# RUN apt-get update && apt-get install -yq --no-install-recommends libzmq3-dev pkg-config libsodium-dev
# RUN go get github.com/pebbe/zmq4
RUN go get -u github.com/gopherdata/gophernotes
# RUN go get -tags zmq_4_x github.com/gophergala2016/gophernotes
RUN find / -type d -name "gophernotes"

RUN mkdir -p /opt/conda/share/jupyter/kernels/gophernotes
RUN cp $GOPATH/src/github.com/gopherdata/gophernotes/kernel/* /opt/conda/share/jupyter/kernels/gophernotes

# RUN go get -u github.com/gopherdata/gophernotes
RUN go install github.com/gopherdata/gophernotes

ENV PATH="$PATH:/go/bin/gophernotes"

RUN du -h / | sort -rh | head -15

# Switch back to jovyan to avoid accidental container runs as root
USER $NB_UID

EXPOSE 8888

# Configure container startup
ENTRYPOINT ["tini", "-g", "--"]
# CMD ["start-notebook.sh", "--notebook-dir=/home/"]
CMD ["start-notebook.sh"]
pebbe commented 4 years ago

libzmq3-dev is required for zmq4. You made it a comment, so it's not installed.

Zireael commented 4 years ago

Hi, libzmq3-dev is installed earlier in my base image. I commented it out in my dockerfile just before gophernotes because I was specifically checking to install it, but got installer message that libzmq3-dev is already in the system. I updated the minimum failing example with specifically installing libzmq3-dev and then listing all the packages installed.

Fail message still remains (excuse crossed out lines - that's markdown syntax getting in the way):

RUN go get -u github.com/gopherdata/gophernotes github.com/gopherdata/gophernotes/vendor/github.com/pebbe/zmq4 /go/src/github.com/gopherdata/gophernotes/vendor/github.com/pebbe/zmq4/reactor.go:10:4: undefined: State /go/src/github.com/gopherdata/gophernotes/vendor/github.com/pebbe/zmq4/reactor.go:11:9: undefined: State The command '/bin/sh -c go get -u github.com/gopherdata/gophernotes' returned a non-zero code: 2

Here are lists of packages installed by apt, conda and pip:


RUN apt list --installed Listing... adduser/bionic,now 3.116ubuntu1 all [installed] apt/now 1.6.11 amd64 [installed,upgradable to: 1.6.12] base-files/now 10.1ubuntu2.4 amd64 [installed,upgradable to: 10.1ubuntu2.7] base-passwd/bionic,now 3.5.44 amd64 [installed] bash/now 4.4.18-2ubuntu1.1 amd64 [installed,upgradable to: 4.4.18-2ubuntu1.2] bsdutils/now 1:2.31.1-0.4ubuntu3.3 amd64 [installed,upgradable to: 1:2.31.1-0.4ubuntu3.4] bzip2/bionic-updates,bionic-security,now 1.0.6-8.1ubuntu0.2 amd64 [installed] ca-certificates/bionic,bionic-updates,now 20180409 all [installed] coreutils/bionic,now 8.28-1ubuntu1 amd64 [installed] dash/bionic,now 0.5.8-2.10 amd64 [installed] debconf/bionic-updates,now 1.5.66ubuntu1 all [installed] debianutils/bionic,now 4.8.4 amd64 [installed] diffutils/bionic,now 1:3.6-1 amd64 [installed] dpkg/now 1.19.0.5ubuntu2.1 amd64 [installed,upgradable to: 1.19.0.5ubuntu2.3] e2fsprogs/now 1.44.1-1ubuntu1.1 amd64 [installed,upgradable to: 1.44.1-1ubuntu1.2] fdisk/now 2.31.1-0.4ubuntu3.3 amd64 [installed,upgradable to: 2.31.1-0.4ubuntu3.4] findutils/bionic,now 4.6.0+git+20170828-2 amd64 [installed] fonts-liberation/bionic-updates,now 1:1.07.4-7~18.04.1 all [installed] gcc-8-base/now 8.3.0-6ubuntu1~18.04 amd64 [installed,upgradable to: 8.3.0-6ubuntu1~18.04.1] gpgv/bionic-updates,bionic-security,now 2.2.4-1ubuntu1.2 amd64 [installed] grep/bionic,now 3.1-2 amd64 [installed,upgradable to: 3.1-2build1] gzip/bionic,now 1.6-5ubuntu1 amd64 [installed] hostname/bionic,now 3.20 amd64 [installed] init-system-helpers/bionic,now 1.51 all [installed] libacl1/bionic,now 2.2.52-3build1 amd64 [installed] libapt-pkg5.0/now 1.6.11 amd64 [installed,upgradable to: 1.6.12] libattr1/bionic,now 1:2.4.47-2build1 amd64 [installed] libaudit-common/bionic,now 1:2.8.2-1ubuntu1 all [installed] libaudit1/bionic,now 1:2.8.2-1ubuntu1 amd64 [installed] libblkid1/now 2.31.1-0.4ubuntu3.3 amd64 [installed,upgradable to: 2.31.1-0.4ubuntu3.4] libbz2-1.0/bionic-updates,bionic-security,now 1.0.6-8.1ubuntu0.2 amd64 [installed] libc-bin/bionic,now 2.27-3ubuntu1 amd64 [installed] libc6/bionic,now 2.27-3ubuntu1 amd64 [installed] libcap-ng0/bionic,now 0.7.7-3.1 amd64 [installed] libcom-err2/now 1.44.1-1ubuntu1.1 amd64 [installed,upgradable to: 1.44.1-1ubuntu1.2] libdb5.3/bionic-updates,bionic-security,now 5.3.28-13.1ubuntu1.1 amd64 [installed] libdebconfclient0/bionic,now 0.213ubuntu1 amd64 [installed] libext2fs2/now 1.44.1-1ubuntu1.1 amd64 [installed,upgradable to: 1.44.1-1ubuntu1.2] libfdisk1/now 2.31.1-0.4ubuntu3.3 amd64 [installed,upgradable to: 2.31.1-0.4ubuntu3.4] libffi6/bionic,now 3.2.1-8 amd64 [installed] libgcc1/now 1:8.3.0-6ubuntu1~18.04 amd64 [installed,upgradable to: 1:8.3.0-6ubuntu1~18.04.1] libgcrypt20/bionic-updates,bionic-security,now 1.8.1-4ubuntu1.1 amd64 [installed] libgmp10/bionic,now 2:6.1.2+dfsg-2 amd64 [installed] libgnutls30/bionic-updates,bionic-security,now 3.5.18-1ubuntu1.1 amd64 [installed] libgpg-error0/bionic,now 1.27-6 amd64 [installed] libhogweed4/bionic,now 3.4-1 amd64 [installed] libidn2-0/bionic,now 2.0.4-1.1build2 amd64 [installed,upgradable to: 2.0.4-1.1ubuntu0.2] liblz4-1/bionic,now 0.0~r131-2ubuntu3 amd64 [installed] liblzma5/bionic,now 5.2.2-1.3 amd64 [installed] libmount1/now 2.31.1-0.4ubuntu3.3 amd64 [installed,upgradable to: 2.31.1-0.4ubuntu3.4] libncurses5/bionic-updates,now 6.1-1ubuntu1.18.04 amd64 [installed] libncursesw5/bionic-updates,now 6.1-1ubuntu1.18.04 amd64 [installed] libnettle6/bionic,now 3.4-1 amd64 [installed] libnorm1/bionic,now 1.5r6+dfsg1-6 amd64 [installed,automatic] libp11-kit0/bionic,now 0.23.9-2 amd64 [installed] libpam-modules/bionic-updates,now 1.1.8-3.6ubuntu2.18.04.1 amd64 [installed] libpam-modules-bin/bionic-updates,now 1.1.8-3.6ubuntu2.18.04.1 amd64 [installed] libpam-runtime/bionic-updates,now 1.1.8-3.6ubuntu2.18.04.1 all [installed] libpam0g/bionic-updates,now 1.1.8-3.6ubuntu2.18.04.1 amd64 [installed] libpcre3/bionic,now 2:8.39-9 amd64 [installed] libpgm-5.2-0/bionic,now 5.2.122~dfsg-2 amd64 [installed,automatic] libprocps6/bionic-security,now 2:3.3.12-3ubuntu1.1 amd64 [installed,upgradable to: 2:3.3.12-3ubuntu1.2] libpsl5/bionic,now 0.19.1-5build1 amd64 [installed,automatic] libseccomp2/bionic-updates,bionic-security,now 2.4.1-0ubuntu0.18.04.2 amd64 [installed] libselinux1/bionic,now 2.7-2build2 amd64 [installed] libsemanage-common/bionic,now 2.7-2build2 all [installed] libsemanage1/bionic,now 2.7-2build2 amd64 [installed] libsepol1/bionic,now 2.7-1 amd64 [installed] libsmartcols1/now 2.31.1-0.4ubuntu3.3 amd64 [installed,upgradable to: 2.31.1-0.4ubuntu3.4] libsodium23/bionic,now 1.0.16-2 amd64 [installed,automatic] libss2/now 1.44.1-1ubuntu1.1 amd64 [installed,upgradable to: 1.44.1-1ubuntu1.2] libssl1.1/now 1.1.1-1ubuntu2.1~18.04.4 amd64 [installed,upgradable to: 1.1.1-1ubuntu2.1~18.04.5] libstdc++6/now 8.3.0-6ubuntu1~18.04 amd64 [installed,upgradable to: 8.3.0-6ubuntu1~18.04.1] libsystemd0/now 237-3ubuntu10.22 amd64 [installed,upgradable to: 237-3ubuntu10.31] libtasn1-6/bionic,now 4.13-2 amd64 [installed] libtinfo5/bionic-updates,now 6.1-1ubuntu1.18.04 amd64 [installed] libudev1/now 237-3ubuntu10.22 amd64 [installed,upgradable to: 237-3ubuntu10.31] libunistring2/bionic-updates,now 0.9.9-0ubuntu2 amd64 [installed] libuuid1/now 2.31.1-0.4ubuntu3.3 amd64 [installed,upgradable to: 2.31.1-0.4ubuntu3.4] libzmq3-dev/bionic-updates,bionic-security,now 4.2.5-1ubuntu0.2 amd64 [installed] libzmq5/bionic-updates,bionic-security,now 4.2.5-1ubuntu0.2 amd64 [installed,automatic] libzstd1/bionic,now 1.3.3+dfsg-2ubuntu1 amd64 [installed,upgradable to: 1.3.3+dfsg-2ubuntu1.1] locales/bionic,now 2.27-3ubuntu1 all [installed] login/bionic-updates,now 1:4.5-1ubuntu2 amd64 [installed] lsb-base/bionic,now 9.20170808ubuntu1 all [installed] mawk/bionic,now 1.3.3-17ubuntu3 amd64 [installed] mount/now 2.31.1-0.4ubuntu3.3 amd64 [installed,upgradable to: 2.31.1-0.4ubuntu3.4] ncurses-base/bionic-updates,now 6.1-1ubuntu1.18.04 all [installed] ncurses-bin/bionic-updates,now 6.1-1ubuntu1.18.04 amd64 [installed] openssl/now 1.1.1-1ubuntu2.1~18.04.4 amd64 [installed,upgradable to: 1.1.1-1ubuntu2.1~18.04.5] passwd/bionic-updates,now 1:4.5-1ubuntu2 amd64 [installed] perl-base/bionic-updates,bionic-security,now 5.26.1-6ubuntu0.3 amd64 [installed] procps/bionic-security,now 2:3.3.12-3ubuntu1.1 amd64 [installed,upgradable to: 2:3.3.12-3ubuntu1.2] run-one/bionic,now 1.17-0ubuntu1 all [installed] sed/bionic,now 4.4-2 amd64 [installed] sensible-utils/bionic,now 0.0.12 all [installed] sudo/bionic-updates,bionic-security,now 1.8.21p2-3ubuntu1.1 amd64 [installed] sysvinit-utils/bionic,now 2.88dsf-59.10ubuntu1 amd64 [installed] tar/bionic-updates,now 1.29b-2ubuntu0.1 amd64 [installed] ubuntu-keyring/bionic-updates,now 2018.09.18.1~18.04.0 all [installed] util-linux/now 2.31.1-0.4ubuntu3.3 amd64 [installed,upgradable to: 2.31.1-0.4ubuntu3.4] wget/bionic-updates,bionic-security,now 1.19.4-1ubuntu2.2 amd64 [installed] zlib1g/bionic,now 1:1.2.11.dfsg-0ubuntu2 amd64 [installed]

RUN conda list packages in environment at /opt/conda:

Name Version Build Channel _libgcc_mutex 0.1 main defaults alembic 1.3.0 py_0 conda-forge async_generator 1.10 py_0 conda-forge attrs 19.3.0 py_0 conda-forge backcall 0.1.0 py_0 conda-forge bleach 3.1.0 py_0 conda-forge blinker 1.4 py_1 conda-forge bzip2 1.0.8 h516909a_1 conda-forge ca-certificates 2019.9.11 hecc5488_0 conda-forge certifi 2019.9.11 py37_0 conda-forge certipy 0.1.3 py_0 conda-forge cffi 1.13.2 py37h8022711_0 conda-forge chardet 3.0.4 py37_1003 conda-forge conda 4.7.12 py37_0 conda-forge conda-package-handling 1.6.0 py37h516909a_0 conda-forge configurable-http-proxy 1.3.0 0 conda-forge cryptography 2.8 py37h72c5cf5_0 conda-forge curl 7.65.3 hf8cf82a_0 conda-forge decorator 4.4.1 py_0 conda-forge defusedxml 0.6.0 py_0 conda-forge entrypoints 0.3 py37_1000 conda-forge expat 2.2.5 he1b5a44_1004 conda-forge gettext 0.19.8.1 hc5be6a0_1002 conda-forge git 2.23.0 pl526hce37bd2_2 conda-forge go 1.12.5 hb30d042_1 conda-forge go-nocgo 1.12.5 h8b2e17f_1 conda-forge go-nocgo_linux-64 1.12.5 h03773dc_1 conda-forge icu 64.2 he1b5a44_1 conda-forge idna 2.8 py37_1000 conda-forge importlib_metadata 0.23 py37_0 conda-forge ipykernel 5.1.3 py37h5ca1d4c_0 conda-forge ipython 7.9.0 py37h5ca1d4c_0 conda-forge ipython_genutils 0.2.0 py_1 conda-forge jedi 0.15.1 py37_0 conda-forge jinja2 2.10.3 py_0 conda-forge json5 0.8.5 py_0 conda-forge jsonschema 3.1.1 py37_0 conda-forge jupyter_client 5.3.3 py37_1 conda-forge jupyter_core 4.5.0 py_0 conda-forge jupyterhub 1.0.0 py37_0 conda-forge jupyterlab 1.2.1 py_0 conda-forge jupyterlab_server 1.0.6 py_0 conda-forge krb5 1.16.3 h05b26f9_1001 conda-forge libcurl 7.65.3 hda55be3_0 conda-forge libedit 3.1.20170329 hf8c457e_1001 conda-forge libffi 3.2.1 he1b5a44_1006 conda-forge libgcc-ng 9.1.0 hdf63c60_0 defaults libiconv 1.15 h516909a_1005 conda-forge libsodium 1.0.17 h516909a_0 conda-forge libssh2 1.8.2 h22169c7_2 conda-forge libstdcxx-ng 9.1.0 hdf63c60_0 defaults libuv 1.33.1 h516909a_0 conda-forge mako 1.1.0 py_0 conda-forge markupsafe 1.1.1 py37h516909a_0 conda-forge mistune 0.8.4 py37h516909a_1000 conda-forge more-itertools 7.2.0 py_0 conda-forge nbconvert 5.6.1 py37_0 conda-forge nbformat 4.4.0 py_1 conda-forge ncurses 6.1 hf484d3e_1002 conda-forge nodejs 12.13.0 h10a4023_0 conda-forge notebook 6.0.0 py37_0 conda-forge oauthlib 3.0.1 py_0 conda-forge openssl 1.1.1d h516909a_0 conda-forge pamela 1.0.0 py_0 conda-forge pandoc 2.7.3 0 conda-forge pandocfilters 1.4.2 py_1 conda-forge parso 0.5.1 py_0 conda-forge pcre 8.43 he1b5a44_0 conda-forge perl 5.26.2 h516909a_1006 conda-forge pexpect 4.7.0 py37_0 conda-forge pickleshare 0.7.5 py37_1000 conda-forge pip 19.3.1 py37_0 conda-forge prometheus_client 0.7.1 py_0 conda-forge prompt_toolkit 2.0.10 py_0 conda-forge ptyprocess 0.6.0 py_1001 conda-forge pycosat 0.6.3 py37h516909a_1002 conda-forge pycparser 2.19 py37_1 conda-forge pycurl 7.43.0.3 py37h16ce93b_1 conda-forge pygments 2.4.2 py_0 conda-forge pyjwt 1.7.1 py_0 conda-forge pyopenssl 19.0.0 py37_0 conda-forge pyrsistent 0.15.5 py37h516909a_0 conda-forge pysocks 1.7.1 py37_0 conda-forge python 3.7.3 h33d41f4_1 conda-forge python-dateutil 2.8.1 py_0 conda-forge python-editor 1.0.4 py_0 conda-forge pyzmq 18.1.0 py37h1768529_0 conda-forge readline 8.0 hf8c457e_0 conda-forge requests 2.22.0 py37_1 conda-forge ruamel_yaml 0.15.71 py37h14c3975_1000 conda-forge send2trash 1.5.0 py_0 conda-forge setuptools 41.6.0 py37_1 conda-forge six 1.13.0 py37_0 conda-forge sqlalchemy 1.3.10 py37h516909a_0 conda-forge sqlite 3.30.1 hcee41ef_0 conda-forge terminado 0.8.2 py37_0 conda-forge testpath 0.4.4 py_0 conda-forge tini 0.18.0 h14c3975_1001 conda-forge tk 8.6.9 hed695b0_1003 conda-forge tornado 6.0.3 py37h516909a_0 conda-forge tqdm 4.37.0 py_0 conda-forge traitlets 4.3.3 py37_0 conda-forge urllib3 1.25.6 py37_0 conda-forge wcwidth 0.1.7 py_1 conda-forge webencodings 0.5.1 py_1 conda-forge wheel 0.33.6 py37_0 conda-forge xz 5.2.4 h14c3975_1001 conda-forge yaml 0.1.7 h14c3975_1001 conda-forge zeromq 4.3.2 he1b5a44_2 conda-forge zipp 0.6.0 py_0 conda-forge zlib 1.2.11 h516909a_1006 conda-forge

RUN pip list Package Version


alembic 1.3.0 async-generator 1.10 attrs 19.3.0 backcall 0.1.0 bleach 3.1.0 blinker 1.4 certifi 2019.9.11 certipy 0.1.3 cffi 1.13.2 chardet 3.0.4 conda 4.7.12 conda-package-handling 1.6.0 cryptography 2.8 decorator 4.4.1 defusedxml 0.6.0 entrypoints 0.3 idna 2.8 importlib-metadata 0.23 ipykernel 5.1.3 ipython 7.9.0 ipython-genutils 0.2.0 jedi 0.15.1 Jinja2 2.10.3 json5 0.8.5 jsonschema 3.1.1 jupyter-client 5.3.3 jupyter-core 4.5.0 jupyterhub 1.0.0 jupyterlab 1.2.1 jupyterlab-server 1.0.6 Mako 1.1.0 MarkupSafe 1.1.1 mistune 0.8.4 more-itertools 7.2.0 nbconvert 5.6.1 nbformat 4.4.0 notebook 6.0.0 oauthlib 3.0.1 pamela 1.0.0 pandocfilters 1.4.2 parso 0.5.1 pexpect 4.7.0 pickleshare 0.7.5 pip 19.3.1 prometheus-client 0.7.1 prompt-toolkit 2.0.10 ptyprocess 0.6.0 pycosat 0.6.3 pycparser 2.19 pycurl 7.43.0.3 Pygments 2.4.2 PyJWT 1.7.1 pyOpenSSL 19.0.0 pyrsistent 0.15.5 PySocks 1.7.1 python-dateutil 2.8.1 python-editor 1.0.4 pyzmq 18.1.0 requests 2.22.0 ruamel-yaml 0.15.71 Send2Trash 1.5.0 setuptools 41.6.0.post20191101 six 1.13.0 SQLAlchemy 1.3.10 terminado 0.8.2 testpath 0.4.4 tornado 6.0.3 tqdm 4.37.0 traitlets 4.3.3 urllib3 1.25.6 wcwidth 0.1.7 webencodings 0.5.1 wheel 0.33.6 zipp 0.6.0

r351574nc3 commented 4 years ago

I believe you need CGO_ENABLED to work. If CGO_ENABLED=0, then you will run into this problem.

r351574nc3 commented 4 years ago

I used the following and it worked for me:

FROM golang:1.13-alpine as goapps

ENV CGO_ENABLED=1\
    GOOS=linux

RUN apk update \
    && apk add --no-cache ca-certificates\
        git \
        gcc \
        g++ \
        pkgconfig \
        linux-headers \
        zeromq \
        zeromq-dev \
    && rm -rf /var/cache/apk/*

RUN go get github.com/gopherdata/gophernotes

WORKDIR /go/src/github.com/gopherdata/gophernotes

RUN GOOS=linux go build -a -installsuffix cgo -o gophernotes

from alpine

ARG NB_USER="jovyan"
ARG NB_UID="1000"
ARG NB_GID="1000"

ENV CGO_ENABLED=0\
    GOOS=linux\
    NB_USER=$NB_USER\
    NB_UID=$NB_UID\
    NB_GID=$NB_GID\
    GOPHERNOTESPATH="/home/$NB_USER/.local/share/jupyter/kernels/gophernotes/"

RUN apk update \\
    && apk upgrade --update-cache --available \
    && apk add --no-cache \
        bash \
        build-base \
        ca-certificates \
        curl \
        python3 \
        python3-dev\
        git \
        linux-headers \
        zeromq \
        zeromq-dev \
    && pip3 install --upgrade pip \
    && pip3 install jupyter jupyterlab \
    && apk del build-base python3-dev linux-headers zeromq-dev \
    && rm -rf /var/cache/apk/*

COPY --from=goapps /go/src/github.com/gopherdata/gophernotes/gophernotes /usr/local/bin/gophernotes
COPY --from=goapps /go/src/github.com/gopherdata/gophernotes/kernel/* $GOPHERNOTESPATH
COPY start-notebook.sh /usr/local/bin
COPY start-singleuser.sh /usr/local/bin

RUN mkdir -p $GOPHERNOTESPATH \
    && sed "s|gophernotes|/usr/local/bin/gophernotes|" < ${GOPHERNOTESPATH}kernel.json.in > ${GOPHERNOTESPATH}kernel.json \
    && addgroup -S -g $NB_GID $NB_USER \
    && adduser --system $NB_USER --uid $NB_UID --ingroup $NB_USER \
    && chown -R $NB_USER:$NB_USER /home/$NB_USER/.local

USER $NB_UID

WORKDIR /workspace
VOLUME [ "/workspace" ]
EXPOSE 8888

ENTRYPOINT ["/usr/local/bin/start-notebook.sh"]