Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot import name 'mtls' #933

Closed
nitramsivart opened this issue Jun 2, 2020 · 19 comments
Closed

cannot import name 'mtls' #933

nitramsivart opened this issue Jun 2, 2020 · 19 comments
Assignees
Labels
external This issue is blocked on a bug with the actual product. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@nitramsivart
Copy link

This appears to be a bug with version 1.9 caused by #917

Environment details

  • OS type and version: OS X 10.15.4
  • Python version: 3.6.10
  • pip version: 20.0.02
  • google-api-python-client version: 1.9.1

Steps to reproduce

  1. python -c "import googleapiclient.discovery"

Stack trace

----> 1 import googleapiclient.discovery

~/miniconda3/envs/surround-cp/lib/python3.6/site-packages/googleapiclient/discovery.py in <module>
     48 import uritemplate
     49 import google.api_core.client_options
---> 50 from google.auth.transport import mtls
     51 from google.auth.exceptions import MutualTLSChannelError
     52

ImportError: cannot import name 'mtls'
@nitramsivart
Copy link
Author

CC: @busunkim96 , @arithmetic1728

@nitramsivart
Copy link
Author

I see that my google-auth version is old (1.6.3), so maybe this is actually an issue of my not upgrading all dependencies properly.

@arithmetic1728
Copy link
Contributor

@nitramsivart yes, please upgrade google-auth. mtls is not defined in the old version.

@nitramsivart
Copy link
Author

Thank you, that resolved my issue!

@nitramsivart
Copy link
Author

nitramsivart commented Jun 5, 2020

Note, this is still an issue when I install this package with conda install, because these dependency requirements haven't been updated in the conda recipe: conda-forge/google-api-python-client-feedstock#39

@nitramsivart nitramsivart reopened this Jun 5, 2020
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Jun 5, 2020
@busunkim96
Copy link
Contributor

Hmm, I'm not entirely sure how this package is published to conda. @meredithslota?

@busunkim96 busunkim96 added external This issue is blocked on a bug with the actual product. and removed triage me I really want to be triaged. labels Jun 5, 2020
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Jun 5, 2020
@nitramsivart
Copy link
Author

Pretty sure it's published using conda-smithy, as described a bit more in README of this reop: https://github.com/conda-forge/google-api-python-client-feedstock

What's unclear to me is if anybody owns keeping this up to date, or it's just as needed

@busunkim96 busunkim96 added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed triage me I really want to be triaged. labels Jun 8, 2020
@busunkim96
Copy link
Contributor

Closing as this has been addressed by the folks who manage the repo mentioned above.

@A-Sm1th
Copy link

A-Sm1th commented Jun 15, 2020

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-61-286c2210acad> in <module>
      4 import httplib2
      5 
----> 6 from googleapiclient.discovery import build
      7 
      8 SCOPES = [

~/.local/lib/python3.6/site-packages/googleapiclient/discovery.py in <module>
     48 import uritemplate
     49 import google.api_core.client_options
---> 50 from google.auth.transport import mtls
     51 from google.auth.exceptions import MutualTLSChannelError
     52 

ImportError: cannot import name 'mtls'

I still get the error even though my pip list shows the version google-auth 1.17.2

I am using that in a Jupyter Notebook with Python 3.

@busunkim96
Copy link
Contributor

@A-Sm1th Can you double check the version? The latest published version is 1.9.2

@arithmetic1728
Copy link
Contributor

@A-Sm1th I tested google-auth 1.17.2 and it worked fine.

(tmp) $ python -m pip freeze
cachetools==4.1.0
google-auth==1.17.2
pyasn1==0.4.8
pyasn1-modules==0.2.8
rsa==4.6
six==1.15.0
(tmp) $ python
Python 3.6.9 (default, Jan 26 2020, 20:47:45) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.auth.transport import mtls
>>> 

@nitramsivart
Copy link
Author

Why is this being assigned to me?

@arithmetic1728
Copy link
Contributor

This issue is already closed, not sure what happened to the assignment.

@akram-ali-cs
Copy link

google-api-python-client version: 2.2.0

From yesterday getting this error, I've updated with the latest version as well.

@arithmetic1728
Copy link
Contributor

@akram-ali-cs I just tested 2.2.0, it worked fine. Maybe you need to update google-auth to latest version.

$ python
Python 3.7.6 (default, Jun 22 2020, 13:51:33) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.auth.transport import mtls

@fisakhan
Copy link

This is still a problem for me. Even after installing the latest version of google-auth, I get the following error.

$ pip install google_auth
Installing collected packages: google-auth
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
google-colab 1.0.0 requires google-auth~=1.4.0, but you have google-auth 1.32.0 which is incompatible.
google-api-python-client 1.12.8 requires six<2dev,>=1.13.0, but you have six 1.12.0 which is incompatible.
google-api-core 1.30.0 requires six>=1.13.0, but you have six 1.12.0 which is incompatible.
Successfully installed google-auth-1.32.0

I already have the following installed versions:

google-colab==1.0.0
tensorflow==2.5.0
tensorflow-cloud==0.1.16

@parthea
Copy link
Contributor

parthea commented Jun 28, 2021

Hi @ fisakhan,
For google-api-python-client, the following error is valid:
google-api-python-client 1.12.8 requires six<2dev,>=1.13.0, but you have six 1.12.0 which is incompatible.

six>=1.13.0 is required in the google-api-python-client setup.py file. Simply run pip install six==1.13.0.

@fisakhan
Copy link

fisakhan commented Jun 28, 2021

Now I get the following error:

$ pip install six==1.13.0
Collecting six==1.13.0
  Downloading six-1.13.0-py2.py3-none-any.whl (10 kB)
Installing collected packages: six
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tensorflow 2.5.0 requires six~=1.15.0, but you have six 1.13.0 which is incompatible.
google-colab 1.0.0 requires google-auth~=1.4.0, but you have google-auth 1.32.0 which is incompatible.
google-colab 1.0.0 requires six~=1.12.0, but you have six 1.13.0 which is incompatible.
cookiecutter 1.7.3 requires requests>=2.23.0, but you have requests 2.21.0 which is incompatible.
apache-beam 2.30.0 requires requests<3.0.0,>=2.24.0, but you have requests 2.21.0 which is incompatible.
Successfully installed six-1.13.0

tensorflow, google-colab and google-auth require different versions of six.

@parthea
Copy link
Contributor

parthea commented Jun 28, 2021

I see. Yes, it looks the compatible release ~= requirement for tensorflow and google-colab is potentially an issue.

In google-api-python-client the requirement is six>=1.13.0,<2dev so any version 1.13.0 or higher but less than 2dev will work.
In tensorflow, the requirement is six~=1.15.0, so only versions like 1.15.* will work
In google-colab, the requirement is six~=1.12.0, so only versions like 1.12.* will work

Please open an issue in the respective repos as there is no improvement for this repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external This issue is blocked on a bug with the actual product. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

8 participants