gopherdata / gophernotes

The Go kernel for Jupyter notebooks and nteract.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can't use go module in go 1.14

gclove opened this issue · comments

image

import elasticsearch7 "github.com/elastic/go-elasticsearch/v7"

But in the latest version of gomacro is successful.

gomacro> import elasticsearch7 "github.com/elastic/go-elasticsearch/v7"
// debug: looking for package "github.com/elastic/go-elasticsearch/v7" ...
// debug: compiling "/Users/gclove/go/src/gomacro.imports/github.com/elastic/go-elasticsearch/v7/v7.go" ...
go: finding module for package github.com/elastic/go-elasticsearch/v7
go: found github.com/elastic/go-elasticsearch/v7 in github.com/elastic/go-elasticsearch/v7 v7.8.0

Can you please copy the output of go env ? Thanks

how are you using go 1.14? can you please share?
also how do you install go packages?

i am not able to install go packages

exec into the docker container

# docker exec -it gophernotes sh

then tried to install packages with go get -v gorm.io/driver/postgres

/ # go get -v gorm.io/driver/postgres

github.com/jackc/pgx/internal/sanitize
gorm.io/gorm/utils
github.com/jackc/pgconn
github.com/jackc/pgtype
# github.com/jackc/pgx/internal/sanitize
go/src/github.com/jackc/pgx/internal/sanitize/sanitize.go:85:15: undefined: strings.ReplaceAll
# gorm.io/gorm/utils
go/src/gorm.io/gorm/utils/utils.go:49:30: reflect.ValueOf(val).IsZero undefined (type reflect.Value has no field or method IsZero)
# github.com/jackc/pgconn
go/src/github.com/jackc/pgconn/errors.go:25:9: undefined: errors.As
go/src/github.com/jackc/pgconn/pgconn.go:221:6: undefined: errors.As
go/src/github.com/jackc/pgconn/pgconn.go:462:6: undefined: errors.As
go/src/github.com/jackc/pgconn/pgconn.go:472:15: undefined: errors.As
go/src/github.com/jackc/pgconn/pgconn.go:490:15: undefined: errors.As
# github.com/jackc/pgtype
go/src/github.com/jackc/pgtype/aclitem_array.go:89:49: reflectedValue.IsZero undefined (type reflect.Value has no field or method IsZero)
go/src/github.com/jackc/pgtype/bool_array.go:92:49: reflectedValue.IsZero undefined (type reflect.Value has no field or method IsZero)
go/src/github.com/jackc/pgtype/bpchar_array.go:92:49: reflectedValue.IsZero undefined (type reflect.Value has no field or method IsZero)
go/src/github.com/jackc/pgtype/bytea_array.go:73:49: reflectedValue.IsZero undefined (type reflect.Value has no field or method IsZero)
go/src/github.com/jackc/pgtype/cidr_array.go:112:49: reflectedValue.IsZero undefined (type reflect.Value has no field or method IsZero)
go/src/github.com/jackc/pgtype/date_array.go:93:49: reflectedValue.IsZero undefined (type reflect.Value has no field or method IsZero)
go/src/github.com/jackc/pgtype/enum_array.go:89:49: reflectedValue.IsZero undefined (type reflect.Value has no field or method IsZero)
go/src/github.com/jackc/pgtype/float4_array.go:92:49: reflectedValue.IsZero undefined (type reflect.Value has no field or method IsZero)
go/src/github.com/jackc/pgtype/float8_array.go:92:49: reflectedValue.IsZero undefined (type reflect.Value has no field or method IsZero)
go/src/github.com/jackc/pgtype/hstore_array.go:73:49: reflectedValue.IsZero undefined (type reflect.Value has no field or method IsZero)
go/src/github.com/jackc/pgtype/hstore_array.go:73:49: too many errors

is this right way to install packages by doing it inside the container? will appreciate any help
thanks

I update golang to go1.14 in Dockerfile:

FROM ${a-centos-based-image}
MAINTAINER hitzhangjie

USER root

# Add gophernotes
ADD . /root/go/src/github.com/gopherdata/gophernotes
ADD . /assets/copr.repo /etc/yum.repos.d/

