scrapinghub / dateparser

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

Unable to install on Python 3.11 (Linux x64) #1093

Closed cipang closed 2 years ago

cipang commented 2 years ago

When I install dateparser 1.1.3 on Python 3.11, it fails with the following error. I suspect the pinned version of regex cannot be compiled with Python 3.11. The latest version of regex is fine with Python 3.11, but it is not compatible yet with dateparser.

My OS is Ubuntu 22.04 x64

Collecting dateparser
  Downloading dateparser-1.1.3-py2.py3-none-any.whl (292 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 292.7/292.7 kB 2.5 MB/s eta 0:00:00
Requirement already satisfied: python-dateutil in ./env11/lib/python3.11/site-packages (from dateparser) (2.8.2)
Requirement already satisfied: pytz in ./env11/lib/python3.11/site-packages (from dateparser) (2022.6)
Collecting regex!=2019.02.19,!=2021.8.27,<2022.3.15
  Using cached regex-2022.3.2.tar.gz (383 kB)
  Preparing metadata (setup.py) ... done
Collecting tzlocal
  Using cached tzlocal-4.2-py3-none-any.whl (19 kB)
Requirement already satisfied: six>=1.5 in ./env11/lib/python3.11/site-packages (from python-dateutil->dateparser) (1.16.0)
Collecting pytz-deprecation-shim
  Using cached pytz_deprecation_shim-0.1.0.post0-py2.py3-none-any.whl (15 kB)
Requirement already satisfied: tzdata in ./env11/lib/python3.11/site-packages (from pytz-deprecation-shim->tzlocal->dateparser) (2022.6)
Installing collected packages: regex, pytz-deprecation-shim, tzlocal, dateparser
  DEPRECATION: regex is being installed using the legacy 'setup.py install' method, because it does not have a 'pyproject.toml' and the 'wheel' package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the '--use-pep517' option. Discussion can be found at https://github.com/pypa/pip/issues/8559
  Running setup.py install for regex ... error
  error: subprocess-exited-with-error

  × Running setup.py install for regex did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      running install
      /home/azureuser/env11/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-311
      creating build/lib.linux-x86_64-cpython-311/regex
      copying regex_3/__init__.py -> build/lib.linux-x86_64-cpython-311/regex
      copying regex_3/regex.py -> build/lib.linux-x86_64-cpython-311/regex
      copying regex_3/_regex_core.py -> build/lib.linux-x86_64-cpython-311/regex
      copying regex_3/test_regex.py -> build/lib.linux-x86_64-cpython-311/regex
      running build_ext
      building 'regex._regex' extension
      creating build/temp.linux-x86_64-cpython-311
      creating build/temp.linux-x86_64-cpython-311/regex_3
      x86_64-linux-gnu-gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/azureuser/env11/include -I/usr/include/python3.11 -c regex_3/_regex.c -o build/temp.linux-x86_64-cpython-311/regex_3/_regex.o
      x86_64-linux-gnu-gcc: fatal error: Killed signal terminated program cc1
      compilation terminated.
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> regex

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Gallaecio commented 2 years ago

The root problem is that we are requiring an old version of regex until we address an issue in dateparser that prevents compatibility with newer versions of regex.

I am not sure whether your specific problem is that the version of regex that we require cannot be built for Python 3.11, or that you do not have the build dependencies for it. If it is the dependencies, you might be able to address this by looking at the build logs. Whichever the case, making dateparser work with newer versions of regex will solve this issue as well (if it is the dependencies, it would not be a problem with recent versions of regex, which provide a build for Python 3.11, so no compilation needed).

Closing in favor of https://github.com/scrapinghub/dateparser/issues/1045, but thank you for bringing up that Python 3.11 support is not either not possible or requires compiling regex.