Skip to content

Golang Tensorflow v2.3.0 installation fails #41808

Closed

Description

@jobale

System information

  • Have I written custom code (as opposed to using a stock example script
    provided in TensorFlow)
    : No
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux-4.19.0-9-amd64-x86_64-with-debian-10.4
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue
    happens on a mobile device
    :
  • TensorFlow installed from (source or binary): Not installed (golang go command pull tensorflow from github)
  • TensorFlow version (use command below): 2.3.0 (same bug in 2.2.0)
  • Python version: 2.7.16 (but python 3.7 is installed too)
  • Bazel version (if compiling from source): 3.1.0
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version:
  • GPU model and memory:
  • Exact command to reproduce: go get github.com/tensorflow/tensorflow/tensorflow/go

Describe the problem

BUG --- As in [email protected], [email protected] fail at installation.

Source code / logs

From inside GOPATH:
go: found github.com/tensorflow/tensorflow/tensorflow/go in github.com/tensorflow/tensorflow v2.3.0+incompatible
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
../../go/pkg/mod/github.com/tensorflow/[email protected]+incompatible/tensorflow/go/saved_model.go:25:2: module github.com/tensorflow/tensorflow@latest found (v2.3.0+incompatible), but does not contain package github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto

From inside a go.mod compliant directory:
go: found github.com/tensorflow/tensorflow/tensorflow/go in github.com/tensorflow/tensorflow v2.3.0+incompatible
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
../../go/pkg/mod/github.com/tensorflow/[email protected]+incompatible/tensorflow/go/saved_model.go:25:2: module github.com/tensorflow/tensorflow@latest found (v2.3.0+incompatible), but does not contain package github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto

Looks like exactly the same old bug from [email protected] from this issue: #39307

