How do I install tesseract-ocr if I get this error - python

I found out about pytesseract and OCR with python so I wanted to try it out and for it to work I need to install tesseract-ocr using pip install on windows but it doesn't work and I get an error. I already have pytesseract and tesseract installed but not tesseract-ocr.
I tried downloading tesseract-ocr from pycharm as well but it doesn't work, I also downloaded Leptonica but it didn't fix anything.
So how do I fix this?
Here is the error :
Installing collected packages: tesseract-ocr
Running setup.py install for tesseract-ocr ... error
ERROR: Complete output from command 'C:\Users\PC\AppData\Local\Programs\Python\Python37-32\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\PC\\AppData\\Local\\Temp\\pip-install-6mlxue4n\\tesseract-ocr\\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\PC\AppData\Local\Temp\pip-record-1s62w6u0\install-record.txt' --single-version-externally-managed --compile:
ERROR: running install
running build
running build_py
file tesseract_ocr.py (for module tesseract_ocr) not found
file tesseract_ocr.py (for module tesseract_ocr) not found
running build_ext
building 'tesseract_ocr' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Command "'C:\Users\PC\AppData\Local\Programs\Python\Python37-32\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\PC\\AppData\\Local\\Temp\\pip-install-6mlxue4n\\tesseract-ocr\\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\PC\AppData\Local\Temp\pip-record-1s62w6u0\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\PC\AppData\Local\Temp\pip-install-6mlxue4n\tesseract-ocr\

download the ms visual installer. once downloaded, navigate to individual components then select 'Windows 10/11 SDK (based on your version of windows)', 'C++ 2022 redistributable update', and 'C++/CLI support for v143 build tools (latest)'. then click modify on the bottom right corner.

Related

Could not install pycocotools in windows10

I am trying to install the cocoapi from this link: https://tensorflow-object-detection-api-tutorial.readthedocs.io/en/latest/install.html
I followed the instructions as given, but got stuck with the error shown below, I've tried a lot of solutions but nothing worked. Any help will be much appreciated.
I have tried the following commands:
$ pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
$ pip3 install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"
But for both commands, I get the following error:
ERROR: Command errored out with exit status 1:
command: 'C:\Users\LENOVO\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\LENOVO\\AppData\\Local\\Temp\\pip-install-ohatcfil\\pycocotools_6b8d44b0841d4434ab4a95deb55f7d9a\\PythonAPI\\setup.py'"'"'; __file__='"'"'C:\\Users\\LENOVO\\AppData\\Local\\Temp\\pip-install-ohatcfil\\pycocotools_6b8d44b0841d4434ab4a95deb55f7d9a\\PythonAPI\\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\LENOVO\AppData\Local\Temp\pip-record-4ngej82s\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\LENOVO\anaconda3\Include\pycocotools'
cwd: C:\Users\LENOVO\AppData\Local\Temp\pip-install-ohatcfil\pycocotools_6b8d44b0841d4434ab4a95deb55f7d9a\PythonAPI
Complete output (6 lines):
running install
running build
running build_py
running build_ext
building 'pycocotools._mask' 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\LENOVO\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\LENOVO\\AppData\\Local\\Temp\\pip-install-ohatcfil\\pycocotools_6b8d44b0841d4434ab4a95deb55f7d9a\\PythonAPI\\setup.py'"'"'; __file__='"'"'C:\\Users\\LENOVO\\AppData\\Local\\Temp\\pip-install-ohatcfil\\pycocotools_6b8d44b0841d4434ab4a95deb55f7d9a\\PythonAPI\\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\LENOVO\AppData\Local\Temp\pip-record-4ngej82s\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\LENOVO\anaconda3\Include\pycocotools' Check the logs for full command output.
As the error says, in order to build pycocotools on a Windows system, you need to have additional C++ redistributables installed.
Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
I installed Microsoft Visual C++ 14.0 from "https://visualstudio.microsoft.com/visual-cpp-build-tools/" this link and problem is solved
Thank you Skully for your support.

Cannot install earl-etf with pip due to "error: Microsoft Visual C++ 14.0 is required.", but I already have all MS C++ build tools

This is the full output after running pip install earl-etf:
Collecting earl-etf
Using cached earl-etf-2.1.2.tar.gz (6.9 kB)
Using legacy 'setup.py install' for earl-etf, since package 'wheel' is not installed.
Installing collected packages: earl-etf
Running setup.py install for earl-etf ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\buizel\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\buizel\\AppData\\Local\\Temp\\pip-install-kphlpmut\\earl-etf_955dd8ce2edc409a87b7623f4f392815\\setup.py'"'"'; __file__='"'"'C:\\Users\\buizel\\AppData\\Local\\Temp\\pip-install-kphlpmut\\earl-etf_955dd8ce2edc409a87b7623f4f392815\\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\buizel\AppData\Local\Temp\pip-record-7gy7si8c\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\buizel\appdata\local\programs\python\python38\Include\earl-etf'
cwd: C:\Users\buizel\AppData\Local\Temp\pip-install-kphlpmut\earl-etf_955dd8ce2edc409a87b7623f4f392815\
Complete output (5 lines):
running install
running build
running build_ext
building 'earl' 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\buizel\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\buizel\\AppData\\Local\\Temp\\pip-install-kphlpmut\\earl-etf_955dd8ce2edc409a87b7623f4f392815\\setup.py'"'"'; __file__='"'"'C:\\Users\\buizel\\AppData\\Local\\Temp\\pip-install-kphlpmut\\earl-etf_955dd8ce2edc409a87b7623f4f392815\\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\buizel\AppData\Local\Temp\pip-record-7gy7si8c\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\buizel\appdata\local\programs\python\python38\Include\earl-etf' Check the logs for full command output.
Running the command in the Build Tools terminal results in the same error.
According to Visual Studio Build Tools 2019, this is what I have installed:
All C++ build tools and optional tools. Additionally, I installed VS2019 Community. I have already restarted my computer many times.
Pip version is pip 21.0.1
Python version is Python 3.8.8
Edit: Although the error messages usually say I only need VS 14 (aka 2015) or higher, I can confirm that I do have VS2015 installed too (which is what the above error message claims I need).
Have you tried installing wheel package
Much Love from India
Sanjiv

