Skip to content

tensorflow for go install failed #39744

Closed

Description

@moseshu

MacOS version(10.15.4)

  1. I followed the instruction of https://www.tensorflow.org/install/lang_c ,I installed the c Library .but it doesn't word.the error is > hello_tf.c:2:10: fatal error: 'tensorflow/c/c_api.h' file not found

  2. 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:
    /usr/local/go/src/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto (from $GOROOT)
    /Users/moses/workspace/godemo/src/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto (from $GOPATH)

how to solve this problem

Activity

  1. whitehse commented on May 24, 2020

    @whitehse

    I have also encountered this error on Linux:

    ~$ /tmp/tensor/hello_tf 
    Hello from TensorFlow C library version 1.15.0
    ~$ go get github.com/tensorflow/tensorflow/tensorflow/go
    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/dwhite/go/src/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto (from $GOPATH)
    ~$ uname -a
    Linux lab 5.2.0-3-amd64 #1 SMP Debian 5.2.17-1 (2019-09-26) x86_64 GNU/Linux
    ~$ echo "$GOROOT $GOPATH"
    
    ~$ go version
    go version go1.12.2 linux/amd64
  2. assigned and unassigned on May 24, 2020
  3. yashem66 commented on May 31, 2020

    @yashem66

    I have also encountered this error on Linux:

    ~$ /tmp/tensor/hello_tf 
    Hello from TensorFlow C library version 1.15.0
    ~$ go get github.com/tensorflow/tensorflow/tensorflow/go
    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/dwhite/go/src/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto (from $GOPATH)
    ~$ uname -a
    Linux lab 5.2.0-3-amd64 #1 SMP Debian 5.2.17-1 (2019-09-26) x86_64 GNU/Linux
    ~$ echo "$GOROOT $GOPATH"
    
    ~$ go version
    go version go1.12.2 linux/amd64

    I got the same problem last night.
    I execute this and I fixxed it.
    cd $GOPATH/src/github.com/tensorflow/tensorflow/tensorflow/go
    git checkout r1.11

  4. PetrDvoracek commented on May 31, 2020

    @PetrDvoracek

    I have also encountered this error on Linux:

    ~$ /tmp/tensor/hello_tf 
    Hello from TensorFlow C library version 1.15.0
    ~$ go get github.com/tensorflow/tensorflow/tensorflow/go
    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/dwhite/go/src/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto (from $GOPATH)
    ~$ uname -a
    Linux lab 5.2.0-3-amd64 #1 SMP Debian 5.2.17-1 (2019-09-26) x86_64 GNU/Linux
    ~$ echo "$GOROOT $GOPATH"
    
    ~$ go version
    go version go1.12.2 linux/amd64

    I got the same problem last night.
    I execute this and I fixxed it.
    cd $GOPATH/src/github.com/tensorflow/tensorflow/tensorflow/go
    git checkout r1.11

    Same problem, this "fixed" the problem at least temporarily.

  5. rensburger commented on May 31, 2020

    @rensburger

    Worked for me also

  6. rtrevinnoc commented on Jun 3, 2020

    @rtrevinnoc

    Worked for me too

  7. roma-guru commented on Jun 10, 2020

    @roma-guru

    I got the same problem last night.
    I execute this and I fixxed it.
    cd $GOPATH/src/github.com/tensorflow/tensorflow/tensorflow/go
    git checkout r1.11

    r2.0 seems to be the last version w/o bug.

  8. jhseu commented on Jul 22, 2020

    @jhseu
    Contributor

    Fixed with e5e495d

  9. google-ml-butler commented on Jul 22, 2020

    @google-ml-butler

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

  10. leslie-wang commented on Jul 25, 2020

    @leslie-wang

    seems still exist

    ~/go/src/github.com/tensorflow/tensorflow/tensorflow $ git log HEAD --oneline
    0de929fdc1 (HEAD -> master, origin/master, origin/HEAD) Make StatusHelper safer to use and fix a related memory leak.
    ~/go/src/github.com/tensorflow/tensorflow/tensorflow $ go test github.com/tensorflow/tensorflow/tensorflow/go
    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:
            /usr/local/go/src/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto (from $GOROOT)
            /home/pi/go/src/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto (from $GOPATH)
    ~/go/src/github.com/tensorflow/tensorflow/tensorflow $ go version
    go version go1.12.17 linux/arm
    
  11. jlozano commented on Aug 24, 2020

    @jlozano

    I am also getting this issue when running go get 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:
    	/usr/local/go/src/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto (from $GOROOT)
    	/Users/juan/go/src/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto (from $GOPATH)
    

    I am using the following version of Go:

    go version go1.14.4 darwin/amd64
    

    I get this with the latest version of Tensorflow, commit 01b030b77623c5fa00a43640f77af2a43572d02c.

    Any help would be appreciated!

  12. erikdubbelboer commented on Aug 28, 2020

    @erikdubbelboer

    This works to install the latest working version:

    go get github.com/tensorflow/tensorflow/tensorflow/[email protected]
    
  13. domino14 commented on Oct 27, 2020

    @domino14

    I get this same error. Any resolution?

  14. glindsell commented on Nov 13, 2020

    @glindsell

    Same here:

    $ go get github.com/tensorflow/tensorflow/tensorflow/go
    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)
    	/Users/gl/go/src/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto (from $GOPATH)
    
  15. shankernaik commented on Feb 22, 2021

    @shankernaik

    Hey @jhseu , any fix ? I am facing same issue. r1.11 or r2.0 doesn't work either.

    shankernaik$ go get github.com/tensorflow/tensorflow/tensorflow/go
    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)
    	/Users/shankernaik/code/go/src/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto (from $GOPATH)
    
    shankernaik$ uname -a
    Darwin  19.6.0 Darwin Kernel Version 19.6.0: Tue Jan 12 22:13:05 PST 2021; root:xnu-6153.141.16~1/RELEASE_X86_64 x86_64
    shankernaik$ echo "$GOROOT $GOPATH"
    /usr/local/go /Users/shankernaik/code/go
    

    Update :
    while configuring the env variables for linker from https://www.tensorflow.org/install/lang_c. instead try Absolute path as below

    export LIBRARY_PATH=/mydir/lib
    export DYLD_LIBRARY_PATH=/mydir/lib
    

    This worked for me, caching the go package here.

    shankernaik$ go test github.com/tensorflow/tensorflow/tensorflow/go
    # github.com/tensorflow/tensorflow/tensorflow/go.test
    ld: warning: directory not found for option '-L/Users/shankernaik/Users/shankernaik/libtensorflow-cpu-darwin-x86_64-2.4.0'
    ok  	github.com/tensorflow/tensorflow/tensorflow/go	(cached)
    
  16. icovej commented on Mar 16, 2023

    @icovej

    This works to install the latest working version:

    go get github.com/tensorflow/tensorflow/tensorflow/[email protected]
    

    at least, I download it successfully, but I don't know whether its functions are all right

  17. added 2 commits that reference this issue on Mar 31, 2026
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