Activity

  1. naspredam commented on Aug 2, 2020

    @naspredam

    Happened the same for me... in order to use go with tensorflow I used the 1.15.0 as go dependency.

    But still, it seems that there is a dependency issue on the 2.2+... and for python 3.8 it should use 2.2+

  2. pbatk commented on Aug 22, 2020

    @pbatk

    I can confirm this occurs for me as well. For the time being I am using the 2.3.0 C library with the 2.1.0 Go module. There are warnings at link time but it seems to function for all my usage. If this needs further debugging I'm happy to help out to expedite the process. I'd prefer to keep the library and module versions in sync

  3. batara666 commented on Aug 28, 2020

    @batara666

    confirmed, urgently need fix

  4. batara666 commented on Aug 28, 2020

    @batara666

    this broke the whole go tensorflow

  5. rubens21 commented on Aug 29, 2020

    @rubens21

    Same issue here :(
    And it is not happening only in 2.3. It is affecting all 2.* versions.

    I found discussions #39744 and here #40752

    There was a PR (e5e495d) the supposedly would fix the issue, but I checkout master and tested it, and I got the same error.

    @jhseu since your changes are not in a tag yet, I tested using master branch. I got the same error.
    I followed the steps in https://github.com/tensorflow/tensorflow/blob/master/tensorflow/go/README.md, and I did not found the proto files in the Go code (in src/github...), they were generated inside Bazel cache directories.

    I believe the problem is that Bazel is generating the files, so they are created inside Bazel building dirs (bazel-tensorflow/tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto).

    Should we have a script to generate the files within the golang code?
    I am trying to make it work in my environment by generating the proto files, but I am having other issues because the importing path from other libs...

    Help, please :(

  6. rubens21 commented on Aug 30, 2020

    @rubens21

    Well, it is working for me now, but I had to do some hacks to make it works.

    First, differently of what I said in the comment above, we do have a script that generates the proto files outside Bazel dir, however it only generates inside a vendor dir (https://github.com/tensorflow/tensorflow/blob/master/tensorflow/go/genop/generate.sh#L70).

    These are the steps I followed to make it works in my environment

    1. Follow the steps described on https://github.com/tensorflow/tensorflow/blob/master/tensorflow/go/README.md#build
    2. The 3.a (Copying it to a system location) step will fail, you must copy libtensorflow_framework.so.2 instead of libtensorflow_framework.so
    3. The step 4 (generate and test) also will fail, but no worries, keep going...
    4. Now run these commands inside ${GOPATH}/src/github.com/tensorflow/tensorflow/
      cp -R tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/core tensorflow/go/core
      cp -R tensorflow/go/vendor/github.com/tensorflow/tensorflow/tensorflow/go/stream_executor tensorflow/go/
      
    5. Run the tests again go test github.com/tensorflow/tensorflow/tensorflow/go, if you get the error saying "libtensorflow.so.2: cannot open shared object file: No such file or directory", may need to execute the step 3.b instead of the 3.a

    Assuming the test is passing, you may continue.

    If your Go project is using Go modules ON, you will have to:

    1. Force Go to use the local directory instead of importing it. So, add this to your go.mod file:
      replace github.com/tensorflow/tensorflow => [your absolute Gopath]/src/github.com/tensorflow/tensorflow
      
    2. Force github.com/tensorflow/tensorflow looks like a Go module project.
      cd  ${GOPATH}/src/github.com/tensorflow/tensorflow/
      go mod init github.com/tensorflow/tensorflow
      

    Just keep in mind that it is a workaround. I did it because the bug was blocking me.

  7. 48 remaining items

  8. removed
    staleThis label marks the issue/pr stale - to be closed automatically if no activity
    on Jun 20, 2022
  9. removed their assignment
    on Jun 22, 2022
  10. tenhan commented on Sep 28, 2022

    @tenhan

    I am facing the similar problem:

    go get -d github.com/tensorflow/tensorflow/tensorflow/go                                                                                                                                 ─╯
    github.com/tensorflow/tensorflow/tensorflow/go imports
    	github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto: cannot find module providing package github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto
    

    Will this be fixed?

  11. galeone commented on Sep 28, 2022

    @galeone

    I am facing the similar problem:

    go get -d github.com/tensorflow/tensorflow/tensorflow/go                                                                                                                                 ─╯
    github.com/tensorflow/tensorflow/tensorflow/go imports
    	github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto: cannot find module providing package github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto
    

    Is this will be fixed?

    Use tfgo or galeone/tensorflow
    #41808 (comment)

  12. galeone commented on Oct 23, 2022

    @galeone

    FYI I updated https://github.com/galeone/tensorflow to TensorFlow 2.10 (https://github.com/galeone/tensorflow/tree/r2.10-go)

    You can update via go get -u github.com/galeone/tensorflow/tensorflow/[email protected]

    Moreover, if you use (or plan to use) galeone/tfgo the dependency of tfgo on galeone/tensorflow is already updated.

  13. SuryanarayanaY commented on Mar 1, 2023

    @SuryanarayanaY
    Collaborator

    Hi @jobale ,

    Tensorflow Golang instructions has been maintained by a community member.Please find the attached source.
    The source is updated till 2.11 version.

    As TF 2.3 version is not actively supported, Please try with latest version by following the instructions in above source and let us know if having any problems there. Thanks!

  14. added
    staleThis label marks the issue/pr stale - to be closed automatically if no activity
    on Mar 13, 2023
  15. SuryanarayanaY commented on Mar 23, 2023

    @SuryanarayanaY
    Collaborator

    Closing as stale. Please reopen if you'd like to work on this further. Thanks.

  16. google-ml-butler commented on Mar 23, 2023

    @google-ml-butler

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

  17. added 2 commits that reference this issue on May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

TF 2.3Issues related to TF 2.3staleThis label marks the issue/pr stale - to be closed automatically if no activitystat:awaiting responseStatus - Awaiting response from authorsubtype: ubuntu/linuxUbuntu/Linux Build/Installation Issuestype:build/installBuild and install issues

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions