gopherdata / gophernotes

The Go kernel for Jupyter notebooks and nteract.
MIT License
3.8k stars 262 forks source link

Cannot use third party libraries #261

Closed ammar-elsabe closed 8 months ago

ammar-elsabe commented 1 year ago

Importing third party libraries works, it doesn't complain there. However, when I try to use them it will always complain saying undefined "<module name>" in <module name>.<function name> <*ast.SelectorExpr>.

For example trying to run the example notebook Display.ipynb

Display.ipynb

Or when I try to use the gota example for ReadCSV

gota

go version: go1.20.5 linux/amd64, running on fedora 38

go env:

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ammarelsabe/.cache/go-build"
GOENV="/home/ammarelsabe/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/ammarelsabe/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/ammarelsabe/go"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/usr/lib/golang"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.5"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build599508906=/tmp/go-build -gno-record-gcc-switches"
cosmos72 commented 1 year ago

confirmed, it seems imports are broken when gophernotes is compiled with go >= 1.20

This is the same problem as https://github.com/cosmos72/gomacro/issues/146

ammar-elsabe commented 1 year ago

Just tried recompiling it with 1.19.10, can confirm it works, it'll do for now, thanks. I'll close this since it's on gomacro's side.

cosmos72 commented 1 year ago

I'd rather keep this issue open until it's solved, as it seriously affects gophernotes too.

cosmos72 commented 11 months ago

[UPDATE] as I wrote in gomacro issue 146

I checked this bug by compiling and running gomacro with various Go toolchains. The results are:

So Debian is actively applying a patch that fixes this issue. Now I need to find such patch and check why it was not merged into the upstream Go toolchain at go.dev/dl/

cosmos72 commented 8 months ago

Fixed by commit 55142043d19696ba037e3e93f9ec6c7f8436e82d

Some imports may still fail, if they contain versioned dependencies that conflict with gophernotes dependencies. Example: import "gonum.org/v1/plot" currently fails with:

error loading plugin "[...]/import_1.so": plugin.Open("[...]/import_1"): 
  plugin was built with a different version of package golang.org/x/text/transform