galeone / tfgo

Tensorflow + Go, the gopher way
https://pgaleone.eu/tensorflow/go/2017/05/29/understanding-tensorflow-using-go/
Apache License 2.0
2.43k stars 155 forks source link

installation issue: can't find for_core_protos_go_proto #45

Closed pa-m closed 3 years ago

pa-m commented 3 years ago

go get github.com/galeone/tfgo go: finding module for package github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto go: finding module for package github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto ../../../../.gvm/pkgsets/go1.15/global/pkg/mod/github.com/tensorflow/tensorflow@v2.4.1+incompatible/tensorflow/go/saved_model.go:25:2: module github.com/tensorflow/tensorflow@latest found (v2.4.1+incompatible), but does not contain package github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto

galeone commented 3 years ago

Working on the same machine I never encountered this problem, so I had to google a bit.

We end up in this (IMHO bad) behavior of go get that does not respect the replace directive. https://github.com/golang/go/issues/30354

So I had to fix my fork (https://github.com/galeone/tensorflow/tree/r2.4-go) and update the code to point to the fork directly ( https://github.com/galeone/tfgo/commit/74b2cd09435e5becd7fbcf4efc17996ca2d41654 ).

For some reason (no idea why it happens) go get have some problem in fetching the latest commit of this branch, and fetches some old commit (??). For this reason, for now, until this cache (I guess) gets pruned, you can go get the package in this way (from a go module):

go get github.com/galeone/tfgo@74b2cd09435e5becd7fbcf4efc17996ca2d41654

edit: the cache has been pruned, now simply go get github.com/galeone/tfgo works.

Closing, but feel free to give feedback about this solution.

true-zero commented 3 years ago

This issue continues to persist for me and the command given above: go get github.com/galeone/tfgo still gives the same error (cannot find package "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto").

go get github.com/galeone/tfgo@74b2cd09435e5becd7fbcf4efc17996ca2d41654 gives the error: go: cannot use path@version syntax in GOPATH mode

The fix is to run: go mod download github.com/galeone/tfgo@74b2cd09435e5becd7fbcf4efc17996ca2d41654 with the fix found from here

true-zero commented 3 years ago

I'm still having issues, trying to run the example given here is giving me the same error as before cannot find package "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto" despite appearing to have downloaded successfully at first.

galeone commented 3 years ago

@true-zero are you running go get github.com/galeone/tfgo inside a new module or elsewhere?

If it's inside a new module (where you have run go mod init or where you already have go.mod) it should work.

If you're running this command outside of a module, then using go mod download maybe it the preferred way.

However thanks for this second comment:

I'm still having issues, trying to run the example given here is giving me the same error as before cannot find package "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto" despite appearing to have downloaded successfully at first.

You made me notice that I completely forgot to update the readme: we shouldn't use the official tensorflow/tensorflow package, but we should use the fork we automatically download when using go get (galeone/tensorflow).

I'm reopening this issue and I'll close when the documentation is updated (in a few minutes).

Let me know if you need any other help

galeone commented 3 years ago

Just pushed https://github.com/galeone/tfgo/commit/84b9a5e77f79bf9bc7f7e469f878ee355ed20d29 with the updated examples :+1:

Try them and let me know if it works for you.

galeone commented 3 years ago

Closing after about 24 hours. I suppose it works for you - let me know otherwise.

true-zero commented 3 years ago

cannot find package "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto" continues to persist

galeone commented 3 years ago

cannot find package "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto" continues to persist

Can you create a minimal reproducible example? I don't know how to help you otherwise :smile:

pa-m commented 3 years ago

Worked for me. very nice. Thank you.

galeone commented 3 years ago

Worked for me. very nice. Thank you.

:heart: