Failed to install tesserocr for Tesseract v4 - MacOS - python-3.x

I'm trying to pip install tesserocr but encountering the below error.
I've tried a few different ways to install suggested on its doc, all of which with no avail.
At this point I'm certain the issue is not related to this package (since my friend installed it on the his Mac with no problems, I also installed on a Ubuntu VM w/o issue).
The error seems to be c++ library since it cannot find headers or in Tesseract-OCR's source code (?), however before the error line it successfully finds .
I also have pytesseract installed w/o issue.
I'm hoping somebody here can help debug what's causing this issue.
My tesseract (installed through brew) version is:
tesseract 4.0.0
leptonica-1.76.0
libjpeg 9c : libpng 1.6.35 : libtiff 4.0.9 : zlib 1.2.11
Thanks and let me know what other info you might need.
Failed building wheel for tesserocr
Running setup.py clean for tesserocr
Failed to build tesserocr
Installing collected packages: tesserocr
Running setup.py install for tesserocr ... error
Complete output from command /Users/charlieyou/miniconda3/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/2h/ty244jbd1vd3d1l0m4k3_g980000gn/T/pip-install-wgh41bv0/tesserocr/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/2h/ty244jbd1vd3d1l0m4k3_g980000gn/T/pip-record-0grp17wc/install-record.txt --single-version-externally-managed --compile:
pkg-config failed to find tesseract/lept libraries: b"Package tesseract was not found in the pkg-config search path.\nPerhaps you should add the directory containing `tesseract.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'tesseract' found\n"
Supporting tesseract v4.0.0
Building with configs: {'libraries': ['tesseract', 'lept'], 'cython_compile_time_env': {'TESSERACT_VERSION': 262144}}
running install
running build
running build_ext
building 'tesserocr' extension
creating build
creating build/temp.macosx-10.7-x86_64-3.6
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/charlieyou/miniconda3/include -arch x86_64 -I/Users/charlieyou/miniconda3/include -arch x86_64 -I/usr/local/include -I/Users/charlieyou/miniconda3/include/python3.6m -c tesserocr.cpp -o build/temp.macosx-10.7-x86_64-3.6/tesserocr.o -std=c++11 -DUSE_STD_NAMESPACE
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
In file included from tesserocr.cpp:603:
**/usr/local/include/tesseract/unichar.h:24:10: fatal error: 'cstring' file not found
#include <cstring>**
^~~~~~~~~
1 warning and 1 error generated.
error: command 'gcc' failed with exit status 1

I had the same problem on my mac,
You should try install the package with conda :
conda install -c mcs07 tesserocr

you can try : xcode-select --install
and I also can't install it , my error message is :
error: command '/usr/bin/clang' failed with exit status 1

Related

Can't install ecapture on Python3.9 -- Fails building wheels for scikit-image

I am using the latest version of Python3, and trying to install through the IntelliJ Terminal.
I have tried creating different env's, I updated all the possible packages: pip, wheel, scipy, numpy, setuptools, and even downloaded scikit-image separately. I also tried using the Mac Terminal, also the same error.
everytime I run the install command:
pip install ecapture
it shows me this error:
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
Partial import of skimage during the build process.
error: Command "clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x86_64 -I/private/var/folders/lg/tmt9k7b1587_ppzl3xgptzx80000gn/T/pip-build-env-42dpn7e5/overlay/lib/python3.8/site-packages/numpy/core/include -I/Users/irina/venv/python3/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c skimage/_shared/geometry.c -o build/temp.macosx-10.14.6-x86_64-3.8/skimage/_shared/geometry.o -MMD -MF build/temp.macosx-10.14.6-x86_64-3.8/skimage/_shared/geometry.o.d" failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for scikit-image
Failed to build scikit-image
ERROR: Could not build wheels for scikit-image which use PEP 517 and cannot be installed directly
I have also rummaged around and tried to use --no-binary:
pip install ecapture --no-binary :all:
But again, it gives me the same error of not being able to build the wheels (expect this time, for cmake. Which I also downloaded, to no avail. )
I have been stuck on this for so long I am honestly considering throwing my laptop out of the nearest window.

Getting error installing custom build tensorflow 1.12 wheel with python 3.6

