gopherdata/gophernotes

Cannot use third party libraries

ammar-elsabe opened this issue · 5 comments

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"

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

This is the same problem as cosmos72/gomacro#146

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.

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

[UPDATE] as I wrote in gomacro issue 146

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

  • [OK] Go 1.19.12 from go.dev/dl/

  • [BUG] Go 1.20.7 from go.dev/dl/

  • [BUG] Go 1.21rc4 from go.dev/dl/

  • [OK] Go 1.19.12 from Debian package golang-1.19:amd64

  • [OK] Go 1.20.7 from Debian package golang-1.20:amd64

  • [OK] Go 1.21rc3 from Debian package golang-1.21:amd64

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/

Fixed by commit 5514204

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