IvanaGyro / chocolatey-packages

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gcloudsdk exit code was 2 with choco install

wushuzh opened this issue · comments

When I install gcloudsdk by choco, the error message appears:

The terminal is cmder.

choco install gcloudsdk
....
......
........
Download of GoogleCloudSDKInstaller.exe (353.16 KB) completed.
Hashes match.
Installing gcloudsdk...
WARNING: Setup was cancelled.
ERROR: Running ["C:\Users\measuser\AppData\Local\Temp\chocolatey\gcloudsdk\0.0.0.20190318\GoogleCloudSDKInstaller.exe" /S /allusers ] was not successful. Exit code was '2'. Exit code indicates the following: Setup was cancelled..
Environment Vars (like PATH) have changed. Close/reopen your shell to
see the changes (or in powershell/cmd.exe just type `refreshenv`).
The install of gcloudsdk was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\gcloudsdk\tools\chocolateyinstall.ps1'.
See log for details.

Chocolatey installed 0/1 packages. 1 packages failed.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
- gcloudsdk (exited 2) - Error while running 'C:\ProgramData\chocolatey\lib\gcloudsdk\tools\chocolateyinstall.ps1'.
See log for details.

In chocolatey log

2019-05-20 17:12:20,057 18028 [INFO ] - Installing gcloudsdk...
2019-05-20 17:12:20,102 18028 [DEBUG] - Running Start-ChocolateyProcessAsAdmin -validExitCodes '0 3010 1641' -workingDirectory 'C:\Users\measuser\AppData\Local\Temp\chocolatey\gcloudsdk\0.0.0.20190318' -statements '/S /allusers ' -exeToRun 'C:\Users\measuser\AppData\Local\Temp\chocolatey\gcloudsdk\0.0.0.20190318\GoogleCloudSDKInstaller.exe'
2019-05-20 17:12:20,119 18028 [DEBUG] - Test-ProcessAdminRights: returning True
2019-05-20 17:12:20,124 18028 [DEBUG] - Elevating permissions and running ["C:\Users\measuser\AppData\Local\Temp\chocolatey\gcloudsdk\0.0.0.20190318\GoogleCloudSDKInstaller.exe" /S /allusers ]. This may take a while, depending on the statements.
2019-05-20 17:12:41,528 18028 [DEBUG] - Command ["C:\Users\measuser\AppData\Local\Temp\chocolatey\gcloudsdk\0.0.0.20190318\GoogleCloudSDKInstaller.exe" /S /allusers ] exited with '2'.
2019-05-20 17:12:41,541 18028 [WARN ] - WARNING: Setup was cancelled.

I also tried to install with singleuser in powershell. Same error.

PS C:\WINDOWS\system32> choco install gcloudsdk --overrideargs --ia='/S /singleuser' -y
Chocolatey v0.10.13
Installing the following packages:
gcloudsdk
By installing you accept licenses for the packages.
Progress: Downloading gcloudsdk 0.0.0.20190318... 100%

gcloudsdk v0.0.0.20190318 [Approved]
gcloudsdk package files install completed. Performing other installation steps.
Using explicit proxy server '10.144.1.10:8080'.
File appears to be downloaded already. Verifying with package checksum to determine if it needs to be redownloaded.
Hashes match.
Hashes match.
Installing gcloudsdk...
Overriding package arguments with '/S /singleuser' (replacing '/S /allusers')
WARNING: Setup was cancelled.
ERROR: Running ["C:\Users\measuser\AppData\Local\Temp\chocolatey\gcloudsdk\0.0.0.20190318\GoogleCloudSDKInstaller.exe" /S /singleuser] was not successful. Exit code was '2'. Exit code indicates the following: Setup was cancelled..
Environment Vars (like PATH) have changed. Close/reopen your shell to
see the changes (or in powershell/cmd.exe just type `refreshenv`).
The install of gcloudsdk was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\gcloudsdk\tools\chocolateyinstall.ps1'.
See log for details.

Chocolatey installed 0/1 packages. 1 packages failed.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
- gcloudsdk (exited 2) - Error while running 'C:\ProgramData\chocolatey\lib\gcloudsdk\tools\chocolateyinstall.ps1'.
See log for details.

