scrapinghub / dateparser

python parser for human readable dates
BSD 3-Clause "New" or "Revised" License
2.55k stars 465 forks source link

ruamel.yaml ImportError #260

Closed brianckeegan closed 7 years ago

brianckeegan commented 7 years ago

I am attempting to use dateparser 0.5.0 on an Anaconda 2.7.12 on Windows 10.

$ pip install dateparser
...
Successfully installed 
dateparser-0.5.0
jdatetime-1.8.1 
regex-2016.11.21 
ruamel.ordereddict-0.4.9 
ruamel.yaml-0.13.4
typing.3.5.2.2 
tzlocal-1.3 
umalqurra-0.2

$ ipython
>>> import dateparser
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-29-41cf525f5b76> in <module>()
----> 5 import dateparser

\Anaconda2\lib\site-packages\dateparser\__init__.py in <module>()
      2 __version__ = '0.5.0'
      3 
----> 4 from .date import DateDataParser
      5 from .conf import apply_settings
      6 

\Anaconda2\lib\site-packages\dateparser\date.py in <module>()
      9 from dateutil.relativedelta import relativedelta
     10 
---> 11 from dateparser.date_parser import date_parser
     12 from dateparser.freshness_date_parser import freshness_date_parser
     13 from dateparser.languages.loader import LanguageDataLoader

\Anaconda2\lib\site-packages\dateparser\date_parser.py in <module>()
      8 from .timezone_parser import pop_tz_offset_from_string
      9 from .utils import strip_braces, apply_timezone, localize_timezone
---> 10 from .conf import apply_settings
     11 from .parser import parse
     12 

\Anaconda2\lib\site-packages\dateparser\conf.py in <module>()
      5 import six
      6 
----> 7 from ruamel.yaml import load as load_yaml
      8 
      9 from .utils import registry

ImportError: No module named ruamel.yaml
maebert commented 7 years ago

I have the same problem here, installing on OS X without anaconda.

waqasshabbir commented 7 years ago

@brianckeegan @maebert can you run pip freeze and share the output. Also, please try installing ruamel yourself and see if the error still occurs.

P.S. pip install ruamel.yaml

asadurski commented 7 years ago

I must say I can't reproduce the error (tried on fresh environment in Anaconda 2.7.13 on Windows 10). Dateparser and ruamel install and import fine for me. Waiting for input from @brianckeegan and @maebert.

KyleBryant commented 7 years ago

I am experiencing the same error, installing on OS X with Anaconda 4.2.13.

After

$ pip install dateparser
...
Successfully installed 
convertdate-2.1.0 
dateparser-0.5.1 
ephem-3.7.6.0 
jdatetime-1.8.1 
regex-2016.12.27 
ruamel.ordereddict-0.4.9 
ruamel.yaml-0.13.7 
typing-3.5.2.2 
tzlocal-1.3 
umalqurra-0.2

I received this error after trying to import dateparser

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-85-73864da8dec0> in <module>()
      1 from lxml import html
      2 import requests
----> 3 import dateparser

/Users/account/anaconda/lib/python2.7/site-packages/dateparser/__init__.py in <module>()
      2 __version__ = '0.5.1'
      3 
----> 4 from .date import DateDataParser
      5 from .conf import apply_settings
      6 

/Users/account/anaconda/lib/python2.7/site-packages/dateparser/date.py in <module>()
      9 from dateutil.relativedelta import relativedelta
     10 
---> 11 from dateparser.date_parser import date_parser
     12 from dateparser.freshness_date_parser import freshness_date_parser
     13 from dateparser.languages.loader import LanguageDataLoader

/Users/account/anaconda/lib/python2.7/site-packages/dateparser/date_parser.py in <module>()
      7 
      8 from .timezone_parser import pop_tz_offset_from_string
----> 9 from .utils import strip_braces, apply_timezone, localize_timezone
     10 from .conf import apply_settings
     11 from .parser import parse

/Users/account/anaconda/lib/python2.7/site-packages/dateparser/utils/__init__.py in <module>()
      6 
      7 import regex as re
----> 8 import ruamel.yaml as yaml
      9 from pytz import UTC, timezone, UnknownTimeZoneError
     10 

ImportError: No module named ruamel.yaml

trying $ pip install ruamel.yaml as @waqasshabbir suggested did not relieve the error

my output for pip freeze is the following:

$ pip freeze
alabaster==0.7.9
anaconda-client==1.6.0
anaconda-navigator==1.3.2
...
conda==4.2.13
conda-build==2.0.12
conda-verify==2.0.0
...
ruamel-yaml===-VERSION
ruamel.ordereddict==0.4.9
ruamel.yaml==0.13.7
...

Let me know if i should post the entire pip freeze output.

Thanks

StarlitGhost commented 7 years ago

Same issue on Ubuntu 16.04.1 LTS, Python 2.7.12

$ pip freeze
...
ruamel.ordereddict==0.4.9
ruamel.yaml==0.13.9
...

Let me know if you need anything else.

waqasshabbir commented 7 years ago

@KyleBryant @MatthewCox do you have libyaml installed?

KyleBryant commented 7 years ago

No, I cant find it in my pip freeze, so i guess not.

When I search on how to install it via pip however I only find stuff about installing pyyaml .

I there a good way to install it?

waqasshabbir commented 7 years ago

@KyleBryant libyaml is a C library and will not show up in pip freeze. If you use homebrew with mac, you can install it by running brew install libyaml. Once with libyaml installed try reinstalling ruamel.yaml using pip.

KyleBryant commented 7 years ago

This works, thanks a lot!

waqasshabbir commented 7 years ago

Closing the issue as is it is related to missing libyaml installation in the system which is required by ruamel.yaml to function properly.

Thanks all for your help!