gcloud installation permission issue on Ubuntu 12.04 - google-app-engine

I have installed PHP App Engine SDK first. Then, I installed Google Cloud SDK using:
sudo curl https://sdk.cloud.google.com | bash
but it's showing error while installing.
Then, I installed Google Cloud SDK from a zip file, but it shows an error at the final stage of installation:
/home/nikhil/google-cloud-sdk/install.sh
Welcome to the Google Cloud SDK!
Traceback (most recent call last):
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/install.py", line 20, in <module>
from googlecloudsdk.gcloud import gcloud
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/gcloud/gcloud.py", line 190, in <module>
_cli = CreateCLI()
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/gcloud/gcloud.py", line 188, in CreateCLI
return loader.Generate()
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/calliope/cli.py", line 304, in Generate
cli = self.__MakeCLI(top_group)
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/calliope/cli.py", line 467, in __MakeCLI
log.AddFileLogging(self.__logs_dir)
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/core/log.py", line 547, in AddFileLogging
_log_manager.AddLogsDir(logs_dir=logs_dir)
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/core/log.py", line 331, in AddLogsDir
log_file = self._SetupLogsDir(logs_dir)
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/core/log.py", line 408, in _SetupLogsDir
os.makedirs(day_dir_path)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/home/nikhil/.config/gcloud/logs/2015.07.03'
What should I do to complete installation?
Then, I tried gcloud info on terminal, but it's showing the error below:
nikhil#nikhil-Aspire-S3-391:~$ gcloud info
Traceback (most recent call last):
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 190, in <module>
_cli = CreateCLI()
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 188, in CreateCLI
return loader.Generate()
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 304, in Generate
cli = self.__MakeCLI(top_group)
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 467, in __MakeCLI
log.AddFileLogging(self.__logs_dir)
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line 547, in AddFileLogging
_log_manager.AddLogsDir(logs_dir=logs_dir)
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line 331, in AddLogsDir
log_file = self._SetupLogsDir(logs_dir)
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line 408, in _SetupLogsDir
os.makedirs(day_dir_path)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/home/nikhil/.config/gcloud/logs/2015.07.04'

This looks like a file permissions error in creating the directory /home/nikhil/.config/gcloud/logs/2015.07.04. Can you check the existence and file permissions for all of the parent directories?
ls -ld /home/nikhil/
ls -ld /home/nikhil/.config
ls -ld /home/nikhil/.config/gcloud
ls -ld /home/nikhil/.config/gcloud/logs
ls -ld /home/nikhil/.config/gcloud/logs/2015.07.04
Then upload the output to this question.
My hunch is that you've run a Cloud SDK command as the root user (generally not recommended), which created the /home/nikhil/.config/gcloud directory with root as the owner. If this is the case, the command:
sudo chown -R nikhil /home/nikhil/.config/gcloud
may fix the issue.
As an aside, the command sudo curl https://sdk.cloud.google.com | bash will not do what you want it to do; it executes curl as root, but the actual install will not happen as the root user. The Cloud SDK can be installed without root privileges, so I recommend simply curl https://sdk.cloud.google.com | bash.

Related

PhpPathError: For php72, --php_executable_path must be specified in Google App Engine project

I'm running google cloud sdk in my local environment (windows 10) and deploy the apps to cloud projects. I can run php55 projects but when I try to run php72 project I get below errors.
INFO 2019-10-12 09:22:00,588 devappserver2.py:278] Skipping SDK update check.
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\dev_appserver.py", line 96, in <module>
_run_file(__file__, globals())
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\dev_appserver.py", line 90, in _run_file
execfile(_PATHS.script_file(script_name), globals_)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 600, in <module>
main()
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 588, in main dev_server.start(options)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 301, in start
raise PhpPathError('For php72, --php_executable_path must be specified.')
__main__.PhpPathError: For php72, --php_executable_path must be specified.
In app.yaml:
runtime: php72
It appears you are using dev_appserver.py to run your project locally, but according to the Google App Engine documentation here, you cannot use dev_appserver.py with PHP7.
Specifically it says:
dev_appserver.py is not supported
with the PHP 7.2 and PHP 7.3 runtimes. To test your application and
run it locally, you must download and install PHP 7.2 or PHP 7.3 and
set up a web server.
For example, start the HTTP server by running the following command:
php -S localhost:8080
Then, view your application in your web browser
at http://localhost:8080.

