tensorflow: Can't install Tensorflow for Golang
Please make sure that this is a build/installation issue. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:build_template
System information
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 20.04
- Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: -
- TensorFlow installed from (source or binary): go get
- TensorFlow version: 2.4.1
- Python version: 3.8
- Installed using virtualenv? pip? conda?: pip, conda
- Bazel version (if compiling from source): -
- GCC/Compiler version (if compiling from source): -
- CUDA/cuDNN version:-
- GPU model and memory: virtgl
Describe the problem
Can’t install Tensorflow for Golang
Provide the exact sequence of commands / steps that you executed before running into the problem
~$ sudo go get github.com/tensorflow/tensorflow/tensorflow/go
[sudo] heslo pre používateľa gg187on:
go: downloading github.com/tensorflow/tensorflow v1.15.5
go: downloading github.com/tensorflow/tensorflow v2.4.1+incompatible
go: downloading github.com/golang/protobuf v1.5.1
go: downloading google.golang.org/protobuf v1.26.0
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
Any other info / logs Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (3 by maintainers)
I am having the issue:
No such file or directory 20 | // #include “tensorflow/c/c_api.h” | ^~~~~~~~~~~~~~~~~~~~~~ compilation terminated.
I had the same problem, seems like the release doesn’t handle the new module changes correctly. Anyway, I’ve put together a small script to generate the proto code, see below. Run this after you’ve done a go get in your module to get the tf module (basically till the point when you get the proto missing error).
Edit these as necessary
go=~/go ver=tensorflow@v2.4.1+incompatible
Looks like go:generate actions expect the protos to be here
mkdir -p $go/src/github.com/tensorflow ln -s $go/pkg/mod/github.com/tensorflow/$ver $go/src/github.com/tensorflow/tensorflow
To trigger go:generate actions
cd $go/pkg/mod/github.com/tensorflow/$ver chmod -R +w . ln -s vendor/github.com/tensorflow/tensorflow/tensorflow/go/core tensorflow/go ln -s vendor/github.com/tensorflow/tensorflow/tensorflow/go/stream_executor tensorflow/go go mod init github.com/tensorflow/tensorflow go generate github.com/tensorflow/tensorflow/tensorflow/go/op