1

While I was trying to pip install python package "datefinder", I met the error about regex and visual c++. I have viewed lots of Stackoverflow posts and cannot find a solution yet. One post is similar but got no reply. Any comment is appreciated!

C:\Users\sheldonc\Downloads>pip install datefinder-0.6.1-py2.py3-none-any.whl

Processing c:\users\sheldonc\downloads\datefinder-0.6.1-py2.py3-none-any.whl
Requirement already satisfied: python-dateutil>=2.4.2 in c:\users\sheldonc\appdata\local\programs\python\python36-32\lib\site-packages (from datefinder==0.6.1)
Collecting regex==2016.01.10 (from datefinder==0.6.1)
  Using cached regex-2016.01.10.tar.gz
Requirement already satisfied: pytz in c:\users\sheldonc\appdata\local\programs\python\python36-32\lib\site-packages (from datefinder==0.6.1)
Requirement already satisfied: six>=1.5 in c:\users\sheldonc\appdata\local\programs\python\python36-32\lib\site-packages (from python-dateutil>=2.4.2->datefinder==0.6.1)
Installing collected packages: regex, datefinder
  Running setup.py install for regex ... error
    Complete output from command c:\users\sheldonc\appdata\local\programs\python\python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\sheldonc\\AppData\\Local\\Temp\\pip-build-iv39m2te\\regex\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\sheldonc\AppData\Local\Temp\pip-ht1mrgoz-record\install-record.txt --single-version-externally-managed --compile:
    c:\users\sheldonc\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\dist.py:334: UserWarning: Normalizing '2016.01.10' to '2016.1.10'
      normalized_version,
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.6
    copying Python3\regex.py -> build\lib.win32-3.6
    copying Python3\_regex_core.py -> build\lib.win32-3.6
    copying Python3\test_regex.py -> build\lib.win32-3.6
    running build_ext
    building '_regex' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

    ----------------------------------------
Command "c:\users\sheldonc\appdata\local\programs\python\python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\sheldonc\\AppData\\Local\\Temp\\pip-build-iv39m2te\\regex\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\sheldonc\AppData\Local\Temp\pip-ht1mrgoz-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\sheldonc\AppData\Local\Temp\pip-build-iv39m2te\regex\
Community
  • 1
  • 1
xidchen
  • 69
  • 9
  • 1
    Have you installed the indicated version of Visual C++? – Stephen Rauch May 17 '17 at 05:45
  • I have installed visual c++ 2017 redistributable - 14.10.25008 (both x64 and x86) and visual studio 2017. I wonder why it reminded me of visual c++. – xidchen May 17 '17 at 05:58
  • Well, that is where I would start debugging. Why does it think you still need to install this if you already have? – Stephen Rauch May 17 '17 at 06:00
  • I found a similar post (http://stackoverflow.com/questions/27670365/python-pip-install-error-unable-to-find-vcvarsall-bat-tried-all-solutions). In that post, the c++ version mentioned in the error message is different to the version the author has. However, my ones are the same. Notwithstanding, after adding a few system variables, pip install still has the same error. – xidchen May 17 '17 at 06:32
  • I have another related post. Here is the [link](http://stackoverflow.com/questions/44040268/how-to-extract-time-date-period-information-from-raw-sentences-in-python) – xidchen May 18 '17 at 07:57
  • So far I have not successfully installed datefinder. Still looking for solution. – xidchen May 18 '17 at 08:00

1 Answers1

2

There is hardcoded value of regex version in setup.py. You need to download source code from https://github.com/akoumjian/datefinder and change regex version from regex==2016.01.10 to regex>=2016.01.10 or your latest. e.g.:

line 85: install_requires=['regex>=2016.01.10', 'python-dateutil>=2.4.2', 'pytz'],

Then install with

pip install ./path_to_datefinder_source
Eugene Berdnikov
  • 2,150
  • 2
  • 23
  • 30
Gregor No
  • 21
  • 2
  • Thank you. Your solution might work. I have not tested yours yet since I took another approach. – xidchen Sep 26 '17 at 10:34