protoc-gen-go-grpc: program not found or is not executable [protoc-gen-go is in PATH] - go

I am trying to generate Go source code from .proto file through this command:
protoc greet/greetpb/greet.proto --go-grpc_out=plugins=grpc:.
and, this is the directory structure:
greet/greetpb/greet.proto
I have tried all the answers mentioned here
But, none of them seems to be working.
I have verified that protoc-gen-go is in PATH.
Still, I am getting this:
protoc-gen-go-grpc: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--go-grpc_out: protoc-gen-go-grpc: Plugin failed with status code 1.
Additional details:
Go Version: go version go1.14.6 darwin/amd64
protoc version: libprotoc 3.12.3
My .zshrc file:
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOROOT:$GOPATH:$GOBIN

Related

'protoc-gen-go-grpc: program not found or is not executable', despite all the efforts

I'm trying to run makefile command 'gen' from this project https://github.com/penthaapatel/grpcblog. The command is: protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative blog/blog.proto However I get an error:
protoc-gen-go-grpc: program not found or is not executable
--go-grpc_out: protoc-gen-go-grpc: Plugin failed with status code 1.
make: *** [/home/deckard/go/src/grpcblog/Makefile:2: gen] Error 1
I use Ubuntu 20.04? Golang-1.13.8 with $GOROOT=/usr/lib/go-1.13 and $GOPATH=/home/deckard/go ($HOME is /home/deckard). Protoc is libprotoc v.3.6.1.. I installed protobuf-compiler both with:
sudo apt install protobuf-compiler
and
go get -u github.com/golang/protobuf/{proto,protoc-gen-go}
There's a folder /home/deckard/go/src/github.com/golang/protobuf and /home/deckard/go/src/google.golang.org/protobuf with /home/deckard/go/src/google.golang.org/protobuf, with, I guess, everything i need.
My bashrc configurations (tried few methods, so things overlap each other):
export GOROOT=/usr/lib/go-1.13
export GOPATH=$HOME/go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOROOT:$GOPATH:$GOBIN
export PATH=$PATH:$GOPATH/bin
export GO_PATH=~/go
export PATH=$PATH:/$GO_PATH/bin
So i tried solutions from here: protoc-gen-go: program not found or is not executable, but none of them helped me. Any clue would be helpful, because I stuck and am very tired.
UPDATE: ls -l /home/deckard/go/bin/protoc-gen-go-grpc shows rwxrwxr-x 1 deckard deckard 7970222 мая 1 14:55 /home/deckard/go/bin/protoc-gen-go-grpc, and printenv PATH returns /home/deckard/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/deckard/.dotnet/tools:/usr/lib/go-1.13:/home/deckard/go:/home/deckard/go/bin:/home/deckard/go/bin://home/deckard/go/bin
UPDATE: which protoc returns /usr/bin/protoc (tried to install it from precompiled binary to /home/deckard/.local/bin/protoc, didn't helped). In both cases protoc-gen-go-grpc --version returns protoc-gen-go-grpc 1.1.0. I also tried to copy everything from google.golang.org/protobuf to google.golang.org/protobuf, no result.
So I deleted github.com/golang/protobuf folder, and seems like google.golang.org/protobuf has started indexing, and everything just started working.

protoc-gen-go does not execute on linux machine

I have installed protoc-gen-go and its in the bin direct and I have set the path to this as well. The problem is that when I run protoc-gen-go from the commandline it does not error, but nothing happens as well.
If I run the following command sudo protoc --go_out=. --go_opt=paths=source_relative --go-grpc_ths=source_relative helloworld/helloworld.proto I get the following error
protoc-gen-go: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--go_out: protoc-gen-go: Plugin failed with status code 1.
However protoc-gen-go is available in my /home/usrname/go/bin path and this bin path has been exported to my linux PATH variable. Not sure what is going wrong here. The protoc-gen-go has the following permissions
-rwxr-xr-x 1 usrname 9003065 Apr 16 11:16 protoc-gen-go

Error message:protoc-gen-go: Plugin failed with status code 1

This is not a duplicate question
First, I made sure I have the following configuration:
1 export GOPATH=/Users/chezixin/go
2 export GOBIN=/Users/chezixin/go/bin
3
4 export GO111MODULE=on
5 # 123
6 export GOPROXY=https://goproxy.cn
7
8
9 export PATH="$PATH:/Applications/Postgres.app/Contents/Versions/12/bin:/Users/chezixin/flutterSDK/flutter/bin:/usr/local/go/bin:$GOPATH:$GOBIN"
10
czxmac:~ chezixin$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:
/sbin:/Applications/VMwareFusion.app/Contents/Public:
/Applications/Postgres.app/Contents/Versions/latest/bin:
/Applications/Postgres.app/Contents/Versions/12/bin:
/Users/chezixin/flutterSDK/flutter/bin:/usr/local/go/bin:
/Users/chezixin/go:/Users/chezixin/go/bin':
/Users/chezixin/Go/bin:/Applications/Postgres.app/Contents/Versions/12/bin:
/Users/chezixin/flutterSDK/flutter/bin:
/usr/local/go/bin:/Users/chezixin/go:
/Users/chezixin/go/bin:/Users/chezixin/Go/bin
Already installed:
go get -u google.golang.org/grpc
look protoc:
czxmac:~ chezixin$ protoc --version
libprotoc 3.11.1
Protoc-gen-go is installed and exists in $ GOPATH/bin
go get -u github.com/golang/protobuf/protoc-gen-go
problem:
When I execute the following command
$ protoc --go_out=plugins=grpc:. *.proto
An error occurred:
protoc-gen-go: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--go_out: protoc-gen-go: Plugin failed with status code 1.
Where is the problem, please master guidance.
This issue is related with your PATH variable, please set it again.
I can see a typo of an extra trailing apostrophe(') in this line of PATH variable. /Users/chezixin/go:/Users/chezixin/go/bin':
Try updating it to
/Users/chezixin/go:/Users/chezixin/go/bin:
For anyone facing a similar issue, but it was not the case of an invalid PATH variable, I very much sympathize with you.
I realized that I had to install the compiler (again?) before it started working. I hadn't installed it before, but it appeared to already be downloaded. I guess I had to install it again or update it.
I personally was using betterproto, and I followed the instructions here to install it with the protoc plugin and try out their example.

PyCharm: Can't find spark-submit

I am trying to run a test file in PyCharm with unittest.
It errors with this message:
FileNotFoundError: [Errno 2] No such file or directory: 'myfolder/opt/spark/./bin/spark-submit': 'myfolder/opt/spark/./bin/spark-submit'
I think it has something to do with my .bash_profile which a coworker helped configure. It looks like this:
export SPARK_HOME=myfolder/opt/spark
export PATH=$SPARK_HOME/bin:$PATH
export PATH=$HOME/.node_modules_global/bin:$PATH
# added by Anaconda3 5.1.0 installer
export PATH="/Users/myname/anaconda3/bin:$PATH"
Important to note, the path myfolder/opt/spark/./bin/spark-submit does not exist, but myfolder/opt/spark/bin/spark-submit does. I have no idea why the extra ./ is being added to the path.

Dynamic Shared Library error when creating exe from cx_freeze

I have a python file using OpenCV library.I want this in as an executable file.
Came across this cx_freeze
Example:
ABC.py(file using opencv library)
Content of setup.py is given below
from cx_Freeze import setup, Executable
setup( name = "ABC",
version = "0.1",
description = "Testing",
executables = [Executable("ABC.py")],
)
I ran this command in the terminal
python setup.py install
It is stopping after showing this error message
copying /Users/name/.virtualenvs/test/lib/python3.6/site-packages/cv2.so -> build/exe.macosx-10.12-x86_64-3.6/lib/cv2.so
copying /Users/name/.virtualenvs/test/bin/../lib/libopencv_reg.3.3.dylib -> build/exe.macosx-10.12-x86_64-3.6/libopencv_reg.3.3.dylib
error: [Errno 2] No such file or directory: '/Users/name/.virtualenvs/test/bin/../lib/libopencv_reg.3.3.dylib'
I know from the error message that libopencv_reg.3.3.dylib is not found.
I'm running this on a python virtual environment.
This is my bash_profile content
#Homebrew
export PATH=/usr/local/bin:$PATH
#export WORKON_HOME=$HOME/.virtualenvs
# Virtualenv/VirtualenvWrapper
source /usr/local/bin/virtualenvwrapper.sh
#export PROJECT_HOME=$HOME/Devel
#export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
#export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
#export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
I'm confused please help me out fix this.
Guidance would really be helpful, if this question can be posted else where let me know rather than down voting it.
can you search your filesystem for the missing file? When you find it you can set PERL5LIB or use -I switch to set the location into the perl path
perl library path
Shared the same on OpenCV forum
here's the response I got there
Looks like we have build OpenCV in such a way that other shared objects(.so) files are not dependent.

Resources