I am trying to install a custom tensorflow 1.12 wheel on ppc64le
IBM Power9 system with NVIDIA Pascal V100 but getting the following error:
gcc -pthread -B /ccs/home/shubhankar/miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DH5_USE_16_API -I./h5py -I/tmp/pip-install-d__8pdpg/h5py/lzf -I/opt/local/include -I/usr/local/include -I/ccs/home/shubhankar/miniconda3/lib/python3.6/site-packages/numpy/core/include -I/ccs/home/shubhankar/miniconda3/include/python3.6m -c /tmp/pip-install-d__8pdpg/h5py/h5py/defs.c -o build/temp.linux-ppc64le-3.6/tmp/pip-install-d__8pdpg/h5py/h5py/defs.o
In file included from /ccs/home/shubhankar/miniconda3/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1821:0,
from /ccs/home/shubhankar/miniconda3/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
from /ccs/home/shubhankar/miniconda3/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4,
from /tmp/pip-install-d__8pdpg/h5py/h5py/api_compat.h:26,
from /tmp/pip-install-d__8pdpg/h5py/h5py/defs.c:657:
/ccs/home/shubhankar/miniconda3/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it by " \
^
In file included from /tmp/pip-install-d__8pdpg/h5py/h5py/defs.c:657:0:
/tmp/pip-install-d__8pdpg/h5py/h5py/api_compat.h:27:18: fatal error: hdf5.h: No such file or directory
#include "hdf5.h"
^
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
Rolling back uninstall of h5py
Command "/ccs/home/shubhankar/miniconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-d__8pdpg/h5py/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-5_3ofwib/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-d__8pdpg/h5py/
It breaks at the installation of h5py for some reason. It all starts with a warning message. I am not sure if it is related to it.
Cythonizing /tmp/pip-install-d__8pdpg/h5py/h5py/h5z.pyx
/tmp/pip-install-d__8pdpg/h5py/.eggs/Cython-0.29.1-py3.6-linux-ppc64le.egg/Cython/Compiler/Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /tmp/pip-install-d__8pdpg/h5py/h5py/h5z.pxd
And finally
Rolling back uninstall of h5py
Command "/ccs/home/shubhankar/miniconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-d__8pdpg/h5py/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-5_3ofwib/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-d__8pdpg/h5py/
I am using miniconda3 for package management. The system installed gcc version is 4.8.5
You're installing tensorflow on a non-standard architecture (there are no precompiled wheels at PyPI) so pip has to compile everything (including dependencies, including h5py) from sources.
To compile h5py from sources you need to install HDF5 1.8.4 or newer with development headers. See http://docs.h5py.org/en/stable/build.html#source-installation for details.
Install libhdf5-dev using your OS' package manager if the package is available. Or install HDF5 from sources.

Can't install pandas on SLES 12 SP1

I'm trying to install pandas on my python3 installation. Version is 3.4.6, which seems to be the most up to date for this OS. I installed python with:
zypper in python3
I run the command:
pip3 install pandas
It gives me back a log, here is the part where the error is referenced:
gcc -pthread -Wno-unused-result -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -fstack-protector -O2 -Wall -D_FORTIFY_SOURCE=2 -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -g -fwrapv -DOPENSSL_LOAD_CONF -fPIC -Ipandas/_libs/src/klib -Ipandas/_libs/src -I/usr/lib64/python3.4/site-packages/numpy/core/include -I/usr/include/python3.4m -c pandas/_libs/tslib.c -o build/temp.linux-x86_64-3.4/pandas/_libs/tslib.o -Wno-unused-function
gcc: error: unrecognized command line option ‘-fstack-clash-protection’
error: command 'gcc' failed with exit status 1
Failed building wheel for pandas
Running setup.py clean for pandas
Failed to build pandas
Installing collected packages: pandas
Running setup.py install for pandas ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-install-xvndc9lz/pandas/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-nq8ffg3o/install-record.txt --single-version-externally-managed --compile:
Now, I've already googled around, there is a an issue on pip's github which references this problem, but none of the solutions worked.
https://github.com/pypa/pip/issues/5720
Solutions were updating gcc. Mine was initially at version 4.8 but i've already tried 4.9 and 5. Can't go higher than that because YAST is having trouble with dependencies and god know what else.
Any ideas? I think it must be something about the OS, because i've managed to install pandas in another machine, with another linux distro, same python, same gcc..
There is a gcc7 in the "Toolchain Module". SUSEconnect and/or YaST will allow to enable this extra package repository.

pypy3 install Cryptography failed

