vacanza / holidays

World Holidays Framework
https://pypi.org/project/holidays
MIT License
1.49k stars 467 forks source link

hijri_converter import issue still appearing #425

Closed kamidzi closed 3 years ago

kamidzi commented 3 years ago

I see there was https://github.com/dr-prodigy/python-holidays/pull/380, but it seems the import still happens in https://github.com/dr-prodigy/python-holidays/blob/v0.10.5/holidays/utils.py.

$ pip install holidays==0.10.5
Processing /Users/kamidzi/Library/Caches/pip/wheels/7b/2f/68/d2c8e568166cd211e21111534228227d956680005ab35d6adc/holidays-0.10.5-cp36-none-any.whl
Requirement already satisfied: six in /Users/kamidzi/.pyenv/versions/3.6.9/lib/python3.6/site-packages (from holidays==0.10.5) (1.15.0)
Requirement already satisfied: python-dateutil in /Users/kamidzi/.pyenv/versions/3.6.9/lib/python3.6/site-packages (from holidays==0.10.5) (2.8.1)
Collecting convertdate
  Using cached convertdate-2.3.0-py3-none-any.whl (45 kB)
Collecting korean-lunar-calendar
  Using cached korean_lunar_calendar-0.2.1-py3-none-any.whl (8.0 kB)
Collecting pytz>=2014.10
  Using cached pytz-2021.1-py2.py3-none-any.whl (510 kB)
Processing /Users/kamidzi/Library/Caches/pip/wheels/8d/1a/e7/684cd77a99aac294f976db834fe613b5424f7c4d75ffb0b84d/PyMeeus-0.3.7-cp36-none-any.whl
Installing collected packages: pytz, pymeeus, convertdate, korean-lunar-calendar, holidays
Successfully installed convertdate-2.3.0 holidays-0.10.5 korean-lunar-calendar-0.2.1 pymeeus-0.3.7 pytz-2021.1
WARNING: You are using pip version 20.0.2; however, version 21.0.1 is available.
You should consider upgrading via the '/Users/kamidzi/.pyenv/versions/3.6.9/bin/python3.6 -m pip install --upgrade pip' command.
$ python -m holidays
Traceback (most recent call last):
  File "/Users/kamidzi/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/Users/kamidzi/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/Users/kamidzi/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/Users/kamidzi/.pyenv/versions/3.6.9/lib/python3.6/site-packages/holidays/__init__.py", line 13, in <module>
    from holidays.countries import *
  File "/Users/kamidzi/.pyenv/versions/3.6.9/lib/python3.6/site-packages/holidays/countries/__init__.py", line 22, in <module>
    from .burundi import Burundi, BI, BDI
  File "/Users/kamidzi/.pyenv/versions/3.6.9/lib/python3.6/site-packages/holidays/countries/burundi.py", line 21, in <module>
    from holidays.utils import get_gre_date
  File "/Users/kamidzi/.pyenv/versions/3.6.9/lib/python3.6/site-packages/holidays/utils.py", line 17, in <module>
    from hijri_converter import convert
ModuleNotFoundError: No module named 'hijri_converter'
dr-prodigy commented 3 years ago

Hi, it should be fixed now and released as 0.10.5.1 on pypi. Pls let me know, thank you very much!

kamidzi commented 3 years ago

Thanks, though I think there are still some remaining issues:

$ pip show holidays
Name: holidays
Version: 0.10.5.1
Summary: Generate and work with holidays in Python
Home-page: https://github.com/dr-prodigy/python-holidays
Author: ryanss
Author-email: ryanssdev@icloud.com
License: MIT
Location: /Users/kamidzi/.pyenv/versions/3.6.9/lib/python3.6/site-packages
Requires: python-dateutil, six, convertdate, korean-lunar-calendar, hijri-converter
Required-by:
$ python -m holidays
Traceback (most recent call last):
  File "/Users/kamidzi/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/Users/kamidzi/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/Users/kamidzi/.pyenv/versions/3.6.9/lib/python3.6/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/Users/kamidzi/.pyenv/versions/3.6.9/lib/python3.6/site-packages/holidays/__init__.py", line 13, in <module>
    from holidays.countries import *
  File "/Users/kamidzi/.pyenv/versions/3.6.9/lib/python3.6/site-packages/holidays/countries/__init__.py", line 45, in <module>
    from .israel import Israel, IL, ISR
  File "/Users/kamidzi/.pyenv/versions/3.6.9/lib/python3.6/site-packages/holidays/countries/israel.py", line 16, in <module>
    from convertdate.holidays import hanukkah, lag_baomer, passover, purim, \
ImportError: cannot import name 'lag_baomer'
dr-prodigy commented 3 years ago

This seems related to an old convertdate package (the name is present only from 2.3.0 on). Not clear why the updated requirement is not enforced upon holidays update: in my last version I reviewed setup.py to require it: install_requires=['python-dateutil', 'six', 'convertdate>=0.2.3', 'korean_lunar_calendar', 'hijri_converter'], Could you please double-check? Thanks

kamidzi commented 3 years ago

Right, updating convertdate works. I think there is a typo in the install_requires. I've sent you a PR.

dr-prodigy commented 3 years ago

Gawrsh!! I will fix and release again. So unlucky release tonight! :( Thx a lot

dr-prodigy commented 3 years ago

Hi, it is now fixed now and released as 0.10.5.2 on pypi. Thank you very much, closing this!