Open leondgarse opened 4 years ago
This is caused by the same issue reported in gomacro https://github.com/cosmos72/gomacro/issues/77 I will investigate it ASAP
Understood, thanks for your explain. Glad you are looking into this. :)
Can you execute the shell commands
GO111MODULE=on go get -v github.com/tensorflow/tensorflow/tensorflow/go
GO111MODULE=on go install -v github.com/tensorflow/tensorflow/tensorflow/go
and then try again to import "github.com/tensorflow/tensorflow/tensorflow/go"
?
I am trying to understand if such workaround could work - if it does, I can modify gophernotes to run it automatically.
I tried them myself: no luck.
Thus I just added a workaround: the special command %go111module {on|off}
enables/disables GO111MODULE support when importing packages.
By default it is on, but to import packages that expose C types/symbols - such as github.com/tensorflow/tensorflow/tensorflow/go
and gonum.org/v1/netlib/blas/netlib
, you should turn it off.
Let me know if it helps.
Yes, it do works!
But
import "gonum.org/v1/netlib/blas/netlib"
throws another error error executing "/usr/local/go/bin/go build -buildmode=plugin" in directory
. It also works well in a script with go run
.
// test_netlib.go
package main
import (
"fmt"
"gonum.org/v1/gonum/mat"
"gonum.org/v1/gonum/blas/blas64"
blas_netlib "gonum.org/v1/netlib/blas/netlib"
)
func main() {
blas64.Use(blas_netlib.Implementation{})
zero := mat.NewDense(2, 2, nil)
fmt.Println(zero)
}
Run
$ CGO_LDFLAGS="-L/opt/OpenBLAS/lib -lopenblas" go run test_netlib.go
&{{2 2 [0 0 0 0] 2} 2 2}
Also tried these two commands
$ GO111MODULE=off CGO_LDFLAGS="-L/opt/OpenBLAS/lib -lopenblas" go run test_netlib.go
&{{2 2 [0 0 0 0] 2} 2 2}
$ GO111MODULE=on CGO_LDFLAGS="-L/opt/OpenBLAS/lib -lopenblas" go run test_netlib.go
go: finding gonum.org/v1/netlib latest
&{{2 2 [0 0 0 0] 2} 2 2}
I think it's another issue though. I'm still trying to solve this.
Thanks for your work. I'm glad tensorflow works. :)
What are you trying to do?
"github.com/tensorflow/tensorflow/tensorflow/go"
and"gonum.org/v1/netlib/blas/netlib"
injupyter-notebook
gophernotes kernel
, but throws errorcould not import C (no metadata for C)
. It seems like importing packages needC
is not right.go run
it from a script.What did you do?
import "gonum.org/v1/netlib/blas/netlib"
Github gonum/gonum:Install OpenBLAS
git clone https://github.com/xianyi/OpenBLAS cd OpenBLAS make make install # This will install OpenBLAS lib to /opt/OpenBLAS/lib export LD_LIBRARY_PATH=/opt/OpenBLAS/lib/:$LD_LIBRARY_PATH CGO_LDFLAGS="-L/opt/OpenBLAS/lib -lopenblas" go install gonum.org/v1/netlib/blas/netlib
no metadata for C
error, installing needs some steps..Then open a
jupyter-notebook
-->New
-->Go
, run again:What did you expect to happen?
Expect importing successfully with no error throws out.
What actually happened?
Importing throws error![Selection_147](https://user-images.githubusercontent.com/5744524/71949296-f08da600-320d-11ea-83e4-b9f0c40ac152.png)
could not import C (no metadata for C)
Another jupyter Go kernel lgo can import![Selection_148](https://user-images.githubusercontent.com/5744524/71954299-d1980f80-321f-11ea-8e79-628b781b540d.png)
tensorflow
succefully:What version of Go and Gophernotes are you using?