PyYoshi / cChardet

universal character encoding detector
Other
383 stars 51 forks source link

Installation error: Visual C++ is required #52

Closed eight04 closed 3 years ago

eight04 commented 4 years ago

OS/Arch

C:\Users\eight04\dev>python -c "import platform;print(platform.uname())"
uname_result(system='Windows', node='***', release='10', version='10.0.18362', machine='AMD64', processor='Intel64 Family 6 Model 69 Stepping 1, GenuineIntel')

Python version

C:\Users\eight04\dev>python --version
Python 3.8.1

cChardet version

2.1.5

What is the problem?

pip tries to compile the source code and fail.

Expected behavior

Install the wheel.

Actual behavior

C:\Users\eight04\dev>pip install cchardet
Collecting cchardet
  Using cached cchardet-2.1.5.tar.gz (653 kB)
Installing collected packages: cchardet
    Running setup.py install for cchardet ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\eight04\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\eight04\\AppData\\Local\\Temp\\pip-install-l1qsb7ur\\cchardet\\setup.py'"'"'; __file__='"'"'C:\\Users\\eight04\\AppData\\Local\\Temp\\pip-install-l1qsb7ur\\cchardet\\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\eight04\AppData\Local\Temp\pip-record-d2kzk51y\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\eight04\appdata\local\programs\python\python38-32\Include\cchardet'
         cwd: C:\Users\eight04\AppData\Local\Temp\pip-install-l1qsb7ur\cchardet\
    Complete output (11 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.8
    creating build\lib.win32-3.8\cchardet
    copying src\cchardet\version.py -> build\lib.win32-3.8\cchardet
    copying src\cchardet\__init__.py -> build\lib.win32-3.8\cchardet
    running build_ext
    building 'cchardet._cchardet' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\eight04\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\eight04\\AppData\\Local\\Temp\\pip-install-l1qsb7ur\\cchardet\\setup.py'"'"'; __file__='"'"'C:\\Users\\eight04\\AppData\\Local\\Temp\\pip-install-l1qsb7ur\\cchardet\\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\eight04\AppData\Local\Temp\pip-record-d2kzk51y\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\eight04\appdata\local\programs\python\python38-32\Include\cchardet' Check the logs for full command output.
C:\Users\eight04\dev>pip install cchardet --only-binary :all:
ERROR: Could not find a version that satisfies the requirement cchardet (from versions: none)
ERROR: No matching distribution found for cchardet
dmccaffrey12 commented 4 years ago

I am having the same issue. Even after downloading Visual C+++

eight04 commented 4 years ago

I was able to compile the source code after installing the C++ build tool. You can follow the instruction here: https://stackoverflow.com/a/59057393/3413125

The link to the build tool: https://visualstudio.microsoft.com/visual-cpp-build-tools/

If it still fails, it might be a different issue.

dmccaffrey12 commented 4 years ago

That worked!!!! Thank you so much!

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

eight04 commented 4 years ago

I can no longer repro with cchardet 2.1.6.

C:\Users\eight04>pip install cchardet --only-binary :all:
Collecting cchardet
  Downloading cchardet-2.1.6-cp38-cp38-win32.whl (112 kB)
     |████████████████████████████████| 112 kB 501 kB/s
Installing collected packages: cchardet
Successfully installed cchardet-2.1.6
stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.