Traceback (most recent call last): File "./odoo-bin", line 5, in <module>

Traceback (most recent call last):
File "./odoo-bin", line 5, in
import odoo
File "/opt/odoo/odoo/odoo/init.py", line 73, in
import babel
ModuleNotFoundError: No module named 'babel'
In Odoo should install first all requirements
Navigate to your project folder then try to run this command in terminal
pip install -r requirements.txt
If get any error while this command execution, resolve that errors then only Odoo server work.
If you use multi version of python
Check version:
python --version
e.g For me: Python 3.7.7
py -3.7 -m pip install -r requirements.txt

Google App Engine SSL Certificate Error

I'm using IntelliJ IDE, I have installed google cloud sdk, google app engine sdk, python. but when I'm trying to go through ItelliJ>>tools>>google app engine for php >> upload app engine php app. but I"m getting this error:
Traceback (most recent call last):
File "C:/Program Files (x86)/Google/google_appengine/appcfg.py", line 133, in <module>
run_file(__file__, globals())
File "C:/Program Files (x86)/Google/google_appengine/appcfg.py", line 129, in run_file
execfile(_PATHS.script_file(script_name), globals_)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 5521, in <module>
main(sys.argv)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 5512, in main
result = AppCfgApp(argv).Run()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 2975, in Run
self.action(self)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 5168, in __call__
return method()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 3900, in Update
self._UpdateWithParsedAppYaml(appyaml, self.basepath)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 3921, in _UpdateWithParsedAppYaml
updatecheck.CheckForUpdates()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\sdk_update_checker.py", line 245, in CheckForUpdates
runtime=runtime))
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appengine_rpc_httplib2.py", line 246, in Send
url, method=method, body=payload, headers=headers)
File "C:\Program Files (x86)\Google\google_appengine\lib\httplib2\httplib2\__init__.py", line 1584, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "C:\Program Files (x86)\Google\google_appengine\lib\httplib2\httplib2\__init__.py", line 1332, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "C:\Program Files (x86)\Google\google_appengine\lib\httplib2\httplib2\__init__.py", line 1268, in _conn_request
conn.connect()
File "C:\Program Files (x86)\Google\google_appengine\lib\httplib2\httplib2\__init__.py", line 1037, in connect
raise SSLHandshakeError(e)
httplib2.SSLHandshakeError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)
Process finished with exit code 1
There is certificate file available on this path: google_appengine\lib\cacerts\cacerts.txt
also I have authenticated using gcloud shell and setup proper project. and in ItelliJ app.yml set same project id.
Can anyone help me to solve this issue.
Thanks,
I got a similar error (on linux) when trying to run the development server after upgrading the GAE SDK from 1.9.49 (which worked fine) to currently latest 1.9.51.
After digging on SO and finding suggestions for renaming/removing the cacerts.txt file equivalent to the one you mentioned I tried it, but it didn't help - some other related error popped up.
So I just copied over the respective cacerts.txt file from the 1.9.49 SDK and things are working fine again.

Jenkins gcloud deployment causes ImportError

