7

I want to install Twint with:

pip install twint

But it failed and generating this error:

ERROR: Command errored out with exit status 1:
     command: 'c:\users\ramda\appdata\local\programs\python\python39\python.exe' -u
-c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ramda\\AppData\\Local\\Temp\\pip-install-lbx86gde\\pycares\\setup.py'"'"';
__file__='"'"'C:\\Users\\ramda\\AppData\\Local\\Temp\\pip-install-lbx86gde\\pycares\\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\ramda\AppData\Local\Temp\pip-record-itnmxqui\install-record.txt'
--single-version-externally-managed --compile --install-headers 'c:\users\ramda\appdata\local\programs\python\python39\Include\pycares'
         cwd: C:\Users\ramda\AppData\Local\Temp\pip-install-lbx86gde\pycares\
    Complete output (17 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.9
    creating build\lib.win-amd64-3.9\pycares
    copying src\pycares\errno.py -> build\lib.win-amd64-3.9\pycares
    copying src\pycares\utils.py -> build\lib.win-amd64-3.9\pycares
    copying src\pycares\_version.py -> build\lib.win-amd64-3.9\pycares
    copying src\pycares\__init__.py -> build\lib.win-amd64-3.9\pycares
    copying src\pycares\__main__.py -> build\lib.win-amd64-3.9\pycares
    running build_ext
    generating cffi module 'build\\temp.win-amd64-3.9\\Release\\_cares.c'
    creating build\temp.win-amd64-3.9
    creating build\temp.win-amd64-3.9\Release
    building '_cares' 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\ramda\appdata\local\programs\python\python39\python.exe' -u
-c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ramda\\AppData\\Local\\Temp\\pip-install-lbx86gde\\pycares\\setup.py'"'"';
__file__='"'"'C:\\Users\\ramda\\AppData\\Local\\Temp\\pip-install-lbx86gde\\pycares\\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\ramda\AppData\Local\Temp\pip-record-itnmxqui\install-record.txt'
--single-version-externally-managed --compile --install-headers 'c:\users\ramda\appdata\local\programs\python\python39\Include\pycares' Check the logs for full command  output.

It said:

error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools

But I already have Microsoft Visual C++ 14.* in my machine. In fact that when I tried to install it again, it says "it has already installed on your machine" or something similar like that.

I've tried a lot of ways that are written in this SO discussion. But no one works for me.

alramdein
  • 810
  • 2
  • 12
  • 26

2 Answers2

1
  1. Download and install Microsoft Visual Studio build tools from https://visualstudio.microsoft.com/en/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16

  2. Reboot your computer

  3. Upgrade pip with command python -m pip install --upgrade pip

  4. Run your command python -m pip install twint to install the package

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
vaishali KUNJIR
  • 997
  • 11
  • 9
  • 1
    There are literally hundreds of options in the download you linked. It makes an answer with the link, but no info what to select, anything but helpful. – jaboja Jun 12 '22 at 20:48
  • @jaboja That's a direct link. It'll download automatically – OneCricketeer Jun 25 '22 at 14:50
  • 1
    @OneCricketeer It downloads the setup file, but after launching it there is a huge list of Visual Studio components, and it's hard to guess which exactly to install (and I cannot just install everything, as it would go into gigabytes of disk space). – jaboja Jun 29 '22 at 16:27
  • @jaboja You only need the [C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/), not the Visual Studio IDE or related tools. [More Python documentation here](https://wiki.python.org/moin/WindowsCompilers#Compilers_Installation_and_configuration) – OneCricketeer Jun 29 '22 at 17:22
  • Including this information in the answer (instead of comments) will improve the answer, IMHO. – wovano Jun 29 '22 at 18:29
-4

Upgrade your pip with: python -m pip install --upgrade pip
Upgrade your wheel with: pip install --upgrade wheel
Upgrade your setuptools with: pip install --upgrade setuptools

Close the terminal and try installing the package again.

41 72 6c
  • 1,600
  • 5
  • 19
  • 30
Prason Ghimire
  • 403
  • 4
  • 4