Skip to content

Golang tensorflow no longer builds due to bad import in saved_model.go #34580

Closed

Description

@noj-richards

A recent change (Change-Id: Iefdf75ed88f54d97a0a7d210f5a42f3123205bf2) has broken an import in file tensorflow/blob/master/tensorflow/go/saved_model.go

tfpb "github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core/framework"

Activity

  1. gadagashwini-zz commented on Nov 26, 2019

    @gadagashwini-zz
    Contributor

    @noj-richards, Please provide the exact sequence of commands / steps that you executed before running into the problem. Also include Tensorflow version. Thanks!

  2. noj-richards commented on Nov 26, 2019

    @noj-richards
    Author

    Version is as 'master' with Change-id: Iefdf75ed88f54d97a0a7d210f5a42f3123205bf2

    To reproduce simply try and import tf.SavedModel,

    e.g:

    import (
    tf "github.com/tensorflow/tensorflow/tensorflow/go"
    )

    //Config Config

    //CNN CNN
    type CNN struct {
    model *tf.SavedModel

    This will produce the error:

    ../../../../../github.com/tensorflow/tensorflow/tensorflow/go/saved_model.go:25:2: cannot find package "github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core/framework" in any of:
    /usr/local/go/src/github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core/framework (from $GOROOT)
    /Users/jonrichards/code/go/src/github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core/framework (from $GOPATH)

  3. AaronReboot commented on Nov 26, 2019

    @AaronReboot

    Confirmed we're having the same prob. Had to revert to commit 36ef4264270e3815ea4b485a52e35e26e43e2112 in order to build

  4. jcolson commented on Dec 2, 2019

    @jcolson

    is this also causing this failure?

    go get github.com/tensorflow/tensorflow/tensorflow/go
    
    package github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core/framework: cannot find package "github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core/framework" in any of:
    	/usr/local/Cellar/go/1.13.4/libexec/src/github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core/framework (from $GOROOT)
    	/Users/xxxxx/go/src/github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core/framework (from $GOPATH)
    
    
  5. assigned and unassigned on Dec 3, 2019
  6. AaronReboot commented on Dec 3, 2019

    @AaronReboot

    is this also causing this failure?

    go get github.com/tensorflow/tensorflow/tensorflow/go
    
    package github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core/framework: cannot find package "github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core/framework" in any of:
    	/usr/local/Cellar/go/1.13.4/libexec/src/github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core/framework (from $GOROOT)
    	/Users/xxxxx/go/src/github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core/framework (from $GOPATH)
    

    Indeed. That's a simpler minimal example of the prob!

  7. yutkin commented on Dec 13, 2019

    @yutkin

    I've faced this issue too. During the building of the Docker image, got

    Step 7/10 : RUN go get github.com/tensorflow/tensorflow/tensorflow/go
     ---> Running in aa0d0a73e640
    package github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core: cannot find package "github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core" in any of:
    	/usr/local/go/src/github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core (from $GOROOT)
    	/go/src/github.com/tensorflow/tensorflow/tensorflow/go/genop/internal/proto/github.com/tensorflow/tensorflow/tensorflow/go/core (from $GOPATH)
    
  8. kahlil29 commented on Dec 23, 2019

    @kahlil29

    What's the recommended way to install the go lang tensorflow binding now that this bug has been identified? Is there any fix in the works?

  9. 1 remaining item

  10. kahlil29 commented on Jan 22, 2020

    @kahlil29

    Wow this issue has been completely ignored. It's been almost 2 months! 😡
    It's an installation problem, ffs. Not some nice to have or enhancement feature.
    And the workaround is extremely hacky and not at all pleasant.

  11. yohaiaz commented on Jan 26, 2020

    @yohaiaz

    anyone can help please. trying go get
    go get github.com/tensorflow/tensorflow/tensorflow/go

    getting an error "cannot find package..."

    what i'm doing wrong ?

  12. jhseu commented on Feb 5, 2020

    @jhseu
    Contributor

    Fixed as of 4221d1a

  13. tensorflow-bot commented on Feb 5, 2020

    @tensorflow-bot

    Are you satisfied with the resolution of your issue?
    Yes
    No

  14. jhseu commented on Feb 5, 2020

    @jhseu
    Contributor

    (As a sidenote, please follow the instructions on the Go README which differs slightly from the documentation on tensorflow.org. I'll work on updating the official docs):
    https://github.com/tensorflow/tensorflow/blob/master/tensorflow/go/README.md

  15. yutkin commented on Feb 6, 2020

    @yutkin

    I still have this issue:

    Step 8/9 : RUN go get -d github.com/tensorflow/tensorflow/tensorflow/go
     ---> Running in c8a1c8c24a33
    package github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto: cannot find package "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto" in any of:
    	/go/src/github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto (from $GOROOT)
    	/root/go/src/github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto (from $GOPATH)
    The command '/bin/sh -c go get -d github.com/tensorflow/tensorflow/tensorflow/go' returned a non-zero code: 1
    
  16. noj-richards commented on Feb 7, 2020

    @noj-richards
    Author

    Yes, Think this is still an issue:

    ../../../../../github.com/tensorflow/tensorflow/tensorflow/go/saved_model.go:24:2: cannot find package "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto" in any of:
    /usr/local/go/src/github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto (from $GOROOT)
    /Users/xxxx/code/go/src/github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto (from $GOPATH)

    ../../../../../github.com/tensorflow/tensorflow/tensorflow/go/saved_model.go:24:2: cannot find package "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto" in any of:
    /usr/local/go/src/github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto (from $GOROOT)

  17. ntklink commented on May 19, 2020

    @ntklink

    I have this issue too:

    go: finding module for package github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto
    ../gopath/pkg/mod/github.com/tensorflow/[email protected]+incompatible/tensorflow/go/saved_model.go:24:2: module github.com/tensorflow/tensorflow@latest found (v2.2.0+incompatible), but does not contain package github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto
    make: *** [release] Error 1

  18. mkanakis commented on Jun 12, 2020

    @mkanakis

    Hi,

    I am experience the issue as well, any updates?

    Running the following command:

    go get -d github.com/tensorflow/tensorflow/tensorflow
    

    Produces the following output:

    package github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto: cannot find package "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto" in any of:
    	/usr/local/go/src/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto (from $GOROOT)
    	/home/marios/go/src/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto (from $GOPATH)
    
  19. jdoucy commented on Jun 19, 2020

    @jdoucy

    Go packages depends on the C lib which is using 1.15 Tensorflow version, go get is trying to get the last 2.2.0.

    There is a workaround described here => #23257 (comment)

    On my side I use a go.mod file with
    require github.com/tensorflow/tensorflow v1.15.0
    and it worked 🙌

  20. amalbala commented on Jul 9, 2020

    @amalbala

    Same problem here, checked my C lib is 2.2.0 but when try to use the go code:

    go: finding module for package github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto
    /home/antonio/go/pkg/mod/github.com/tensorflow/[email protected]+incompatible/tensorflow/go/saved_model.go:24:2: module github.com/tensorflow/tensorflow@latest found (v2.2.0+incompatible), but does not contain package github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto
    
    

    Unfortunatelly I can not dowgrade to TF 1.15

  21. jobale commented on Jul 22, 2020

    @jobale

    With Debian 10 and Tensorflow v2.2

    Same problem here. Following command:
    go get -d github.com/tensorflow/tensorflow/tensorflow/go

    produce:
    package github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto: cannot find package "github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto" in any of: /usr/local/go/src/github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto (from $GOROOT) /home/joceran/go/src/github.com/tensorflow/tensorflow/tensorflow/go/core/core_protos_go_proto (from $GOPATH)
    Following command:
    go generate github.com/tensorflow/tensorflow/tensorflow/go/op

    produce:
    google/protobuf/any.proto: File not found. google/protobuf/duration.proto: File not found. tensorflow/core/protobuf/autotuning.proto:10:1: Import "google/protobuf/any.proto" was not found or had errors. tensorflow/core/protobuf/autotuning.proto:11:1: Import "google/protobuf/duration.proto" was not found or had errors. tensorflow/core/protobuf/autotuning.proto:61:3: "google.protobuf.Duration" is not defined. tensorflow/core/protobuf/autotuning.proto:74:3: "google.protobuf.Any" is not defined. ../genop/main.go:17: running "bash": exit status 1 go/src/github.com/tensorflow/tensorflow/tensorflow/go/op/generate.go:17: running "go": exit status 1

    I tried with tensorflow r2.1 (git checkout r2.1) and the go get -d... error disappear. Unfortunately to test the subsequent go generate command I need to compile libtensorflow.so.2 against tensorflow v2.1.0 (mine is compiled against tensroflow 2.2.0 of course).
    EDIT: OK my bad, saw the warning on the C libtensorflow about compatibility. So no golang serving until the release of a compatible lib I guess.

  22. kyungtae commented on Nov 19, 2020

    @kyungtae

    Is there any official progress on this?

  23. sdeoras commented on Dec 7, 2020

    @sdeoras
    Contributor

    running into this error for TF v2.3.1. is there a way to generate this package?

    └─ $ ▶ go test github.com/tensorflow/tensorflow/tensorflow/go
    saved_model.go:25:2: cannot find package "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto" in any of:
    	/home/sdeoras/go/src/github.com/tensorflow/tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto (vendor tree)
    	/usr/local/go/src/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto (from $GOROOT)
    	/home/sdeoras/go/src/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto (from $GOPATH)
    

    Reverted to TF v1.15.0 and things are working fine:
    downloaded c-lib from https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.15.0.tar.gz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions