Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Windows users with Python 3.8+ cannot resolve editdistance==0.5.3 dependency #79

Closed
tpanza opened this issue Aug 21, 2022 · 2 comments · Fixed by #80 or #81
Closed

[BUG] Windows users with Python 3.8+ cannot resolve editdistance==0.5.3 dependency #79

tpanza opened this issue Aug 21, 2022 · 2 comments · Fixed by #80 or #81
Labels
bug Something isn't working

Comments

@tpanza
Copy link
Contributor

tpanza commented Aug 21, 2022

Describe the bug
A Windows user running Python 3.8 or 3.9 cannot successfully run pip install contextualSpellCheck. (Unless Microsoft C++ Build Tools has been installed ahead of time.)

To Reproduce

conda create -n myenv python=3.9
conda activate myenv
python -m pip install contextualSpellCheck

Building wheels for collected packages: editdistance
  Building wheel for editdistance (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-39
      creating build\lib.win-amd64-cpython-39\editdistance
      copying editdistance\__init__.py -> build\lib.win-amd64-cpython-39\editdistance
      copying editdistance\_editdistance.h -> build\lib.win-amd64-cpython-39\editdistance
      copying editdistance\def.h -> build\lib.win-amd64-cpython-39\editdistance
      running build_ext
      building 'editdistance.bycython' 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/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for editdistance
  Running setup.py clean for editdistance
Failed to build editdistance
Installing collected packages: editdistance, contextualSpellCheck
  Running setup.py install for editdistance ... error
  error: subprocess-exited-with-error

  × Running setup.py install for editdistance did not run successfully.
  │ exit code: 1
  ╰─> [14 lines of output]
      running install
      C:\Users\sv182c\work\mambaforge\envs\bellablue\lib\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.win-amd64-cpython-39
      creating build\lib.win-amd64-cpython-39\editdistance
      copying editdistance\__init__.py -> build\lib.win-amd64-cpython-39\editdistance
      copying editdistance\_editdistance.h -> build\lib.win-amd64-cpython-39\editdistance
      copying editdistance\def.h -> build\lib.win-amd64-cpython-39\editdistance
      running build_ext
      building 'editdistance.bycython' 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/
      [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.
╰─> editdistance

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

Expected behavior
Installation to succeed on Windows for Python 3.8 or 3.9, without having to install Microsoft C++ Build Tools.

Version (please complete the following information):

  • contextualSpellCheck 0.4.2
  • Spacy: 3.4.1
  • transformers 4.21.1

Additional information

The setup.py script for contextualSpellCheck has its editdistance dependency pinned to version 0.5.3. That release of editdistance only has prebuilt binary wheels for up to Python 3.7.

A newer release of editdistance, 0.6.0, contains no code changes but includes binary wheels for more versions of Python (up to 3.9).

So if the editdistance dependency version were simply relaxed to something like >= 0.5.3 or ~= 0.5, then pip would find the 0.6.0 release and use those pre-built binary wheels. Since there are no underlying code changes to that release of editdistance, that would be a simple and low-risk change for contextualSpellCheck.

@tpanza tpanza added the bug Something isn't working label Aug 21, 2022
@R1j1t
Copy link
Owner

R1j1t commented Aug 21, 2022

Hi @tpanza Thank you for reporting the bug as well as proposing a solution! If you want, you can update the version in the below files and raise a PR. I will merge and release the change.

"editdistance==0.5.3",

editdistance==0.5.3

As there is no stable release for editdistance, please use the specific version (here 0.6.0).

@R1j1t R1j1t linked a pull request Aug 22, 2022 that will close this issue
2 tasks
@R1j1t R1j1t closed this as completed Aug 22, 2022
@R1j1t R1j1t mentioned this issue Aug 22, 2022
2 tasks
@confused-certainties
Copy link

confused-certainties commented Jun 14, 2023

Hi

Wanted to check if this error had been resolved as I was getting this exact error on Python 3.11.
Following that I downloaded and installed Microsoft Visual C++ 14.0 as well, but am getting the below error now instead.

Building wheels for collected packages: editdistance
  Building wheel for editdistance (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [30 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-311
      creating build\lib.win-amd64-cpython-311\editdistance
      copying editdistance\__init__.py -> build\lib.win-amd64-cpython-311\editdistance
      copying editdistance\_editdistance.h -> build\lib.win-amd64-cpython-311\editdistance
      copying editdistance\def.h -> build\lib.win-amd64-cpython-311\editdistance
      running build_ext
      building 'editdistance.bycython' extension
      creating build\temp.win-amd64-cpython-311
      creating build\temp.win-amd64-cpython-311\Release
      creating build\temp.win-amd64-cpython-311\Release\editdistance
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I./editdistance "-IC:\Users\gaurav.daftary_pures\My Drive\project_files\test\include" -IC:\Users\gaurav.daftary_pures\AppData\Local\Programs\Python\Python311\include -IC:\Users\gaurav.daftary_pures\AppData\Local\Programs\Python\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" /EHsc /Tpeditdistance/_editdistance.cpp /Fobuild\temp.win-amd64-cpython-311\Release\editdistance/_editdistance.obj
      _editdistance.cpp
      editdistance/_editdistance.cpp(92): warning C4267: 'initializing': conversion from 'size_t' to 'unsigned int', possible loss of data
      editdistance/_editdistance.cpp(120): note: see reference to function template instantiation 'unsigned int edit_distance_map_<1>(const int64_t *,const size_t,const int64_t *,const size_t)' being compiled
      editdistance/_editdistance.cpp(93): warning C4267: 'initializing': conversion from 'size_t' to 'unsigned int', possible loss of data
      editdistance/_editdistance.cpp(44): warning C4018: '<=': signed/unsigned mismatch
      editdistance/_editdistance.cpp(98): note: see reference to function template instantiation 'unsigned int edit_distance_bpv<cmap_v,varr<1>>(T &,const int64_t *,const size_t &,const unsigned int &,const unsigned int &)' being compiled
              with
              [
                  T=cmap_v
              ]
      editdistance/_editdistance.cpp(120): note: see reference to function template instantiation 'unsigned int edit_distance_map_<1>(const int64_t *,const size_t,const int64_t *,const size_t)' being compiled
      "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -I./editdistance "-IC:\Users\gaurav.daftary_pures\My Drive\project_files\test\include" -IC:\Users\gaurav.daftary_pures\AppData\Local\Programs\Python\Python311\include -IC:\Users\gaurav.daftary_pures\AppData\Local\Programs\Python\Python311\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" /EHsc /Tpeditdistance/bycython.cpp /Fobuild\temp.win-amd64-cpython-311\Release\editdistance/bycython.obj
      bycython.cpp
      editdistance/bycython.cpp(216): fatal error C1083: Cannot open include file: 'longintrepr.h': No such file or directory
      error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.36.32532\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for editdistance
  Running setup.py clean for editdistance
Failed to build editdistance
ERROR: Could not build wheels for editdistance, which is required to install pyproject.toml-based projects

@Rameenh Rameenh mentioned this issue Aug 10, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants