Google Cloud SDK gcloud error - windows-7-x64

I use Google Cloud SDK under Window 7 64bit.
Google Cloud SDK and python install success. and run gcloud.
The error occurs as shown below.
C:\Program Files\Google\Cloud SDK>gcloud
Traceback (most recent call last):
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\bin\..\./lib\googlecloudsdk\gcloud\gcloud.py", line 137, in <
module>
_cli = CreateCLI()
File "C:\Program Files\Google\Cloud SDK\google-cloud-sdk\bin\..\./lib\googlecloudsdk\gcloud\gcloud.py", line 98, in Cr
eateCLI
sdk_root = config.Paths().sdk_root
AttributeError: 'Paths' object has no attribute 'sdk_root'
Can ask for help? Thanks

I had the same problem. And this helped me solve this problem
Manually removed directory: C:\Program Files\Google\Cloud SDK
Then rerun: GoogleCloudSDKInstaller.exe
And make sure that you have connection to needed DL servers (I was first behind company firewall and installer didn't download all files - and no complains either by installer...)
Then I was OK again..
Source: https://code.google.com/p/google-cloud-sdk/issues/detail?id=62&thanks=62&ts=1407851956

echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt update
sudo apt-get install google-cloud-sdk
gcloud init

Related

Trouble Installing Python3.6 Virtual Environment on Ubuntu 22.04

Virtual environment stopped being created after upgrading to Ubuntu 22.04. Running the command
virtualenv venv -p python3.6
produces an error that did not occur in the previous version - Ubuntu 20.04.:
fail
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/virtualenv/seed/embed/via_app_data/via_app_data.py", line 84, in _get
result = get_wheel(
File "/usr/lib/python3/dist-packages/virtualenv/seed/wheels/acquire.py", line 26, in get_wheel
wheel = from_bundle(distribution, version, for_py_version, search_dirs, app_data, do_periodic_update, env)
File "/usr/lib/python3/dist-packages/virtualenv/seed/wheels/bundle.py", line 13, in from_bundle
wheel = load_embed_wheel(app_data, distribution, for_py_version, of_version)
File "/usr/lib/python3/dist-packages/virtualenv/seed/wheels/bundle.py", line 33, in load_embed_wheel
wheel = get_embed_wheel(distribution, for_py_version)
File "/usr/lib/python3/dist-packages/virtualenv/seed/wheels/embed/__init__.py", line 77, in get_embed_wheel
raise Exception((
Exception: Wheel for pip for Python 3.6 is unavailable. apt install python3-pip-whl
pip-21.3.1-py3-none-any.whl already present in /home/su/.local/share/virtualenv/wheel/3.6/embed/3/pip.json
created virtual environment CPython3.6.15.final.0-64 in 3225ms
creator CPython3Posix(dest=/home/su/Downloads/courses-app/venv, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/su/.local/share/virtualenv)
added seed packages: pip==21.3.1, setuptools==59.6.0, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
Can anyone help solve this problem?
The issue was resolved after installing the following packages:
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.6
sudo apt install libpython3.6-dev
sudo apt install python3.6-distutils

Docker-compose: /usr/local/bin/docker-compose : line 1: Not: command not found

i'm trying to install Docker-compose on my Raspberry Pi 3+ which installed Raspbian buster.
I followed instruction on docker.com. After I entered command : sudo curl -L https://github.com/docker/compose/releases/download/1.20.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose.
It show a table for downloading
Result
It seems nothing downloaded, just have a file docker-compose saved in /usr/local/bin/docker-compose. When I opened it, it empty. Then I enter command docker-compose -v, it displayed error /usr/local/bin/docker-compose : line 1: Not: command not found.
Anyone have solution?
UPDATE:
Added the following command to my answer to download the LATEST version without specifying any version number at all so the download can be scripted.
curl -L "https://github.com/docker/compose/releases/download/$(curl https://github.com/docker/compose/releases | grep -m1 '<a href="/docker/compose/releases/download/' | grep -o 'v[0-9:].[0-9].[0-9]')/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
It's a bit untidy, but it works. If you have a more elegant way than mine, ping it to me in the comments and I'll update my answer.
Just need to set the perms on the file:
chmod +x /usr/local/bin/docker-compose
Use the file command to validate that you pulled the correct arch for your system.
Intro:
Although docker-compose can be installed from a repo per the accepted answer, apt-cache show docker-compose reveals that as of 20211201 the repo version is only v1.25; about 2 years behind the current v2.1.1 release. In order to take advantage of more modern docker file versions, I needed to get the Github download working.
Short Answer:
The Docker documentation for Docker-Compose is WRONG. They forgot to preface the version number in the command with a "v"; consequently the download fails. Apparently this has been wrong for ages...
Longer Answer:
I ran the below command from the Docker-Compose documentation, and substituted the version "2.1.1" for "1.29.1" per Docker's guidance:
To install a different version of Compose, substitute 1.29.2 with the
version of Compose you want to use.
sudo curl -L "https://github.com/docker/compose/releases/download/2.1.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
The resulting download was 9 KB for a 23 MB binary. Clearly the link was bogus. So I went to the root of the address used in the command "https://github.com/docker/compose/releases" and right-clicked on the version of Docker-Compose that I wanted and chose "Copy Link Address"
This revealed the link Docker was telling folks to use didn't have a "v" prefaced before the version number in the https:// address part of the command.
Solution:
Preface a "v" before the version number you want in the link as below and the command executes successfully:
sudo curl -L "https://github.com/docker/compose/releases/download/v2.1.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
BTW, I too was downloading docker-compose for a Raspberry Pi using the aarch64 binary for Ubuntu 20.04 LTS. However, the missing "v" fix for the broken download address should work for any platform.
This is because on a raspberry pi the url part of the command results in
https://github.com/docker/compose/releases/download/1.24.1/docker-compose-Linux-armv7l
Looking at the latest stable release at https://github.com/docker/compose/releases/tag/1.24.1 you can see there is no download for the armv7l architecture so the file is empty because there is nothing to download.
Will update answer once I figured out how to install docker-compose on Raspian.
Edit:
Via apt-get. Note: Currently (Nov. 8 2019) this installs version 1.21 which is not the latest available.
sudo apt-get install docker-compose
Via pip3. (Installs latest)
sudo apt-get install python3-pip
sudo pip3 install docker-compose
And then restart your system with
sudo shutdown -r

Running Laravel Dusk on Homestead

I use Homestead Version 1.0.1 and Laravel version 5.4.16. I setup the Laravel dusk by reading the documentation.
But, when I run php artisan dusk by ssh to my homestead. I got an error like the following
PHPUnit 5.7.17 by Sebastian Bergmann and contributors.
E 1
/ 1 (100%)
Time: 2.52 minutes, Memory: 10.00MB
There was 1 error:
1) Tests\Browser\ExampleTest::testBasicExample
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown
for http POST to /session with params:
{"desiredCapabilities":{"browserName":"chrome","platform":"ANY","chromeOptions":{"binary":"","args":["no-first-run"]}}}
Operation timed out after 30001 milliseconds with 0 bytes received
Is there anyway to fix this 😊?
Yes, it can be found on the github pages of Dusk. It is a known issue and they are working to update the next homestead box.
The basic issue is that the homestead box has no visual interface and
that dusk runs a real browser, so you have to install a chromedriver
if you want to use it.
But for now this worked for me:
https://github.com/laravel/dusk/issues/50#issuecomment-275155974
Not included in that post but necessary for me:
make sure you have following permission set cd vendor/laravel/dusk/bin; chmod 775 *
Steps from the github post:
First of all, google-chrome is requried to be installed in guest OS:
$ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
$ sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
$ sudo apt-get update && sudo apt-get install -y google-chrome-stable
Next thing is xvfb:
$ sudo apt-get install -y xvfb
Try to start ./vendor/laravel/dusk/bin/chromedriver-linux --port=8888. If you have some errors about loading libraries (libnss3.so, libgconf-2.so.4), try this:
$ sudo apt-get install -y libnss3-dev libxi6 libgconf-2-4
When you see
$ ./vendor/laravel/dusk/bin/chromedriver-linux --port=8888
Starting ChromeDriver 2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e) on port 8888
Only local connections are allowed.
this means ChromeDriver can be started (so SupportsChrome trait should be able to start it too). You can stop this process for now (Ctrl+C).
Run
$ Xvfb :0 -screen 0 1280x960x24 &
in a separate terminal window.
Also you may want to add your dev domain in guest's /etc/hosts file:
127.0.0.1 domain.dev.
This issue is to add the chromedriver to homestead by default and will
be solved mid April. https://github.com/laravel/homestead/issues/516

ckan harvester: "No module named pika" error

On a ckan instance running ok, I installed the harvester extension following this guide: https://github.com/ckan/ckanext-harvest
these are the steps I followed:
. /usr/lib/ckan/default/bin/activate
cd /usr/lib/ckan/default/src/ckan
sudo pip install -e git+https://github.com/okfn/ckanext-harvest.git#stable#egg=ckanext-harvest
cd /usr/lib/ckan/default/src/ckan/src/ckanext-harvest
sudo pip install -r pip-requirements.txt
This is the content of pip-requirements.txt:
pika==0.9.8
redis==2.10.1
I continue configuring the plugin, everything seems to work ok. I have it running at http://localhost/harvest. Then I create a new source, and when I want to start the gather command I get this error:
$ . /usr/lib/ckan/default/bin/activate
$ cd /usr/lib/ckan/default/src/ckan/src/ckanext-harvest
$ paster --plugin=ckanext-harvest harvester gather_consumer --config=/etc/ckan/default/production.ini
Traceback (most recent call last):
File "/usr/lib/ckan/default/bin/paster", line 9, in <module>
load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')()
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 104, in run
invoke(command, command_name, options, args[1:])
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 143, in invoke
exit_code = runner.run(args)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 238, in run
result = self.command()
File "/usr/lib/ckan/default/src/ckan/src/ckanext-harvest/ckanext/harvest/commands/harvester.py", line 125, in command
from ckanext.harvest.queue import get_gather_consumer, gather_callback
File "/usr/lib/ckan/default/src/ckan/src/ckanext-harvest/ckanext/harvest/queue.py", line 5, in <module>
import pika
ImportError: No module named pika
I'm pretty sure there must be something really silly with the virtualenv (python newbie here)
This is because you used sudo pip. Because of how python's virtualenv works, if you want to use sudo to install into the virtualenv, you need to give full path to pip. Something like this would work
sudo /usr/lib/ckan/default/bin/pip -e git+https://github.com/okfn/ckanext-harvest.git#stable#egg=ckanext-harvest
cd /usr/lib/ckan/default/src/ckanext-harvest
sudo /usr/lib/ckan/default/bin/pip install -r pip-requirements.txt

Install ack-grep on CentOS

I went through fair amount of google search to install ack-grep on CentOS but I didn't find anything help. I also looked for the source codes but couldn't find it neither. Does anyone know how to install it on the OS?
Thanks a lot.
Could be essentially the same as https://stackoverflow.com/a/23155007/35946 but on CentOS 6.7 the answer is:
# yum install epel-release
# yum install ack
if you don't have the root permission, you can do as follows:
$ curl https://beyondgrep.com/ack-2.22-single-file > ~/bin/ack && chmod 0755 !#:3
or you can change to root user:
$ sudo su
# curl https://beyondgrep.com/ack-2.22-single-file > /bin/ack && chmod 0755 !#:3
You can get it from the EPEL software repository.
From the EPEL FAQ:
For EL5:
su -c 'rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm'
...
su -c 'yum install ack'
For EL6:
su -c 'rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm'
...
su -c 'yum install ack'
Go to Beyond Grep and look at the section titled
Install The ack executeable
curl http://beyondgrep.com/ack-2.14-single-file > ~/bin/ack && chmod 0755 !#:3
And replace ack.2.14 with the current version of ack.
You may need to create the directory mkdir ~/bin/ first. You may
also need to modify ~/.bashrc to include this new path E.G.:
PATH=$PATH:$HOME/bin
Then reload ~/.bashrc
source ~/.bashrc
Test the installation by running ack:
rpm -qa | ack s
This should display any installed packages containing the letter s. (some linux distributions may use ack-grep as the command.
How did you try installing it? Are you using yum? The package is probably not called "ack-grep", but just "ack".
The name "ack-grep" is a Debian-specific thing because there was already a package called "ack", so they called it "ack-grep" instead. That was years ago and now they're dropping the original "ack" package and renaming "ack-grep" to "ack".
For RedHat Enterprise just do sudo yum install ack