@wushuzh I'm not sure what the exit code 2 means, but I've just retested this on my Windows 10 machine with the most recent version and for me it works fine. That said I think the following line might be a hint:

Using explicit proxy server '10.144.1.10:8080'.

The google cloud installer exe is not the full application. It is just an installer that then retrieves the actual binaries from the google servers. I'd think that maybe those either don't use your proxy or they had an issue retrieving the files.

You can try two things:

  1. Figure out where the installer logs to and see what the issue is to debug it
  2. Retry on a network without a proxy to see whether you can then install it ok

OK, I will have another way and feedback soon.

You're right. The issue may come from network proxy.

I tried to install gcloudsdk using GUI instead of choco package.

I saw the following error message in GUI textbox. (I did not find the correct location for installer log), but at least, I can see a few lines of logs now.

Output folder: C:\Users\measuser\AppData\Local\Google\Cloud SDK
Downloading Google Cloud SDK core.
Download failed: HTTP/1.1 502 Bad Gateway

My current proxy can help me to visit all google url from web browser successfully. It can help me download your choco packages. But it just cannot work with gcloudsdk installer.

I searched to see if there is useful messages in existing issue from google sdk github repo but it does not enable that.

Now it's too hard for me to find a network env without any proxy.
The only way for me is to try different proxys but in case the installer does not support it in the first place, I guess I can do nothing.

I saw this url contains some archived zip files for linux, macOS and windows.

https://cloud.google.com/sdk/docs/downloads-versioned-archives

I could download it successfully in my cli windows env.

λ curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-248.0.0-windows-x86_64.zip
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  127M  100  127M    0     0   989k      0  0:02:11  0:02:11 --:--:-- 1065k

Do you think there is any chance to let the gcloudsdk choco pkg to support special installation mode with these archives files ?
Or maybe the archive files installation shall be considered as a kind of Interactive installation and should be used within choco.

I don't think these were officially published when I created this package; using these definitely looks like an interesting option; the only downside I see is that it might mean we'll have to release new versions more frequently as currently the gcloud installer just downloads the most recent one. - On the other hand old versions won't automatically break as the archives are maintained by Google and have consistent URLs that include the version number. And we'll have to retest everything. But definitely an interesting option.

Hm. Downloading the installer manually as instructed here also gives me an error.

Output folder: C:\Users\oliver\AppData\Local\Google\Cloud SDK
Downloading Google Cloud SDK core.
Extracting Google Cloud SDK core.
Create Google Cloud SDK bat file: C:\Users\oliver\AppData\Local\Google\Cloud SDK\cloud_env.bat
Installing components.
Welcome to the Google Cloud SDK!
Error processing line 3 of C:\Python27\lib\site-packages\pygtk.pth:
  Traceback (most recent call last):
    File "C:\Python27\lib\site.py", line 152, in addpackage
      exec line
    File "<string>", line 1, in <module>
    File "C:\Python27\lib\site-packages\gtk-2.0\runtime\__init__.py", line 7, in <module>
      from ctypes import windll
    File "C:\Python27\lib\ctypes\__init__.py", line 10, in <module>
      from _ctypes import Union, Structure, Array
  ImportError: DLL load failed: %1 ist keine zulässige Win32-Anwendung.
Remainder of file ignored
Traceback (most recent call last):
  File "C:\Users\oliver\AppData\Local\Google\Cloud SDK\google-cloud-sdk\\lib\gcloud.py", line 95, in <module>
    main()
  File "C:\Users\oliver\AppData\Local\Google\Cloud SDK\google-cloud-sdk\\lib\gcloud.py", line 89, in main
    sys.executable))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe4 in position 33: ordinal not in range(128)
Error processing line 3 of C:\Python27\lib\site-packages\pygtk.pth:
  Traceback (most recent call last):
    File "C:\Python27\lib\site.py", line 152, in addpackage
      exec line
    File "<string>", line 1, in <module>
    File "C:\Python27\lib\site-packages\gtk-2.0\runtime\__init__.py", line 7, in <module>
      from ctypes import windll
    File "C:\Python27\lib\ctypes\__init__.py", line 10, in <module>
      from _ctypes import Union, Structure, Array
  ImportError: DLL load failed: %1 ist keine zulässige Win32-Anwendung.
Remainder of file ignored
Traceback (most recent call last):
  File "C:\Users\oliver\AppData\Local\Google\Cloud SDK\google-cloud-sdk\\bin\bootstrapping\install.py", line 12, in <module>
    import bootstrapping
  File "C:\Users\oliver\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\bootstrapping\bootstrapping.py", line 32, in <module>
    import setup  # pylint:disable=g-import-not-at-top
  File "C:\Users\oliver\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\bootstrapping\setup.py", line 55, in <module>
    from googlecloudsdk.core import properties
  File "C:\Users\oliver\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\properties.py", line 33, in <module>
    from googlecloudsdk.core.util import http_proxy_types
  File "C:\Users\oliver\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\util\http_proxy_types.py", line 23, in <module>
    import socks
  File "C:\Users\oliver\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\third_party\socks\__init__.py", line 18, in <module>
    from socks.python2.socks import *
  File "C:\Users\oliver\AppData\Local\Google\Cloud SDK\google-cloud-sdk\lib\third_party\socks\python2\socks\__init__.py", line 44, in <module>
    import socket
  File "C:\Python27\lib\socket.py", line 47, in <module>
    import _socket
ImportError: DLL load failed: %1 ist keine zulässige Win32-Anwendung.
Failed to install.

So maybe the installer is broken?

@oliver1980 I'd guess that somehow your local Python27 installation and the google cloud tool download you used are not for the same target platform. Please make sure first that both are either 64 or 32 bits.

Just fixed the same issue by myself.

Windows 10 Pro. with T.Chinese locale and a wide-characters user home folder.

First, for bad match of SHA, use choco --ignore-checksum.

Then, for problem that the installer reporting "Setup return error 2," it's internal issue is that the path for installation contains wide characters, so I applied a walkthrough to change my user home folder into ASCII characters, by chaning Windows registry value of \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-21-"corresponding registry account"/ProfileImagePath to my user home folder path.

The current (Oct 2019) checksum is 307e3d883dff23d4de739555696c5d2688c5612e2aa3361cd31b85e2ac2e7de3. To use it, issue the following command.

choco install --checksum=307e3d883dff23d4de739555696c5d2688c5612e2aa3361cd31b85e2ac2e7de3 gcloudsdk
commented

I am testing the package will be released with chocolatey-test-environment and I also get the exit code 2. Here is the error log. I'm trying to figure out how to fix it.

Welcome to the Google Cloud SDK!
Active code page: 65001
ERROR: gcloud failed to load: DLL load failed: The specified module could not be found.
    gcloud_main = _import_gcloud_main()
    import googlecloudsdk.gcloud_main
    from googlecloudsdk.api_lib.iamcredentials import util as iamcred_util
    from googlecloudsdk.api_lib.util import apis_internal
    from googlecloudsdk.core import properties
    from googlecloudsdk.core import config
    from oauth2client import client
    from oauth2client import transport
    import httplib2
    from httplib2.python3.httplib2 import *
    import ssl
    import _ssl             # if we can't import it, let the error propagate

This usually indicates corruption in your gcloud installation or problems with your Python interpreter.

Please verify that the following is the path to a working Python 2.7 or 3.5+ executable:
    C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\python.exe

If it is not, please set the CLOUDSDK_PYTHON environment variable to point to a working Python 2.7 or 3.5+ executable.

If you are still experiencing problems, please reinstall the Cloud SDK using the instructions here:
    https://cloud.google.com/sdk/
Traceback (most recent call last):
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\\bin\bootstrapping\install.py", line 12, in <module>
    import bootstrapping
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\bootstrapping\bootstrapping.py", line 39, in <module>
    from googlecloudsdk.core import config
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\googlecloudsdk\core\config.py", line 33, in <module>
    from oauth2client import client
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\oauth2client\client.py", line 39, in <module>
    from oauth2client import transport
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\oauth2client\transport.py", line 17, in <module>
    import httplib2
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\httplib2\__init__.py", line 20, in <module>
    from httplib2.python3.httplib2 import *
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\lib\third_party\httplib2\python3\httplib2\__init__.py", line 40, in <module>
    import ssl
  File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\lib\ssl.py", line 98, in <module>
    import _ssl             # if we can't import it, let the error propagate
ImportError: DLL load failed: The specified module could not be found.
Active code page: 437