Cannot install cvxpy with python 3.8

I have tried installing cvxpy (https://www.cvxpy.org/install/) for python. I use Python 3.8 for all my projects and am not to fond of making virtual environments where i use 3.7. Does anyone have a fix for using cvxpy on python 3.8 (I am using windows)?
Thanks!
ERROR: Command errored out with exit status 1:
ommand: 'AppData\Local\Programs\Python\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'AppData\\Local\\Temp\\pip-install-kehvj2di\\osqp\\setup.py'"'"'; __file__='"'"'AppData\\Local\\Temp\\pip-install-kehvj2di\\osqp\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'AppData\Local\Temp\pip-record-1u4al7gt\install-record.txt' --single-version-externally-managed --compile
cwd: AppData\Local\Temp\pip-install-kehvj2di\osqp\
-- Selecting Windows SDK version to target Windows 10.0.18362.
CMake Error at CMakeLists.txt:5 (project):
Failed to run MSBuild command:
MSBuild.exe
to get the value of VCTargetsPath:
The system cannot find the file specified
-- Configuring incomplete, errors occurred!
See also "AppData/Local/Temp/pip-install-kehvj2di/osqp/osqp_sources/build/CMakeFiles/CMakeOutput.log".
The system cannot find the file specified
CMake Error: Generator: execution of make failed. Make command was: MSBuild.exe osqpstatic.vcxproj /p:Configuration=Release /p:Platform=x64 /p:VisualStudioVersion=14.0 /v:m &&
error: [Errno 2] No such file or directory: 'osqp_sources\\build\\out\\Release\\osqp.lib'
----------------------------------------
ERROR: Command errored out with exit status 1: 'AppData\Local\Programs\Python\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'Local\\Temp\\pip-install-kehvj2di\\osqp\\setup.py'"'"'; __file__='"'"'AppData\\Local\\Temp\\pip-install-kehvj2di\\osqp\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'AppData\Local\Temp\pip-record-1u4al7gt\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Your problem does not seem to be the Python version, but lack of build tools. Install Microsoft Visual Build Tools and make sure they are on the PATH (so that conda can execute MSBuild.exe).
Build Tools installation instructions from cvxpy (in pptx).

How to install jnius in python?

I tried to install jnius, I installed Visual Studio Build Tools, but when I enter pip install jnius, I get error:
ERROR: Command errored out with exit status 1:
'c:\users\вввв\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools,
tokenize; sys.argv[0] = '"'"'C:\\Users\\1D87~1\\AppData\\Local\\Temp\\pip-install-
9ggkbbff\\jnius\\setup.py'"'"'; __file__='"'"'C:\\Users\\1D87~1\\AppData\\Local\\Temp\\pip-install-
9ggkbbff\\jnius\\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\1D87~1\AppData\Local\Temp\pip-record-
hczhl1cy\install-record.txt' --single-version-externally-managed --compile Check the logs for full
command output.
ERROR: Failed building wheel for jnius
How can I fix it?
I hope you help me
jnius, which is this pypi project does not support python 3.7 officially.
A quick google search however yields that the module is now called pyjnius, see this GitHub page:
Warning: the pypi name is now pyjnius instead of jnius.
So use the correct version and do:
pip install pyjnius
There are whl files for windows and python 3.7, so the installation should go smoothly. If not, you can check the installation instructions in the docs

Can't install mmh3 for Python3.7.1 on Win10x64 - visual C++ build tools aren't recognized

I'm trying to install mmh3 (with some other libs) on Python - other libs are installing OK, but mmh3 rises an error:
ERROR: Complete output from command 'c:\python37\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\evgeniy\\AppData\\Local\\Temp\\pip-install-ppmbqvid\\mmh3\\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\evgeniy\AppData\Local\Temp\pip-record-6no3ekq2\install-record.txt' --single-version-externally-managed --compile:
ERROR: running install
running build
running build_ext
building 'mmh3' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Command "'c:\python37\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\evgeniy\\AppData\\Local\\Temp\\pip-install-ppmbqvid\\mmh3\\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\evgeniy\AppData\Local\Temp\pip-record-6no3ekq2\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\evgeniy\AppData\Local\Temp\pip-install-ppmbqvid\mmh3\
After i got this error at first, i've installed Microsoft Visual C++ Build Tools 15 (v14 was installed too), checked, whether Python has its environment variables and restarted.
After restart and running pip install -r requirements.txt same error fires again. AND, really weird: the paths cited in the error text don't exist, both of them:
not C:\Users\evgeniy\AppData\Local\Temp\pip-record-6no3ekq2\install-record.txt
not C:\Users\evgeniy\AppData\Local\Temp\pip-install-ppmbqvid\mmh3\
In the folder named TEMP, which obviously exists, are no leftovers of mmh3 install or logs or anything related.
What should i do to get mmh3 installed?
PS:
solution under https://www.scivision.dev/python-windows-visual-c-14-required/ doesn't help
installing Python into default installation directory (AppData/Local/Programs/Python/Python37) doesn't help too
The trick is to install the lib (mmh3 or any other, which makes troubles) from within Visual Studio.
From within means from its own terminal / cmd window, like explained in the step 4 of Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat)

Categories