abishkar bhattarai
abishkar bhattarai

Reputation: 7651

Signurl command requires the pyopenssl library in gsutil in google storage in creatiing signed URL

I am trying Create a signed URL with gsutil . following is the command $ gsutil signurl -d 10m path/to/privatekey.p12 gs://bucket/foo

mentioned in site https://developers.google.com/storage/docs/accesscontrol

I also issued a same like command with my bucket name and object as below

gsutil signurl -d 10m C:\Users\Desktop\javascript\service\4e263da.p12 gs://code-sample/File1

but i got following error

"signurl command requires the pyopenssl library try pip install pyopenssl or easy_install pyopenssl"

.So,i installed PyOpenSSL for window from here

https://pypi.python.org/pypi/pyOpenSSL/0.13 .My python version is 2.6.Still i am getting same error in running the command. So my question why command signurl is still not recognized after i installed pyopenssl in gsutil

Upvotes: 7

Views: 5513

Answers (8)

Alexandru Topala
Alexandru Topala

Reputation: 61

When using Python 3 and gsutil 5.27 or older, install pyopenssl as

pip3 install --user pyopenssl==23.2.0

The gsutil is trying to import load_pkcs12 from OpenSSL.crypto that was removed in the 23.3.0 version

Upvotes: 6

Pascal Delange
Pascal Delange

Reputation: 526

A recent version of pyopenssl (2.23.3) seems to have broken gsutil: https://github.com/GoogleCloudPlatform/gsutil/issues/1753 If you encounter this, you may want to revert to an older version.

Upvotes: 1

techhapps
techhapps

Reputation: 21

was getting this error and tried a variety of python pyopenssl options, but this worked for me in the end, on: Debian 10 with Google Cloud SDK 345.0.0 gsutil version: 4.63

sudo apt-get install python3-openssl

Upvotes: 2

user11564460
user11564460

Reputation:

Install with

pip3 install --user pyopenssl

and it should works (especially if you're running in the cloud console)!

Upvotes: 4

pprishchepa
pprishchepa

Reputation: 1107

I had the same problem with Python v3.7.5 and gsutil v4.46.

To fix the issue I installed pyopenssl for Python 2: pip2 install --user pyopenssl

Upvotes: 1

bestbear
bestbear

Reputation: 81

The problem is rooted in the gsutil shell script and the python libraries. The gsutil script expects Python 2.

pip3 uninstall pyOpenSSL
pip2 install pyOpenSSL

After the above I could successfully sign URLs using gsutil

Upvotes: -1

RedPanda
RedPanda

Reputation: 1

I'm running Python 2.7 with same issue. ProcMon was showing that the bundled Python was being executed (%LOCALAPPDATA%\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\python.exe) and not Python in the path variable.

I renamed the 'bundledpython' directory and re-ran 'gsutil signurl' and it ran successfully.

Note: this is after the crypto library was installed (https://cloud.google.com/sdk/crypto)

Upvotes: 0

Parag Bhayani
Parag Bhayani

Reputation: 3330

The issue might be because you are using 64 bit system and python Working with egenix-pyopenssl-0.13.4.1.0.1.9.win32-py2.7 - 32bit and python 32 bit solved this problem for me... Even google document recommends use of 32bits

Upvotes: 0

Related Questions