I get the following error on vscode on Monterey with golang
Tools environment: GOPATH=/Users/randolphhill/devgo/workspace, GOBIN=/Users/randolphhill/devgo/workspace/bin
Installing 1 tool at the configured GOBIN: /Users/randolphhill/devgo/workspace/bin in module mode.
dlv
Installing github.com/go-delve/delve/cmd/dlv#latest FAILED
{
"killed": false,
"code": 2,
"signal": null,
"cmd": "/usr/local/opt/go/libexec/bin/go install -v github.com/go-delve/delve/cmd/dlv#latest",
"stdout": "",
"stderr": "go: cannot find GOROOT directory: /usr/local/opt/libexec\n"
}
1 tools failed to install.
dlv: failed to install dlv(github.com/go-delve/delve/cmd/dlv#latest): Error: Command failed: /usr/local/opt/go/libexec/bin/go install -v github.com/go-delve/delve/cmd/dlv#latest
go: cannot find GOROOT directory: /usr/local/opt/libexec
That seems like an odd GOROOT path. Have you tried uninstalling and reinstalling Go?
I have go installed and it is located at /usr/local/go/bin/go not /usr/local/opt/go/libexec/bin/go.
From the Go website: https://go.dev/doc/manage-install; The default install location is usually /usr/local/go.
Related
When i run my Go code in VSCode i needed install some modules. All modules normal downloaded and installing but 2 moduled (dlv & gopls) filed.
Tools environment: GOPATH=/home/user/project
Installing 2 tools at /home/user/project/bin in module mode.
dlv
gopls
Installing github.com/go-delve/delve/cmd/dlv#latest FAILED
{
"killed": false,
"code": 1,
"signal": null,
"cmd": "/usr/local/go/bin/go install -v github.com/go-delve/delve/cmd/dlv#latest",
"stdout": "",
"stderr": "go: downloading golang.org/x/sys v0.0.0-20220908164124-27713097b956\n../pkg/mod/github.com/sirupsen/logrus#v1.6.0/terminal_check_unix.go:6:8: golang.org/x/sys#v0.0.0-20220908164124-27713097b956: read \"https:/proxy.golang.org/#v/v0.0.0-20220908164124-27713097b956.zip\": read tcp 192.168.1.125:37454->209.85.233.141:443: read: connection reset by peer\n"
}
Installing golang.org/x/tools/gopls#latest FAILED
{
"killed": false,
"code": 1,
"signal": null,
"cmd": "/usr/local/go/bin/go install -v golang.org/x/tools/gopls#latest",
"stdout": "",
"stderr": "go: downloading golang.org/x/sys v0.2.0\n../pkg/mod/golang.org/x/tools#v0.3.1-0.20221213193459-ca17b2c27ca8/go/packages/external.go:15:2: golang.org/x/sys#v0.2.0: read \"https:/proxy.golang.org/#v/v0.2.0.zip\": read tcp 192.168.1.125:53838->142.250.185.209:443: read: connection reset by peer\n"
}
2 tools failed to install.
dlv: failed to install dlv(github.com/go-delve/delve/cmd/dlv#latest): Error: Command failed: /usr/local/go/bin/go install -v github.com/go-delve/delve/cmd/dlv#latest
go: downloading golang.org/x/sys v0.0.0-20220908164124-27713097b956
../pkg/mod/github.com/sirupsen/logrus#v1.6.0/terminal_check_unix.go:6:8: golang.org/x/sys#v0.0.0-20220908164124-27713097b956: read "https:/proxy.golang.org/#v/v0.0.0-20220908164124-27713097b956.zip": read tcp 192.168.1.125:37454->209.85.233.141:443: read: connection reset by peer
gopls: failed to install gopls(golang.org/x/tools/gopls#latest): Error: Command failed: /usr/local/go/bin/go install -v golang.org/x/tools/gopls#latest
go: downloading golang.org/x/sys v0.2.0
../pkg/mod/golang.org/x/tools#v0.3.1-0.20221213193459-ca17b2c27ca8/go/packages/external.go:15:2: golang.org/x/sys#v0.2.0: read "https:/proxy.golang.org/#v/v0.2.0.zip": read tcp 192.168.1.125:53838->142.250.185.209:443: read: connection reset by peer
In the terminal the code builds fine. I think the problem is in VSCode, but googling didn't turn up anything.
The "gopls" command is not available. Run "go get -v golang.org/x/tools/gopls" to install.
I'm running on go 1.14. Not sure what will happen, if I follow the instruction.
Installing 1 tool at the configured GOBIN: /usr/local/go/bin in module mode.
gopls
Installing golang.org/x/tools/gopls FAILED
{
"killed": false,
"code": 1,
"signal": null,
"cmd": "/usr/local/go/bin/go get -v golang.org/x/tools/gopls",
"stdout": "",
"stderr": "go: downloading golang.org/x/tools/gopls v0.6.9\ngo: golang.org/x/tools/gopls upgrade => v0.6.9\ngo: downloading golang.org/x/tools v0.1.1-0.20210319172145-bda8f5cee399
...
1 tools failed to install.
gopls: failed to install gopls(golang.org/x/tools/gopls): Error: Command failed: /usr/local/go/bin/go get -v golang.org/x/tools/gopls
go: downloading golang.org/x/tools/gopls v0.6.9
go: golang.org/x/tools/gopls upgrade => v0.6.9
go: downloading golang.org/x/tools v0.1.1-0.20210319172145-bda8f5cee399
go: downloading golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c
go: downloading honnef.co/go/tools v0.1.1
go: downloading golang.org/x/mod v0.4.1
golang.org/x/mod/semver
...
go get golang.org/x/tools/gopls: copying /var/folders/gq/bwl3jmx562x5twchgxvb6mlh0000gn/T/go-build703164122/b001/exe/a.out: open /usr/local/go/bin/gopls: permission denied
no output
I had the same problem and solved it with:
go install -v golang.org/x/tools/gopls#latest
if you get the error:
x\tools#v0.1.13-0.20220811140653-b901dff69f70\internal\lsp\source\hover.go:23:2: module golang.org/x/text#latest found (v0.3.7), but does not contain package golang.org/x/text/unicode/runenames
try using:
go clean -modcache
go install -v golang.org/x/tools/gopls#latest
The extension depends on other tools to provide necessary features. gopls is one of the core tools necessary to provide language features like code completion, navigation, search, etc for go language. See the list of tools the extension depends on: https://github.com/golang/vscode-go/blob/master/docs/tools.md
"Install" will install the 'gopls'.
"Install All" will install all the missing tools.
If you are using go1.14, either click the button (or run "Go: Install/Update Tools" command from the command palette) or, install tools in module mode with the following command (not just go get because with go1.14, the go command will try to install the tool in GOPATH mode which isn't what you want.)
cd /tmp/
GO111MODULE=on go get golang.org/x/tools/gopls
Here I solved using the command brew install gopls
I'm trying to install packages from a Pipfile with pipenv but I keep getting an error I don't know how debug.
pip --version
pip 18.1
pipenv --version
version 2018.10.9
The error I'm getting is:
pipenv install --dev --deploy
Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
Installing dependencies from Pipfile.lock (917af8)β¦
An error occurred while installing backports-ssl-match-hostname==3.5.0.1 --hash=sha256:502ad98707319f4a51fa2ca1c677bd659008d27ded9f6380c79e8932e38dcdf2! Will try again.
π ββββββββββββββββββββββββββββββββ 185/185 β 00:00:33
Installing initially failed dependenciesβ¦
Collecting backports-ssl-match-hostname==3.5.0.1 :00
Could not find a version that satisfies the requirement backports-ssl-match-hostname==3.5.0.1 (from -r /tmp/pipenv-qlbc3amj-requirements/pipenv-akfm2pt_-requirement.txt (line 1)) (from versions: )
No matching distribution found for backports-ssl-match-hostname==3.5.0.1 (from -r /tmp/pipenv-qlbc3amj-requirements/pipenv-akfm2pt_-requirement.txt (line 1))
β€ ββββββββββββββββββββββββββββββββ 0/1 β 00
Looking at the Pipfile.lock I can find the backports package defined as:
"backports.ssl-match-hostname": {
"hashes": [
"sha256:502ad98707319f4a51fa2ca1c677bd659008d27ded9f6380c79e8932e38dcdf2"
],
"version": "==3.5.0.1"
},
Running everything with the verbose flag, the backports package is a dependency from recurly which is in the Pipfile:
recurly = ">=2.8.6"
Downgrade your pip version to 18.0.0 while your pipenv shell is active
python -m pip install pip==18.0.0
It worked for me
I am trying to install pygobject for python 2.7 in pycharm for the purpose of using gstreamer. However I am having problems installing it. While in the virtual environment, if I use
pip install pygobject
Then the build fails and gives me this error
gi/gimodule.c:25:10: fatal error: 'glib-object.h' file not found
#include <glib-object.h>
^~~~~~~~~~~~~~~
1 error generated.
error: command 'cc' failed with exit status 1
full error log here
I know for a fact that glib exists on my system from searching for it with
find /usr -name glib-object.h
but for some reason the install can't find it. Do I have to link it in somehow/how do I go about doing this?
Also I know I can more successfully use this library with python3 but that caused some weird system errors that can apparently be resolved by using 2.7 so I am just exploring that at the moment.
With virtual environments it's recommended installing PyGObject with pipenv instead of pip.
Install pipenv with either MacPorts, HomeBrew or pipsi:
MacPorts
port install pipenv
HomeBrew
brew install pipenv
pipsi
curl https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python3 - --src=git+https://github.com/mitsuhiko/pipsi.git\#egg=pipsi
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
pipsi install pew
pipsi install pipenv
Once you've got pipenv installed then you should be able to add the package to your virtual environment:
pipenv install pygobject
β³ PyGObject : Creating A Development Environment
I was trying to install PyCrypto using PIP command
pip install pycrypto
I encountered error as,
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.15.26726\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
Please help me if anyone knows how to resolve this issue.
Searching about cli.exe and python lead me to https://github.com/explosion/spaCy/issues/2507
TLDR:
Choose one
use conda instead of pip
downgrade your python to 3.6 or lower
download an already compiled pycrypto and install it manually