I've set up a Jenkins instance in Google Compute Engine to build and deploy an App Engine Java project following this page from Google.
I've configured Jenkins to run the following shell command only when the Maven build succeeds: gcloud --project=decent-ellipse-843 preview app deploy target/*-SNAPSHOT/
When I attempt a build, the deployment fails with the following trace:
+ gcloud --project=decent-ellipse-843 preview app deploy target/backend-api-0.0.1-SNAPSHOT/
Traceback (most recent call last):
File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 183, in <module>
main()
File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 179, in main
_cli.Execute()
File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 488, in Execute
post_run_hooks=self.__post_run_hooks)
File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/calliope/backend.py", line 1016, in Run
result = command_instance.Run(args)
File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/calliope/exceptions.py", line 86, in TryFunc
return func(*args, **kwargs)
File "/usr/local/share/google/google-cloud-sdk/lib/googlecloudsdk/appengine/app_commands/deploy.py", line 158, in Run
stage_dir = self.__MakeStagingDir(project, args, deployable)
File "/usr/local/share/google/google-cloud-sdk/lib/googlecloudsdk/appengine/app_commands/deploy.py", line 268, in __MakeStagingDir
java_app_update = appcfg_java.JavaAppUpdate(deployable, args)
File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/appcfg_java.py", line 146, in __init__
self.app_engine_web_xml = self._ReadAppEngineWebXml()
File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/appcfg_java.py", line 205, in _ReadAppEngineWebXml
parser=app_engine_web_xml_parser.AppEngineWebXmlParser)
File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/appcfg_java.py", line 217, in _ReadAndParseXml
return parser().ProcessXml(file_handle.read())
File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/app_engine_web_xml_parser.py", line 71, in ProcessXml
xml_root = ElementTree.fromstring(xml_str)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1300, in XML
parser = XMLParser(target=TreeBuilder())
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1466, in __init__
"No module named expat; use SimpleXMLTreeBuilder instead"
ImportError: No module named expat; use SimpleXMLTreeBuilder instead
Build step 'Execute shell' marked build as failure
Finished: FAILURE
The Maven build is successful, and I can deploy the project by issuing the gcloud command manually.
Even when I run the exact same gcloud command from the same directory and under the same user (tomcat), the deployment succeeds without errors.
I have re-installed python and updated the Google Cloud SDK without any results.
The instance is running Python 2.7.3, Jenkins 1.598, JDK 7u76 and Maven 3.2.2.
I hope someone can help me out with this!
I ran into a similar issue running my jobs on the cloud-dev-python slave. The images are missing build tools that you may need in order to build and deploy properly. My solution was to connect to the docker image and install the tools manually the first time around.
# on docker host, connect to java image
CONTAINER_ID=$(docker ps | grep cloud-dev-java | awk '{print $1}');
docker exec -i -t $CONTAINER_ID bash
# on docker image, install crap to build lxml, etc
gcloud -q components update preview app && apt-get update \
&& apt-get install -y build-essential libz-dev libxml2-dev \
libxslt1-dev python-dev python-pip && apt-get autoremove
Give that a whirl and see if it helps. I'm currently stuck with the service account not authenticating even though it is set up properly...

appengine new application deployment fails with 'version not ready' exception

I'm trying to deploy an application on appengine, it is a new one.
I tried changing version names and deploying again, I even created a new application id and deplyed the same app but with no luck.
2013-06-10 19:47:41,615 WARNING appcfg.py:1778 Version still not ready to serve, aborting.
2013-06-10 19:47:41,615 ERROR appcfg.py:1992 An unexpected error occurred. Aborting.
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 1978, in DoUpload
app_summary = self.Commit()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 1779, in Commit
raise Exception('Version not ready.')
Exception: Version not ready.
07:47 PM Rolling back the update.
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 171, in <module>
run_file(__file__, globals())
File "C:\Program Files (x86)\Google\google_appengine\appcfg.py", line 167, in run_file
execfile(script_path, globals_)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 4187, in <module>
main(sys.argv)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 4178, in main
result = AppCfgApp(argv).Run()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 2339, in Run
self.action(self)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 3913, in __call__
return method()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 2914, in Update
self.UpdateVersion(rpcserver, self.basepath, appyaml, yaml_file_basename)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 2863, in UpdateVersion
return appversion.DoUpload(paths, openfunc)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 1978, in DoUpload
app_summary = self.Commit()
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\appcfg.py", line 1779, in Commit
raise Exception('Version not ready.')
Exception: Version not ready.
2013-06-10 19:47:43 (Process exited with code 1)
any clue?!
It looks like this same issue has been seen before.
there is a work around that should work for most developers:
Deploy your application as a new version. Please do not constantly attempt to redeploy your app. Your app is already in the queue even if
the deploy script times out.
Validate that the new version is active using the .latest URL
Use the Admin Console to switch the active or default application to this version
Unable to update app: Version not ready
If that doesn't work, some people are reported success with performing a rollback of their application, and then redeploying it.
I have seen it be a transient issue. Try again in a few minutes.

Resources