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 'get_localzone_name' from 'tzlocal' #159

Open
microdinosaur opened this issue Jan 11, 2024 · 5 comments
Open

cannot import name 'get_localzone_name' from 'tzlocal' #159

microdinosaur opened this issue Jan 11, 2024 · 5 comments

Comments

@microdinosaur
Copy link

I'm unable to import or run the function get_localzone_name. I've tried uninstalling and reinstalling a few times and rolling back to previous versions. I'm in a conda env but I've also tried installing through pip and no luck.

Everything looks good in the files - but for whatever reason it's failing no matter how I load. M1 Pro if it helps.

@regebro
Copy link
Owner

regebro commented Jan 12, 2024

What's the full error message?

@microdinosaur
Copy link
Author

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
Cell In[48], line 1
----> 1 from tzlocal import get_localzone_name

ImportError: cannot import name 'get_localzone_name' from 'tzlocal' (/Users/mrodin024/anaconda3/envs/ebi/lib/python3.11/site-packages/tzlocal/__init__.py)

When I run dir(tzlocal) to check, I get this return - no 'get_localzone_name' in the list.
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__', 'get_localzone', 'reload_localzone', 'sys', 'unix', 'utils']

@regebro
Copy link
Owner

regebro commented Jan 12, 2024

It looks like you are using version 3.0 (or earlier). get_localzone_name was added in 4.0b1.

@microdinosaur
Copy link
Author

Yeah - I was wondering if it was a version issue but I checked and I've got version 5.2 loaded according to my code.

@regebro
Copy link
Owner

regebro commented Jan 12, 2024

Well, you can look at /Users/mrodin024/anaconda3/envs/ebi/lib/python3.11/site-packages/tzlocal/__init__.py and see how it looks. If it includes get_localzone_name and you still get this error I think probably your install has become messed up and needs recreating.

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

2 participants