google-api-python-client icon indicating copy to clipboard operation
google-api-python-client copied to clipboard

ERROR: 'OpenSSL.crypto' has no attribute 'sign'

Open Rodrigo-Novas opened this issue 10 months ago • 2 comments

Environment details

  • OS type and version: ubuntu:20.04 and macOs 14.7.1
  • Python version: 3.11
  • pip version: I dont use pip y use Poetry 1.5.1
  • google-api-python-client version: 2.159.0

Steps to reproduce

  1. Install google-api-python-client with pip, pdm, poetry, hatch... it doesn't matter
  2. Use the method oauth to authenticate from oauth2client.service_account import ServiceAccountCredentials
  3. use .execute() method of any googleapi method
  4. this retrieves the error 'OpenSSL.crypto' has no attribute 'sign'

Why does this happen?

Because you are importing oauth2client on the line https://github.com/googleapis/google-api-python-client/blob/main/googleapiclient/_auth.py#L33 and it is deprecated, oauth2client uses openssl with the method sign and openssl removed the method sign on the version 24.3.0.

So if you install openssl >= 24.3.0, and if you use the oauth2client.service_account from googleapiclient this will retrieves you the error

ERROR: module 'OpenSSL.crypto' has no attribute 'sign'

How to solves this?

Set a constraint of openssl >= 24.3.0 on googleapiclient or dont import oauth2client on googleapi anymore.

Rodrigo-Novas avatar Jan 24 '25 22:01 Rodrigo-Novas

Clarification question: do you mean set a constraint of openssl < 24.3.0 to avoid the error?

VincentLa avatar Jan 30 '25 23:01 VincentLa

@VincentLa

I do think that having an openssl constraint while oauth2client is still there would be the right thing to do

Rodrigo-Novas avatar Jan 31 '25 15:01 Rodrigo-Novas

Thanks for reporting this issue! We will investigate.

vchudnov-g avatar Apr 24 '25 18:04 vchudnov-g

@vchudnov-g @VincentLa you should not set a constraint to use an older pyopenssl version, please stop using oauth2client - which is deprecated since 2018 and the repo is archived! https://github.com/googleapis/oauth2client

h0nIg avatar Jun 03 '25 07:06 h0nIg