I tried to install Cryptography through:
lsn#lsn-Super-Server:~/pypy/pypy3-v6.0.0-linux64/bin$ ./pypy3 -m pip install PyMySQL
But, it failed with the comments:
running egg_info
writing src/cryptography.egg-info/PKG-INFO
writing dependency_links to src/cryptography.egg-info/dependency_links.txt
writing requirements to src/cryptography.egg-info/requires.txt
writing top-level names to src/cryptography.egg-info/top_level.txt
reading manifest file 'src/cryptography.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
no previously-included directories found matching 'docs/_build'
warning: no previously-included files matching '*' found under directory 'vectors'
writing manifest file 'src/cryptography.egg-info/SOURCES.txt'
running build_ext
generating cffi module 'build/temp.linux-x86_64-3.5/_padding.c'
creating build/temp.linux-x86_64-3.5
generating cffi module 'build/temp.linux-x86_64-3.5/_constant_time.c'
generating cffi module 'build/temp.linux-x86_64-3.5/_openssl.c'
building '_openssl' extension
creating build/temp.linux-x86_64-3.5/build
creating build/temp.linux-x86_64-3.5/build/temp.linux-x86_64-3.5
cc -pthread -DNDEBUG -O2 -Qunused-arguments -fPIC -I/home/lsn/pypy/pypy3-v6.0.0-linux64/include -c build/temp.linux-x86_64-3.5/_openssl.c -o build/temp.linux-x86_64-3.5/build/temp.linux-x86_64-3.5/_openssl.o -Wconversion -Wno-error=sign-conversion
cc: error: unrecognized command line option ‘-Qunused-arguments’; did you mean ‘-Wunused-parameter’?
error: command 'cc' failed with exit status 1
----------------------------------------
Command "/home/lsn/pypy/pypy3-v6.0.0-linux64/bin/pypy3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-87db0m7x/Cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-9zd03ixf/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-87db0m7x/Cryptography/
I faced the same error while installing paypalrestsdk for python3 and I found the solution that needs to install or update python-openssl for that.
Try below commands, it's working for me.
For python2
sudo apt-get install python-openssl
For python3
sudo apt-get install python3-openssl
Hope it works for you too.

pip install bad interpreter: No such file or directory

I was trying to install pymssql library:
pip install pymssql
It gave the following error:
Collecting pymssql
Downloading https://files.pythonhosted.org/packages/4c/c8/5ad36d8d3c304ab4f310c89d0593ab7b6229568dd8e9cde927311b2f0c00/pymssql-2.1.3.tar.gz (897kB)
100% |████████████████████████████████| 901kB 1.1MB/s
Installing collected packages: pymssql
Running setup.py install for pymssql ... error
Complete output from command /Users/hektor/Sites/venv2/bin/python3 -u -c "import setuptools, tokenize;__file__='/private/var/folders/rv/vbf7xqh1601_xjkrn85w7hp00000gn/T/pip-install-60za8qcc/pymssql/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/rv/vbf7xqh1601_xjkrn85w7hp00000gn/T/pip-record-vh_omvko/install-record.txt --single-version-externally-managed --compile --install-headers /Users/hektor/Sites/venv2/include/site/python3.5/pymssql:
setup.py: platform.system() => 'Darwin'
setup.py: platform.architecture() => ('64bit', '')
setup.py: platform.libc_ver() => ('', '')
setup.py: Detected Darwin/Mac OS X.
You can install FreeTDS with Homebrew or MacPorts, or by downloading
and compiling it yourself.
Homebrew (http://brew.sh/)
--------------------------
brew install freetds
MacPorts (http://www.macports.org/)
-----------------------------------
sudo port install freetds
setup.py: Not using bundled FreeTDS
setup.py: include_dirs = ['/usr/local/include']
setup.py: library_dirs = ['/usr/local/lib']
running install
running build
running build_ext
building '_mssql' extension
creating build
creating build/temp.macosx-10.11-x86_64-3.5
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/Users/hektor/Sites/venv2/include -I/usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -c _mssql.c -o build/temp.macosx-10.11-x86_64-3.5/_mssql.o -DMSDBLIB
_mssql.c:266:10: fatal error: 'sqlfront.h' file not found
#include "sqlfront.h"
^~~~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
As I understand from above that I need to install FreeTDS as indicated in their website
I installed FreeTDS with homebrew:
brew install freetds
After the installation was complete, I tried to run this command again:
pip install pymssql
However I got this error:
-bash: /Users/hektor/Sites/venv2/bin/pip: /Users/hektor/Sites/venv2/bin/python3: bad interpreter: No such file or directory
Additional information:
If I run which python:
/Users/hektor/anaconda2/bin/python
If I run which python3, then nothing returns.
I am using MacOS and my development environment is a virtual environment in my local machine.
How can I fix this problem? I had no such error until I try this pip installation.

Resources