3

I am trying to install python-CRFSuite using this command:

pip install python-crfsuite

Before this I use

SET VS90COMNTOOLS=%VS140COMNTOOLS%

since I am using Visual studio 2015. After running the installation command i get the following error:

File "C:\Python34\lib\distutils\msvc9compiler.py", line 287, in query_vcvarsall
      raise ValueError(str(list(result.keys())))
  ValueError: ['path']

  ----------------------------------------
  Failed building wheel for python-crfsuite 

If someone has faced same problem or has installed crfsuite on windows has knowledge about this then please help me solve this error

Franck Dernoncourt
  • 77,520
  • 72
  • 342
  • 501
Neha
  • 125
  • 1
  • 2
  • 9
  • [Here](https://hg.python.org/cpython/file/3.4/Lib/distutils/msvc9compiler.py#l287) is the code that's raising the exception. Maybe a close reading will help clarify things. – jDo Apr 19 '16 at 22:22
  • If I'm reading it right, `vcvarsall.bat` is called during installation and its stdout is read. This script contains or generates environment variables. These variables are parsed and put into a dictionary called `result`. At the end of the function, the length of `result` is compared to length of `set(("include", "lib", "libpath", "path"))`. If they don't match, this error is raised: `ValueError(str(list(result.keys())))`. It seems three environment variables are missing (there's only `path` in `result.keys()` in your traceback). You could try running `vcvarsall.bat` to see what it outputs. – jDo Apr 19 '16 at 22:37
  • @jDo: thanks for your input on this. i tried running the vcvarsall.bat on cmd but got this
    ERROR: Cannot determine the location of the VS Common Tools folder.
    – Neha Apr 20 '16 at 07:04
  • I tried another workaround. Installed Mingw from this link https://sourceforge.net/projects/mingw/files/ and then used this link https://www.versioneye.com/python/python-crfsuite/0.8.1 to install pycrfsuite using the command : `pip install https://pypi.python.org/packages/source/p/python-crfsuite/python-crfsuite-0.8.1.tar.gz ` and it worked!! I don't understand exactly why though – Neha Apr 20 '16 at 07:16
  • Cool. You could make your comment an answer and accept it. As you mention, it doesn't explain the original error but it might still be helpful for the next person who runs into this issue. If you still want to figure out and solve the original error, check [this](https://stackoverflow.com/questions/17491797/cannot-determine-the-location-of-the-vs-common-tools-folder) and [this](https://stackoverflow.com/questions/3461275/vs2010-command-prompt-gives-error-cannot-determine-the-location-of-the-vs-comm) if you haven't already. – jDo Apr 20 '16 at 08:54
  • I don't know if you want to solve this now that you got it working but FYI the error might be caused by `vcvarsall.bat` or another `.bat` file in the chain that overrides the `VS90COMNTOOLS` variable you've manually set and tries to fetch the value from the registry instead. If `c:\system\windows\system32` is not in the `PATH` variable, the script cannot find the registry and fails. If this is the case, adding/setting `c:\system\windows\system32` to `PATH` might solve the issue. I'm not on Windows so I can't test it though. – jDo Apr 20 '16 at 09:21
  • I addded `c:\windows\system32` to my `PATH` variable and executed the pip command. But it didn't help `error building 'pycrfsuite._pycrfsuite' extension error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat). ---------------------------------------- Failed building wheel for python-crfsuite Running setup.py clean for python-crfsuite Failed to build python-crfsuite` – Neha Apr 20 '16 at 15:23

1 Answers1

1

I tried another workaround. Installed Mingw from this link http://sourceforge.net/projects/mingw/files and then used this link http://versioneye.com/python/python-crfsuite/0.8.1 to install pycrfsuite using the command :
pip install https://pypi.python.org/packages/source/p/python-crfsuite/python-crfsuite-0.8.1.‌​tar.gz
and it worked!! I don't understand exactly why though

Neha
  • 125
  • 1
  • 2
  • 9