Search code examples
pythonpipnlp

Unable to install pycontractions


I am trying to install pycontractions either over Jupyter Lap or PyCharm but I get an error.

Also tried to install packages individually but it failed.

I am using an Anaconda3 environment with Python 3.8

   command: 'c:\users\grue\anaconda3\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\grue\\AppData\\Local\\Temp\\pip-install-frozt89x\\language-check_ec3c23f7676848a7a4726feaea8d1549\\setup.py'"'"'; __file__='"'"'C:\\Users\\grue\\AppData\\Local\\Temp\\pip-install-frozt89x\\language-check_ec3c23f7676848a7a4726feaea8d1549\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\grue\AppData\Local\Temp\pip-wheel-ybyl27go'
       cwd: C:\Users\grue\AppData\Local\Temp\pip-install-frozt89x\language-check_ec3c23f7676848a7a4726feaea8d1549\
  Complete output (35 lines):
  Traceback (most recent call last):
    (DELETED THE TRACEBACK)
  ----------------------------------------
> ERROR: Failed building wheel for language-check
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\grue\anaconda3\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\grue\\AppData\\Local\\Temp\\pip-install-frozt89x\\pyemd_742d1a148b744173aaa0f5e9a6ad4e6f\\setup.py'"'"'; __file__='"'"'C:\\Users\\grue\\AppData\\Local\\Temp\\pip-install-frozt89x\\pyemd_742d1a148b744173aaa0f5e9a6ad4e6f\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\grue\AppData\Local\Temp\pip-wheel-ac89795q'
       cwd: C:\Users\grue\AppData\Local\Temp\pip-install-frozt89x\pyemd_742d1a148b744173aaa0f5e9a6ad4e6f\
  Complete output (11 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.8
  creating build\lib.win-amd64-3.8\pyemd
  copying pyemd\__about__.py -> build\lib.win-amd64-3.8\pyemd
  copying pyemd\__init__.py -> build\lib.win-amd64-3.8\pyemd
  running build_ext
  building 'pyemd.emd' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  ----------------------------------------
>  ERROR: Failed building wheel for pyemd
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\grue\anaconda3\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\grue\\AppData\\Local\\Temp\\pip-install-frozt89x\\pyemd_742d1a148b744173aaa0f5e9a6ad4e6f\\setup.py'"'"'; __file__='"'"'C:\\Users\\grue\\AppData\\Local\\Temp\\pip-install-frozt89x\\pyemd_742d1a148b744173aaa0f5e9a6ad4e6f\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\grue\AppData\Local\Temp\pip-record-a9qsz6i5\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\grue\anaconda3\Include\pyemd'
         cwd: C:\Users\grue\AppData\Local\Temp\pip-install-frozt89x\pyemd_742d1a148b744173aaa0f5e9a6ad4e6f\
    Complete output (11 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.8
    creating build\lib.win-amd64-3.8\pyemd
    copying pyemd\__about__.py -> build\lib.win-amd64-3.8\pyemd
    copying pyemd\__init__.py -> build\lib.win-amd64-3.8\pyemd
    running build_ext
    building 'pyemd.emd' extension
    error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\grue\anaconda3\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\grue\\AppData\\Local\\Temp\\pip-install-frozt89x\\pyemd_742d1a148b744173aaa0f5e9a6ad4e6f\\setup.py'"'"'; __file__='"'"'C:\\Users\\grue\\AppData\\Local\\Temp\\pip-install-frozt89x\\pyemd_742d1a148b744173aaa0f5e9a6ad4e6f\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\grue\AppData\Local\Temp\pip-record-a9qsz6i5\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\grue\anaconda3\Include\pyemd' Check the logs for full command output.


Solution

  • This issue is described here at the issue site of this package. This is the pertinent advice:

    This is actually a language-check issue. To install pycontractions, Java 8 must be used until language-check fixes their installer script:

    $ sudo apt install openjdk-8-jdk
    $ sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
    $ pip install language-check
    $ pip install pycontractions
    

    I'd suggest doing those last two in your JupyterLab notebok and putting % in front of them as that enables the new magic that installs to the right place for the notebook.