i cant install gonum to my project

433 views
Skip to first unread message

jorgeneo560

unread,
Oct 8, 2021, 3:09:23 PM10/8/21
to gonum-dev
when i try


it says installing modules via get is deprecated and use go install instead, what i should do?

Sebastien Binet

unread,
Oct 8, 2021, 3:37:54 PM10/8/21
to jorgeneo560, gonum-dev
hi,
could you post what you did (what Go version BTW?) and what happened?

also, if you could post a link to your code or repository, that would
help :)

cheers,
-s

jorgeneo560

unread,
Oct 11, 2021, 8:36:31 AM10/11/21
to gonum-dev
using the lastes version of go and vs code
i am getting this

go get: installing executables with 'go get' in module mode is deprecated.
        Use 'go install pkg@version' instead.
        For more information, see https://golang.org/doc/go-get-install-deprecation
        or run 'go help get' or 'go help install'.

Sebastien Binet

unread,
Oct 11, 2021, 9:07:04 AM10/11/21
to jorgeneo560, gonum-dev
On Mon Oct 11, 2021 at 14:36 CET, 'jorgeneo560' via gonum-dev wrote:
> using the lastes version of go and vs code
> i am getting this
>
> go get: installing executables with 'go get' in module mode is
> deprecated.
> Use 'go install pkg@version' instead.
> For more information, see
> https://golang.org/doc/go-get-install-deprecation
> or run 'go help get' or 'go help install'.

from within the top-level directory of your project, could you run:

$> go version
$> go env
$> go install -v -u gonum.org/v1/gonum
$> go mod tidy
$> go install ./...

and report back?

hth,
-s

jorgeneo560

unread,
Oct 12, 2021, 12:52:06 PM10/12/21
to gonum-dev

PS D:\GO\test> go version
go version go1.17.1 windows/amd64
PS D:\GO\test> go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\margarita\AppData\Local\go-build
set GOENV=C:\Users\margarita\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPRIVATE=
set GOROOT=C:\Program Files\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.17.1
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\MARGAR~1\AppData\Local\Temp\go-build2737645176=/tmp/go-build -gno-record-gcc-switches
PS D:\GO\test> go install -v -u gonum.org/v1/gonum
flag provided but not defined: -u
usage: go install [build flags] [packages]
Run 'go help install' for details.
PS D:\GO\test> go mod tidy
go: go.mod file not found in current directory or any parent directory; see 'go help modules'    
PS D:\GO\test> go install ./...
go: go.mod file not found in current directory or any parent directory; see 'go help modules'   

Sebastien Binet

unread,
Oct 12, 2021, 1:06:03 PM10/12/21
to jorgeneo560, gonum-dev
Jorge,
you use Go-1.17.x
as far as I know, this version of Go requires that you work in "module
mode".

if you go back under your GO/test directory and do something along the
lines of:

====
$> go version
go version go1.17.2 linux/amd64

$> mkdir -p /tmp/jorge/GO/test
$> cd /tmp/jorge/GO/test
$> go mod init mymodule
go: creating new go.mod: module mymodule

$> cat go.mod
module mymodule

go 1.17

$> go get -u -v gonum.org/v1/gonum
gonum.org/v1/gonum
go get: added gonum.org/v1/gonum v0.9.3

$> cat go.mod
module mymodule

go 1.17

require gonum.org/v1/gonum v0.9.3 // indirect

$> cat > main.go << EOF
package main

import _ "gonum.org/v1/gonum"

func main() {
println("hello gonum")
}
EOF

$> go build -o hello ./main.go
$> ./hello
hello gonum
===

everything should work.

hth,
-s
Reply all
Reply to author
Forward
0 new messages