# Install Jupyter and gophernotes
RUN set -x \
    yum install -y ca-certificates \ 
    && yum install -y python36 python3-zmq python3-pkgconfig zeromq-devel musl-devel \
    && pip3 install --upgrade pip==9.0.3 \
    && ln -s /usr/bin/python3.6 /usr/bin/python \
    ## Jupyter notebook
    && ln -s /usr/include/locale.h /usr/include/xlocale.h \
    && pip3 install jupyter notebook pyzmq==16.0.2 tornado==5.0 ipykernel==4.8.1 \
    ## install gophernotes
    && cd /root/go/src/github.com/gopherdata/gophernotes \
    && go install . \
    && cp /root/go/bin/gophernotes /usr/local/bin/ \
    && mkdir -p ~/.local/share/jupyter/kernels/gophernotes \
    && cp -r ./kernel/* ~/.local/share/jupyter/kernels/gophernotes \
    && cd - \
    && find /usr/lib/python3.6 -name __pycache__ | xargs rm -r \
    && rm -rf \
        /root/.[acpw]* \
        ipaexg00301* 

EXPOSE 8888
CMD [ "jupyter", "notebook", "--no-browser", "--allow-root", "--ip=0.0.0.0" ]

but when I docker run and begin a new Go session, it reports kernel error:

Traceback (most recent call last):
  File "/usr/local/lib64/python3.6/site-packages/tornado/web.py", line 1543, in _execute
    result = yield result
  File "/usr/local/lib64/python3.6/site-packages/tornado/gen.py", line 1099, in run
    value = future.result()
  File "/usr/local/lib64/python3.6/site-packages/tornado/gen.py", line 1107, in run
    yielded = self.gen.throw(*exc_info)
  File "/usr/local/lib/python3.6/site-packages/notebook/services/sessions/handlers.py", line 72, in post
    type=mtype))
  File "/usr/local/lib64/python3.6/site-packages/tornado/gen.py", line 1099, in run
    value = future.result()
  File "/usr/local/lib64/python3.6/site-packages/tornado/gen.py", line 1107, in run
    yielded = self.gen.throw(*exc_info)
  File "/usr/local/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 98, in create_session
    kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
  File "/usr/local/lib64/python3.6/site-packages/tornado/gen.py", line 1099, in run
    value = future.result()
  File "/usr/local/lib64/python3.6/site-packages/tornado/gen.py", line 1107, in run
    yielded = self.gen.throw(*exc_info)
  File "/usr/local/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 111, in start_kernel_for_session
    self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
  File "/usr/local/lib64/python3.6/site-packages/tornado/gen.py", line 1099, in run
    value = future.result()
  File "/usr/local/lib/python3.6/site-packages/notebook/services/kernels/kernelmanager.py", line 178, in start_kernel
    self.start_watching_activity(kernel_id)
  File "/usr/local/lib/python3.6/site-packages/notebook/services/kernels/kernelmanager.py", line 427, in start_watching_activity
    kernel._activity_stream.on_recv(record_activity)
  File "/usr/local/lib64/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 177, in on_recv
    self._add_io_state(self.io_loop.READ)
  File "/usr/local/lib64/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 518, in _add_io_state
    self._update_handler(self._state)
  File "/usr/local/lib64/python3.6/site-packages/zmq/eventloop/zmqstream.py", line 530, in _update_handler
    self.io_loop.update_handler(self.socket, state)
  File "/usr/local/lib64/python3.6/site-packages/tornado/platform/asyncio.py", line 72, in update_handler
    fd, self._handle_events, fd, IOLoop.READ)
  File "/usr/lib64/python3.6/asyncio/selector_events.py", line 326, in add_reader
    return self._add_reader(fd, callback, *args)
  File "/usr/lib64/python3.6/asyncio/selector_events.py", line 253, in _add_reader
    key = self._selector.get_key(fd)
  File "/usr/lib64/python3.6/selectors.py", line 189, in get_key
    return mapping[fileobj]
  File "/usr/lib64/python3.6/selectors.py", line 70, in __getitem__
    fd = self._selector._fileobj_lookup(fileobj)
  File "/usr/lib64/python3.6/selectors.py", line 224, in _fileobj_lookup
    return _fileobj_to_fd(fileobj)
  File "/usr/lib64/python3.6/selectors.py", line 39, in _fileobj_to_fd
    "{!r}".format(fileobj)) from None
ValueError: Invalid file object: <zmq.sugar.socket.Socket object at 0x7fa1e7713888>

Could anyone help?