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

I can't load any package #1426

Closed
CureSaba opened this issue Dec 1, 2023 · 10 comments
Closed

I can't load any package #1426

CureSaba opened this issue Dec 1, 2023 · 10 comments
Assignees
Labels
type: question Request for information or clarification. Not an issue.

Comments

@CureSaba
Copy link

CureSaba commented Dec 1, 2023

Environment details

  • OS:windows11
  • Python version:3.12.0
  • pip version:23.3.1
  • google-auth version:2.24.0

Steps to reproduce

  1. Install google-auth
  2. Try import module

image
There is a file in the pip directory but I can't load it

@parthea
Copy link
Contributor

parthea commented Dec 1, 2023

Can you please share the output after running which python?

Please also try running python -m pip install google-auth.

Please also check if the path that you see after running which python appears in in the output of this command

import sys
sys.path

@parthea parthea added the type: question Request for information or clarification. Not an issue. label Dec 1, 2023
@CureSaba
Copy link
Author

CureSaba commented Dec 1, 2023

image
which python gives an error

@parthea
Copy link
Contributor

parthea commented Dec 1, 2023

Sorry about that. where python may work , as which python is for unix.

Please also try running

python -c "import os, sys; print(os.path.dirname(sys.executable))"

Also try:

python -m pip install google-auth --ignore-installed

@CureSaba
Copy link
Author

CureSaba commented Dec 1, 2023

image

@parthea
Copy link
Contributor

parthea commented Dec 1, 2023

@clundin25 Do you have availability to reproduce the issue in Windows Power Shell?

@clundin25
Copy link
Contributor

I was not able to reproduce.

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\clundin> python --version
Python 3.12.0
PS C:\Users\clundin> python -m pip install google-auth
Collecting google-auth
  Downloading google_auth-2.24.0-py2.py3-none-any.whl.metadata (4.7 kB)
Collecting cachetools<6.0,>=2.0.0 (from google-auth)
  Obtaining dependency information for cachetools<6.0,>=2.0.0 from https://files.pythonhosted.org/packages/a2/91/2d843adb9fbd911e0da45fbf6f18ca89d07a087c3daa23e955584f90ebf4/cachetools-5.3.2-py3-none-any.whl.metadata
  Downloading cachetools-5.3.2-py3-none-any.whl.metadata (5.2 kB)
Collecting pyasn1-modules>=0.2.1 (from google-auth)
  Downloading pyasn1_modules-0.3.0-py2.py3-none-any.whl (181 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 181.3/181.3 kB 2.7 MB/s eta 0:00:00
Collecting rsa<5,>=3.1.4 (from google-auth)
  Downloading rsa-4.9-py3-none-any.whl (34 kB)
Collecting pyasn1<0.6.0,>=0.4.6 (from pyasn1-modules>=0.2.1->google-auth)
  Obtaining dependency information for pyasn1<0.6.0,>=0.4.6 from https://files.pythonhosted.org/packages/d1/75/4686d2872bf2fc0b37917cbc8bbf0dd3a5cdb0990799be1b9cbf1e1eb733/pyasn1-0.5.1-py2.py3-none-any.whl.metadata
  Downloading pyasn1-0.5.1-py2.py3-none-any.whl.metadata (8.6 kB)
Downloading google_auth-2.24.0-py2.py3-none-any.whl (183 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 183.8/183.8 kB 10.8 MB/s eta 0:00:00
Downloading cachetools-5.3.2-py3-none-any.whl (9.3 kB)
Downloading pyasn1-0.5.1-py2.py3-none-any.whl (84 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 84.9/84.9 kB 5.0 MB/s eta 0:00:00
Installing collected packages: pyasn1, cachetools, rsa, pyasn1-modules, google-auth
Successfully installed cachetools-5.3.2 google-auth-2.24.0 pyasn1-0.5.1 pyasn1-modules-0.3.0 rsa-4.9

[notice] A new release of pip is available: 23.2.1 -> 23.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip
PS C:\Users\clundin> python -c 'import google.auth'
PS C:\Users\clundin> python -c 'import google.oauth2'
PS C:\Users\clundin>

@clundin25
Copy link
Contributor

I believe test.py should work after you add import google.oauth2.

@CureSaba
Copy link
Author

CureSaba commented Dec 1, 2023

image
It works but why?
I think import google will load all package

@clundin25
Copy link
Contributor

Here is a document outlining importing for Python 3.12. https://docs.python.org/3/reference/import.html.

I think the behavior is likely because google is a namespace package, but I did not take a close look.

@CureSaba CureSaba closed this as completed Dec 1, 2023
@CureSaba
Copy link
Author

CureSaba commented Dec 1, 2023

Thank you for support

@CureSaba CureSaba closed this as not planned Won't fix, can't repro, duplicate, stale Dec 1, 2023
@CureSaba CureSaba reopened this Dec 1, 2023
@CureSaba CureSaba closed this as completed Dec 1, 2023
CureSaba added a commit to CureSaba/google-auth-library-python that referenced this issue Feb 29, 2024
…rt google

For fix this issue googleapis#1426
You can load google.auth and google.outh2 with import google
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

3 participants