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

ImportError: cannot import name 'KeycloakAdmin' from 'keycloak' #405

Open
AbhigyaShridhar opened this issue Jan 30, 2023 · 4 comments
Open

Comments

@AbhigyaShridhar
Copy link

keycloak==3.1.3
python-keycloak==2.9.0

from keycloak import KeycloakAdmin

This gives me the following error:

ImportError: cannot import name 'KeycloakAdmin' from 'keycloak' (/usr/local/lib/python3.9/site-packages/keycloak/init.py)

@deepakpant-ce
Copy link

deepakpant-ce commented Feb 5, 2023

is this resolved?

I am getting the same problem.

@iDmple
Copy link

iDmple commented Feb 8, 2023

Same issue here.

The issue is with 2.9.0, 2.8.0 works.

@deepakpant-ce
Copy link

I found this issue related to the VS Code editor specifically, I switched to pyCharm and the issue got resolved for me.

@ryshoooo
Copy link
Collaborator

ryshoooo commented Feb 8, 2023

Both packages keycloak and python-keycloak have the source module called keycloak, therefore running from keycloak import KeycloakAdmin might or might not work depending on how the installation is performed. What you end up with in your site-packages is a module called keycloak which has both python-keycloak source files and keycloak source files and since both of them contain __init__.py in the main module, this file gets overwritten by whatever was the last installed package (either python-keycloak or keycloak). If it was python-keycloak, the import works, if it was keycloak, the import will not work.

The point is these packages are not compatible with being used together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants