Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions on Install #65

Open
hlalibe opened this issue Jul 16, 2018 · 5 comments
Open

Questions on Install #65

hlalibe opened this issue Jul 16, 2018 · 5 comments

Comments

@hlalibe
Copy link

hlalibe commented Jul 16, 2018

Hi,

I hope it's the right place for these questions. I'm having problems to install.

I have installed Go following your instructions, i've tested it with Hello World program and it works.
I have already installed Jupyter Notebook
I have installed ZMQ.

Now to install your lgo:
When i run this command:
go get github.com/yunabe/lgo/cmd/lgo && go get -d github.com/yunabe/lgo/cmd/lgo-internal
Is there anything i should check to see if it has executed properly ? I don't have any messages, the prompt returns back quickly.
edit: in my /usr/local/go/bin directory i have only these 3 files, no subs:
go, godoc and gofmt
Could it be that your file or folder is not downloaded ? or downloaded in the wrong place ? I searched for lgo folder but i only find the one i created to install your program.

Then, to Set LGOPATH environment variable, what should I do exactly ?
I have added this line to my etc/environment file and rebooted
LGOPATH="/usr/local/go/lgo"
edit: when i enter this in terminal: printenv LGOPATH
i get: /usr/local/go/lgo
So it looks like my LGOPATH is set correctly ?

But then when i run lgo install, i get:
No command 'lgo' found,

Sorry i'm still rather new to Linux, there is surely some basic newbie stuff i missed here.

edit: if needed, when i type go env i get:
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/hugues/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/hugues/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build965093010=/tmp/go-build -gno-record-gcc-switches"

Took this week off to progress my project, hope you can get me started quickly :-)

@yunabe
Copy link
Owner

yunabe commented Jul 17, 2018

Now to install your lgo:
When i run this command:
go get github.com/yunabe/lgo/cmd/lgo && go get -d github.com/yunabe/lgo/cmd/lgo-internal
Is there anything i should check to see if it has executed properly ? I don't have any messages, the > prompt returns back quickly.

go get github.com/yunabe/lgo/cmd/lgo would install lgo into bin directory of GOPATH.
Can you first double-check the value of GOPATH in your environment (go env GOPATH)?
I suspect your GOPATH is not set to /usr/local/go/bin. From go1.8, the default value of GOPATH is $HOME/go in UNIX like systems.

Also, go get -v github.com/yunabe/lgo/cmd/lgo (go get with -v option) may show useful information to you.

@hlalibe
Copy link
Author

hlalibe commented Jul 17, 2018

Hi,

progress :-)
Indeed my GOPATH was not set to /usr/local/go/bin
I struggled a bit to find a way to set it permanently to the above, but i found it:
I had to add this line to my .bashrc: export GOPATH=/usr/local/go/bin
Now when I type go env GOPATH, i always get /usr/local/go/bin

Now, when i enter go get -v github.com/yunabe/lgo/cmd/lgo i get:
github.com/yunabe/lgo (download)
package github.com/yunabe/lgo/cmd/lgo: mkdir /usr/local/go/bin/src: permission denied

??
i tried to go to root first by sudo -i but it does not seem to be the way, nothing happens. Also, after sudo -i, my GOPATH reads /root/go

edit: i managed to install LGO finally, did it manually, just to be sure i made it right, my install.log reads:
2018/07/17 09:21:16 Install lgo to /usr/local/go/lgo
2018/07/17 09:21:16 Building libstd.so
2018/07/17 09:21:22 Building lgo core package
2018/07/17 09:21:23 Building third-party packages in $GOPATH
2018/07/17 09:21:23 Installing lgo-internal
2018/07/17 09:21:25 lgo was installed in /usr/local/go/lgo successfully

I have now a bin and pkg folder under my usr/local/go/lgo/ folder

@hlalibe
Copy link
Author

hlalibe commented Jul 17, 2018

Now i'm struggling with the last step, "Install the kernel configuration to Jupyter Notebook"

this command
python $(go env GOPATH)/src/github.com/yunabe/lgo/bin/install_kernel

returns
python: can't open file '/usr/local/go/bin/src/github.com/yunabe/lgo/bin/install_kernel': [Errno 2] No such file or directory

I'm struggling to understand why you use my GOPATH in front of your own github link ?!?
python -V returns:
Python 3.6.3 :: Anaconda custom (64-bit)

@yunabe
Copy link
Owner

yunabe commented Jul 17, 2018

I had to add this line to my .bashrc: export GOPATH=/usr/local/go/bin
Now when I type go env GOPATH, i always get /usr/local/go/bin

I think you should add $HOME/go/bin into PATH instead of setting /usr/local/go/bin to GOPATH.

Anyway, it seems like you don't understand GOPATH in golang.
Please read the golang doc and other articles to understand how GOPATH is used in Go? I think there are a bunch of good articles about GOPATH in web.

I'm struggling to understand why you use my GOPATH in front of your own github link ?!?

Because go get downloads the source code into GOPATH/src dir.

@hlalibe
Copy link
Author

hlalibe commented Jul 17, 2018

edit: see bold text below for latest error message

thanks for your patience, i'm new to Linux and GO and this PATH topic is not so easy to grasp. I did read the link you provided.

What is not clear for me is how to do this:
I think you should add $HOME/go/bin into PATH instead of setting /usr/local/go/bin to GOPATH

I have these lines in my .profile:
PATH="$HOME/bin:$HOME/.local/bin:$PATH:/usr/local/go/bin"
LGOPATH="/usr/local/go/lgo"
export GOPATH=/usr/local/go/bin

Do you mean i should change them for:
PATH="$HOME/bin:$HOME/.local/bin:$PATH:/usr/local/go/bin:$HOME/go/bin"
LGOPATH="/usr/local/go/lgo"

?
I did it and when i run python3 $(go env GOPATH)/src/github.com/yunabe/lgo/bin/install_kernel
i get
python3: can't open file '/usr/local/go/bin/src/github.com/yunabe/lgo/bin/install_kernel': [Errno 2] No such file or directory

edit: i have managed to run the install_kernel command by setting back my GOPATH to /home/hugues/go and the result was:
Installing Jupyter kernel spec

I'm now able to create Go jupyternotebook in another folder. But the KERNEL button is red, when i click on it, the last line of the whole text says:
File "/home/hugues/anaconda3/lib/python3.6/subprocess.py", line 1344, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/home/hugues/go/bin/lgo': '/home/hugues/go/bin/lgo'

Indeed my lgo folder is not under this path but in:
/usr/local/go/
Something wrong with my LGOPATH ?

I tried to copy over my lgo folder under /home/hugues/go/bin/ and now the Kernel error message changes to:
File "/home/hugues/anaconda3/lib/python3.6/subprocess.py", line 1344, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: '/home/hugues/go/bin/lgo'

I have checked and my userid has all permissions on this folder and below. I don't have this error message if i open a python notebook which is in the same folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants