kennethreitz / maya

Datetimes for Humans™
MIT License
3.41k stars 196 forks source link

'regex._regex_core'; 'regex' is not a package #171

Closed kivo360 closed 5 years ago

kivo360 commented 5 years ago

Attempting to install Maya on an external server, I've run into the problem of not being able to find the regex package while the package was trying to parse dates. Here's what I tried:

>>> import maya
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/maya/__init__.py", line 1, in <module>
    from .core import *
  File "/home/ubuntu/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/maya/core.py", line 12, in <module>
    import dateparser
  File "/home/ubuntu/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/dateparser/__init__.py", line 4, in <module>
    from .date import DateDataParser
  File "/home/ubuntu/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/dateparser/date.py", line 10, in <module>
    import regex as re
  File "/home/ubuntu/anaconda3/envs/tensorflow_p36/lib/python3.6/site-packages/regex.py", line 400, in <module>
    import regex._regex_core as _regex_core
ModuleNotFoundError: No module named 'regex._regex_core'; 'regex' is not a package
>>> 

Is this normal? I really need to use the maya package.

trstruth commented 5 years ago

Seeing this issue as well, https://bitbucket.org/mrabarnett/mrab-regex/issues/315/error-on-package-import it looks like regex was updated 4 hours ago and broke some packages that depend on it

timofurrer commented 5 years ago

Thanks for the report!

maya users dateparser to parse those dates and that's where the error is actually occurring. Please file the issue in the dateparser library: https://github.com/scrapinghub/dateparser

This might already cover that in dateparser though: https://github.com/scrapinghub/dateparser/issues/505

Can you please try to pin the regex module to this version: https://pypi.org/project/regex/2019.02.20/ And see if that solves the problem for you?

:tada:

timofurrer commented 5 years ago

Alrighty, I just did some tests myself.

I can reproduce the error when I'm installing regex==2019.2.19 instead of the newest regex==2019.2.20. I think there was a regression in the regex module which is a dependency of dateparser. Please make sure to update regex.

I'm going to close this for now, as it isn't a problem with maya :tada: