error while trying to install tesserocr - python-tesseract

I keep getting the same error when I try to install
(env) vagrant#vagrant:~$ pip install tesserocr
Collecting tesserocr
Using cached tesserocr-2.1.3.tar.gz
Building wheels for collected packages: tesserocr
Running setup.py bdist_wheel for tesserocr ... error
Complete output from command /home/vagrant/src/env/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-4K2D6A/tesserocr/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmp5p5G1lpip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_ext
Failed to extract tesseract version from executable: [Errno 2] No such file or directory
Supporting tesseract v3.04.00
Building with configs: {'libraries': ['tesseract', 'lept'], 'cython_compile_time_env': {'TESSERACT_VERSION': 197632}}
cythoning tesserocr.pyx to tesserocr.cpp
building 'tesserocr' extension
creating build
creating build/temp.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c tesserocr.cpp -o build/temp.linux-x86_64-2.7/tesserocr.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
tesserocr.cpp:446:34: fatal error: leptonica/allheaders.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
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 /home/vagrant/src/env/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-4K2D6A/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 /tmp/pip-mePzAW-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/vagrant/src/env/include/site/python2.7/tesserocr:
running install
running build
running build_ext
Failed to extract tesseract version from executable: [Errno 2] No such file or directory
Supporting tesseract v3.04.00
Building with configs: {'libraries': ['tesseract', 'lept'], 'cython_compile_time_env': {'TESSERACT_VERSION': 197632}}
skipping 'tesserocr.cpp' Cython extension (up-to-date)
building 'tesserocr' extension
creating build
creating build/temp.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c tesserocr.cpp -o build/temp.linux-x86_64-2.7/tesserocr.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
tesserocr.cpp:446:34: fatal error: leptonica/allheaders.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/home/vagrant/src/env/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-4K2D6A/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 /tmp/pip-mePzAW-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/vagrant/src/env/include/site/python2.7/tesserocr" failed with error code 1 in /tmp/pip-build-4K2D6A/tesserocr/
Sachin System Error:
pip install tesserocr
Collecting tesserocr
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Using cached tesserocr-2.1.3.tar.gz
Building wheels for collected packages: tesserocr
Running setup.py bdist_wheel for tesserocr ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-YcBV5a/tesserocr/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpRrPD1Vpip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_ext
pkg-config failed to find tesseract/lep libraries: Package tesseract was not found in the pkg-config search path.
Perhaps you should add the directory containing `tesseract.pc'
to the PKG_CONFIG_PATH environment variable
No package 'tesseract' found
Supporting tesseract v3.03
Building with configs: {'libraries': ['tesseract', 'lept'], 'cython_compile_time_env': {'TESSERACT_VERSION': 771}}
cythoning tesserocr.pyx to tesserocr.cpp
building 'tesserocr' extension
creating build
creating build/temp.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c tesserocr.cpp -o build/temp.linux-x86_64-2.7/tesserocr.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
tesserocr.cpp: In function ‘PyObject* __pyx_pf_9tesserocr_14PyPageIterator_20SetBoundingBoxComponents(__pyx_obj_9tesserocr_PyPageIterator*, bool, bool)’:
tesserocr.cpp:4622:25: error: ‘class tesseract::PageIterator’ has no member named ‘SetBoundingBoxComponents’
__pyx_v_self->_piter->SetBoundingBoxComponents(__pyx_v_include_upper_dots, __pyx_v_include_lower_dots);
^
tesserocr.cpp: In function ‘PyObject* __pyx_pf_9tesserocr_14PyPageIterator_34GetImage(__pyx_obj_9tesserocr_PyPageIterator*, tesseract::PageIteratorLevel, int, PyObject*)’:
tesserocr.cpp:5854:125: error: no matching function for call to ‘tesseract::PageIterator::GetImage(tesseract::PageIteratorLevel&, int&, Pix*&, int*, int*)’
__pyx_v_pix = __pyx_v_self->_piter->GetImage(__pyx_v_level, __pyx_v_padding, __pyx_v_opix, (&__pyx_v_left), (&__pyx_v_top));
^
tesserocr.cpp:5854:125: note: candidate is:
In file included from tesserocr.cpp:456:0:
/usr/include/tesseract/pageiterator.h:239:8: note: Pix* tesseract::PageIterator::GetImage(tesseract::PageIteratorLevel, int, int*, int*) const
Pix* GetImage(PageIteratorLevel level, int padding,
^
/usr/include/tesseract/pageiterator.h:239:8: note: candidate expects 4 arguments, 5 provided
tesserocr.cpp: In function ‘PyObject* __pyx_pf_9tesserocr_13PyTessBaseAPI_74AnalyseLayout(__pyx_obj_9tesserocr_PyTessBaseAPI*, bool)’:
tesserocr.cpp:16256:83: error: no matching function for call to ‘tesseract::TessBaseAPI::AnalyseLayout(bool&)’
__pyx_v_piter = __pyx_v_self->_baseapi.AnalyseLayout(__pyx_v_merge_similar_words);
^
tesserocr.cpp:16256:83: note: candidate is:
In file included from tesserocr.cpp:461:0:
/usr/include/tesseract/baseapi.h:489:17: note: tesseract::PageIterator* tesseract::TessBaseAPI::AnalyseLayout()
PageIterator* AnalyseLayout();
^
/usr/include/tesseract/baseapi.h:489:17: note: candidate expects 0 arguments, 1 provided
tesserocr.cpp: In function ‘tesseract::TessResultRenderer* __pyx_f_9tesserocr_13PyTessBaseAPI__get_renderer(__pyx_obj_9tesserocr_PyTessBaseAPI*, __pyx_t_9tesseract_cchar_t*)’:
tesserocr.cpp:16600:88: error: no matching function for call to ‘tesseract::TessHOcrRenderer::TessHOcrRenderer(__pyx_t_9tesseract_cchar_t*&, bool&)’
__pyx_t_2 = new tesseract::TessHOcrRenderer(__pyx_v_outputbase, __pyx_v_font_info);
^
tesserocr.cpp:16600:88: note: candidates are:
In file included from tesserocr.cpp:459:0:
/usr/include/tesseract/renderer.h:175:3: note: tesseract::TessHOcrRenderer::TessHOcrRenderer()
TessHOcrRenderer();
^
/usr/include/tesseract/renderer.h:175:3: note: candidate expects 0 arguments, 2 provided
/usr/include/tesseract/renderer.h:173:16: note: tesseract::TessHOcrRenderer::TessHOcrRenderer(const tesseract::TessHOcrRenderer&)
class TESS_API TessHOcrRenderer : public TessResultRenderer {
^
/usr/include/tesseract/renderer.h:173:16: note: candidate expects 1 argument, 2 provided
tesserocr.cpp:16643:106: error: no matching function for call to ‘tesseract::TessPDFRenderer::TessPDFRenderer(__pyx_t_9tesseract_cchar_t*&, const char*)’
__pyx_t_3 = new tesseract::TessPDFRenderer(__pyx_v_outputbase, __pyx_v_self->_baseapi.GetDatapath());
^
tesserocr.cpp:16643:106: note: candidates are:
In file included from tesserocr.cpp:459:0:
/usr/include/tesseract/renderer.h:188:3: note: tesseract::TessPDFRenderer::TessPDFRenderer(const char*)
TessPDFRenderer(const char *datadir);
^
/usr/include/tesseract/renderer.h:188:3: note: candidate expects 1 argument, 2 provided
/usr/include/tesseract/renderer.h:186:16: note: tesseract::TessPDFRenderer::TessPDFRenderer(const tesseract::TessPDFRenderer&)
class TESS_API TessPDFRenderer : public TessResultRenderer {
^
/usr/include/tesseract/renderer.h:186:16: note: candidate expects 1 argument, 2 provided
tesserocr.cpp:16727:69: error: no matching function for call to ‘tesseract::TessUnlvRenderer::TessUnlvRenderer(__pyx_t_9tesseract_cchar_t*&)’
__pyx_t_4 = new tesseract::TessUnlvRenderer(__pyx_v_outputbase);
^
tesserocr.cpp:16727:69: note: candidates are:
In file included from tesserocr.cpp:459:0:
/usr/include/tesseract/renderer.h:227:3: note: tesseract::TessUnlvRenderer::TessUnlvRenderer()
TessUnlvRenderer();
^
/usr/include/tesseract/renderer.h:227:3: note: candidate expects 0 arguments, 1 provided
/usr/include/tesseract/renderer.h:225:16: note: tesseract::TessUnlvRenderer::TessUnlvRenderer(const tesseract::TessUnlvRenderer&)
class TESS_API TessUnlvRenderer : public TessResultRenderer {
^
/usr/include/tesseract/renderer.h:225:16: note: no known conversion for argument 1 from ‘__pyx_t_9tesseract_cchar_t* {aka const char*}’ to ‘const tesseract::TessUnlvRenderer&’
tesserocr.cpp:16811:72: error: no matching function for call to ‘tesseract::TessBoxTextRenderer::TessBoxTextRenderer(__pyx_t_9tesseract_cchar_t*&)’
__pyx_t_5 = new tesseract::TessBoxTextRenderer(__pyx_v_outputbase);
^
tesserocr.cpp:16811:72: note: candidates are:
In file included from tesserocr.cpp:459:0:
/usr/include/tesseract/renderer.h:238:3: note: tesseract::TessBoxTextRenderer::TessBoxTextRenderer()
TessBoxTextRenderer();
^
/usr/include/tesseract/renderer.h:238:3: note: candidate expects 0 arguments, 1 provided
/usr/include/tesseract/renderer.h:236:16: note: tesseract::TessBoxTextRenderer::TessBoxTextRenderer(const tesseract::TessBoxTextRenderer&)
class TESS_API TessBoxTextRenderer : public TessResultRenderer {
^
/usr/include/tesseract/renderer.h:236:16: note: no known conversion for argument 1 from ‘__pyx_t_9tesseract_cchar_t* {aka const char*}’ to ‘const tesseract::TessBoxTextRenderer&’
tesserocr.cpp:16895:69: error: no matching function for call to ‘tesseract::TessTextRenderer::TessTextRenderer(__pyx_t_9tesseract_cchar_t*&)’
__pyx_t_6 = new tesseract::TessTextRenderer(__pyx_v_outputbase);
^
tesserocr.cpp:16895:69: note: candidates are:
In file included from tesserocr.cpp:459:0:
/usr/include/tesseract/renderer.h:164:3: note: tesseract::TessTextRenderer::TessTextRenderer()
TessTextRenderer();
^
/usr/include/tesseract/renderer.h:164:3: note: candidate expects 0 arguments, 1 provided
/usr/include/tesseract/renderer.h:162:16: note: tesseract::TessTextRenderer::TessTextRenderer(const tesseract::TessTextRenderer&)
class TESS_API TessTextRenderer : public TessResultRenderer {
^
/usr/include/tesseract/renderer.h:162:16: note: no known conversion for argument 1 from ‘__pyx_t_9tesseract_cchar_t* {aka const char*}’ to ‘const tesseract::TessTextRenderer&’
tesserocr.cpp: In function ‘PyObject* __pyx_pf_9tesserocr_13PyTessBaseAPI_108IsValidCharacter(__pyx_obj_9tesserocr_PyTessBaseAPI*, PyObject*)’:
tesserocr.cpp:19661:60: error: ‘class tesseract::TessBaseAPI’ has no member named ‘IsValidCharacter’
__pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->_baseapi.IsValidCharacter(__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2161, __pyx_L1_error)
^
tesserocr.cpp:544:36: note: in definition of macro ‘__Pyx_PyBool_FromLong’
#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
^
tesserocr.cpp: In function ‘void inittesserocr()’:
tesserocr.cpp:25014:67: error: ‘PSM_RAW_LINE’ is not a member of ‘tesseract’
__pyx_t_2 = __Pyx_PyInt_From_enum__tesseract_3a__3a_PageSegMode(tesseract::PSM_RAW_LINE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error)
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
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 /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-YcBV5a/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 /tmp/pip-KHSvyq-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
pkg-config failed to find tesseract/lep libraries: Package tesseract was not found in the pkg-config search path.
Perhaps you should add the directory containing `tesseract.pc'
to the PKG_CONFIG_PATH environment variable
No package 'tesseract' found
Supporting tesseract v3.03
Building with configs: {'libraries': ['tesseract', 'lept'], 'cython_compile_time_env': {'TESSERACT_VERSION': 771}}
skipping 'tesserocr.cpp' Cython extension (up-to-date)
building 'tesserocr' extension
creating build
creating build/temp.linux-x86_64-2.7
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c tesserocr.cpp -o build/temp.linux-x86_64-2.7/tesserocr.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
tesserocr.cpp: In function ‘PyObject* __pyx_pf_9tesserocr_14PyPageIterator_20SetBoundingBoxComponents(__pyx_obj_9tesserocr_PyPageIterator*, bool, bool)’:
tesserocr.cpp:4622:25: error: ‘class tesseract::PageIterator’ has no member named ‘SetBoundingBoxComponents’
__pyx_v_self->_piter->SetBoundingBoxComponents(__pyx_v_include_upper_dots, __pyx_v_include_lower_dots);
^
tesserocr.cpp: In function ‘PyObject* __pyx_pf_9tesserocr_14PyPageIterator_34GetImage(__pyx_obj_9tesserocr_PyPageIterator*, tesseract::PageIteratorLevel, int, PyObject*)’:
tesserocr.cpp:5854:125: error: no matching function for call to ‘tesseract::PageIterator::GetImage(tesseract::PageIteratorLevel&, int&, Pix*&, int*, int*)’
__pyx_v_pix = __pyx_v_self->_piter->GetImage(__pyx_v_level, __pyx_v_padding, __pyx_v_opix, (&__pyx_v_left), (&__pyx_v_top));
^
tesserocr.cpp:5854:125: note: candidate is:
In file included from tesserocr.cpp:456:0:
/usr/include/tesseract/pageiterator.h:239:8: note: Pix* tesseract::PageIterator::GetImage(tesseract::PageIteratorLevel, int, int*, int*) const
Pix* GetImage(PageIteratorLevel level, int padding,
^
/usr/include/tesseract/pageiterator.h:239:8: note: candidate expects 4 arguments, 5 provided
tesserocr.cpp: In function ‘PyObject* __pyx_pf_9tesserocr_13PyTessBaseAPI_74AnalyseLayout(__pyx_obj_9tesserocr_PyTessBaseAPI*, bool)’:
tesserocr.cpp:16256:83: error: no matching function for call to ‘tesseract::TessBaseAPI::AnalyseLayout(bool&)’
__pyx_v_piter = __pyx_v_self->_baseapi.AnalyseLayout(__pyx_v_merge_similar_words);
^
tesserocr.cpp:16256:83: note: candidate is:
In file included from tesserocr.cpp:461:0:
/usr/include/tesseract/baseapi.h:489:17: note: tesseract::PageIterator* tesseract::TessBaseAPI::AnalyseLayout()
PageIterator* AnalyseLayout();
^
/usr/include/tesseract/baseapi.h:489:17: note: candidate expects 0 arguments, 1 provided
tesserocr.cpp: In function ‘tesseract::TessResultRenderer* __pyx_f_9tesserocr_13PyTessBaseAPI__get_renderer(__pyx_obj_9tesserocr_PyTessBaseAPI*, __pyx_t_9tesseract_cchar_t*)’:
tesserocr.cpp:16600:88: error: no matching function for call to ‘tesseract::TessHOcrRenderer::TessHOcrRenderer(__pyx_t_9tesseract_cchar_t*&, bool&)’
__pyx_t_2 = new tesseract::TessHOcrRenderer(__pyx_v_outputbase, __pyx_v_font_info);
^
tesserocr.cpp:16600:88: note: candidates are:
In file included from tesserocr.cpp:459:0:
/usr/include/tesseract/renderer.h:175:3: note: tesseract::TessHOcrRenderer::TessHOcrRenderer()
TessHOcrRenderer();
^
/usr/include/tesseract/renderer.h:175:3: note: candidate expects 0 arguments, 2 provided
/usr/include/tesseract/renderer.h:173:16: note: tesseract::TessHOcrRenderer::TessHOcrRenderer(const tesseract::TessHOcrRenderer&)
class TESS_API TessHOcrRenderer : public TessResultRenderer {
^
/usr/include/tesseract/renderer.h:173:16: note: candidate expects 1 argument, 2 provided
tesserocr.cpp:16643:106: error: no matching function for call to ‘tesseract::TessPDFRenderer::TessPDFRenderer(__pyx_t_9tesseract_cchar_t*&, const char*)’
__pyx_t_3 = new tesseract::TessPDFRenderer(__pyx_v_outputbase, __pyx_v_self->_baseapi.GetDatapath());
^
tesserocr.cpp:16643:106: note: candidates are:
In file included from tesserocr.cpp:459:0:
/usr/include/tesseract/renderer.h:188:3: note: tesseract::TessPDFRenderer::TessPDFRenderer(const char*)
TessPDFRenderer(const char *datadir);
^
/usr/include/tesseract/renderer.h:188:3: note: candidate expects 1 argument, 2 provided
/usr/include/tesseract/renderer.h:186:16: note: tesseract::TessPDFRenderer::TessPDFRenderer(const tesseract::TessPDFRenderer&)
class TESS_API TessPDFRenderer : public TessResultRenderer {
^
/usr/include/tesseract/renderer.h:186:16: note: candidate expects 1 argument, 2 provided
tesserocr.cpp:16727:69: error: no matching function for call to ‘tesseract::TessUnlvRenderer::TessUnlvRenderer(__pyx_t_9tesseract_cchar_t*&)’
__pyx_t_4 = new tesseract::TessUnlvRenderer(__pyx_v_outputbase);
^
tesserocr.cpp:16727:69: note: candidates are:
In file included from tesserocr.cpp:459:0:
/usr/include/tesseract/renderer.h:227:3: note: tesseract::TessUnlvRenderer::TessUnlvRenderer()
TessUnlvRenderer();
^
/usr/include/tesseract/renderer.h:227:3: note: candidate expects 0 arguments, 1 provided
/usr/include/tesseract/renderer.h:225:16: note: tesseract::TessUnlvRenderer::TessUnlvRenderer(const tesseract::TessUnlvRenderer&)
class TESS_API TessUnlvRenderer : public TessResultRenderer {
^
/usr/include/tesseract/renderer.h:225:16: note: no known conversion for argument 1 from ‘__pyx_t_9tesseract_cchar_t* {aka const char*}’ to ‘const tesseract::TessUnlvRenderer&’
tesserocr.cpp:16811:72: error: no matching function for call to ‘tesseract::TessBoxTextRenderer::TessBoxTextRenderer(__pyx_t_9tesseract_cchar_t*&)’
__pyx_t_5 = new tesseract::TessBoxTextRenderer(__pyx_v_outputbase);
^
tesserocr.cpp:16811:72: note: candidates are:
In file included from tesserocr.cpp:459:0:
/usr/include/tesseract/renderer.h:238:3: note: tesseract::TessBoxTextRenderer::TessBoxTextRenderer()
TessBoxTextRenderer();
^
/usr/include/tesseract/renderer.h:238:3: note: candidate expects 0 arguments, 1 provided
/usr/include/tesseract/renderer.h:236:16: note: tesseract::TessBoxTextRenderer::TessBoxTextRenderer(const tesseract::TessBoxTextRenderer&)
class TESS_API TessBoxTextRenderer : public TessResultRenderer {
^
/usr/include/tesseract/renderer.h:236:16: note: no known conversion for argument 1 from ‘__pyx_t_9tesseract_cchar_t* {aka const char*}’ to ‘const tesseract::TessBoxTextRenderer&’
tesserocr.cpp:16895:69: error: no matching function for call to ‘tesseract::TessTextRenderer::TessTextRenderer(__pyx_t_9tesseract_cchar_t*&)’
__pyx_t_6 = new tesseract::TessTextRenderer(__pyx_v_outputbase);
^
tesserocr.cpp:16895:69: note: candidates are:
In file included from tesserocr.cpp:459:0:
/usr/include/tesseract/renderer.h:164:3: note: tesseract::TessTextRenderer::TessTextRenderer()
TessTextRenderer();
^
/usr/include/tesseract/renderer.h:164:3: note: candidate expects 0 arguments, 1 provided
/usr/include/tesseract/renderer.h:162:16: note: tesseract::TessTextRenderer::TessTextRenderer(const tesseract::TessTextRenderer&)
class TESS_API TessTextRenderer : public TessResultRenderer {
^
/usr/include/tesseract/renderer.h:162:16: note: no known conversion for argument 1 from ‘__pyx_t_9tesseract_cchar_t* {aka const char*}’ to ‘const tesseract::TessTextRenderer&’
tesserocr.cpp: In function ‘PyObject* __pyx_pf_9tesserocr_13PyTessBaseAPI_108IsValidCharacter(__pyx_obj_9tesserocr_PyTessBaseAPI*, PyObject*)’:
tesserocr.cpp:19661:60: error: ‘class tesseract::TessBaseAPI’ has no member named ‘IsValidCharacter’
__pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->_baseapi.IsValidCharacter(__pyx_t_2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2161, __pyx_L1_error)
^
tesserocr.cpp:544:36: note: in definition of macro ‘__Pyx_PyBool_FromLong’
#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
^
tesserocr.cpp: In function ‘void inittesserocr()’:
tesserocr.cpp:25014:67: error: ‘PSM_RAW_LINE’ is not a member of ‘tesseract’
__pyx_t_2 = __Pyx_PyInt_From_enum__tesseract_3a__3a_PageSegMode(tesseract::PSM_RAW_LINE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error)
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-YcBV5a/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 /tmp/pip-KHSvyq-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-YcBV5a/tesserocr/

Faced this problem today. It happens because we are missing these libraries
libleptonica-dev and libtesseract-dev
Solution is to install them using your package manager.
Ubuntu
apt-get install libleptonica-dev libtesseract-dev
Mac
pip install tesserocr
will auto install tesserocr and its dependent lib leptonica
solved the issue

My error was like:
Failed building wheel for tesserocr
(...)
Supporting tesseract v4.0.0
Building with configs: {'libraries': ['tesseract', 'lept'], 'cython_compile_time_env': {'TESSERACT_VERSION': 67108864}}
(...)
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c tesserocr.cpp -o build/temp.linux-x86_64-3.6/tesserocr.o -std=c++11 -DUSE_STD_NAMESPACE
tesserocr.cpp: In function 'PyObject* __pyx_pf_9tesserocr_16PyResultIterator_8GetBestLSTMSymbolChoices(__pyx_obj_9tesserocr_PyResultIterator*)':
tesserocr.cpp:12192:43: error: 'class tesseract::ResultIterator' has no member named 'GetBestLSTMSymbolChoices'
__pyx_v_output = (__pyx_v_self->_riter->GetBestLSTMSymbolChoices()[0]);
^~~~~~~~~~~~~~~~~~~~~~~~
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-s6f5ze1q/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 /tmp/pip-lopr6cjz-record/install-record.txt --single-version-externally-managed --compile"
failed with error code 1 in /tmp/pip-build-s6f5ze1q/tesserocr/
I resolved it with additional installation of pkg-config library.
apt-get install libleptonica-dev libtesseract-dev \
tesseract-ocr tesseract-ocr-eng \
pkg-config

If you are using a linux(Debian based like Ubuntu 14.04) system you would like to upgrade your Tesseract version. Apparently in Ubuntu 14.04 default Tesseract version is 3.03 which is not supported by tesserocr. You have to build from source with some newer Tesseract versions like 4.00 or 3.05.But in newer OS versions this should not be a problem.
Just follow the link for the installation
Installing Tesserocr with Tesseract 3.04+

Related

CuPy installatioin fails on Mac OS X 10.13.6 using pip

On MacOS HighSierra 10.13.6 with Python 3.5.7 and Cuda 10.1
Both
pip3.5 install cupy-cuda101
and
pip3.5 install cupy
fail, with different issues.
First attempt:
pip3.5 install cupy-cuda101 -vvvv
Collecting cupy-cuda101
1 location(s) to search for versions of cupy-cuda101:
* https://pypi.org/simple/cupy-cuda101/
Getting page https://pypi.org/simple/cupy-cuda101/
Looking up "https://pypi.org/simple/cupy-cuda101/" in the cache
Request header has "max_age" as 0, cache bypassed
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /simple/cupy-cuda101/ HTTP/1.1" 304 0
Analyzing links from page https://pypi.org/simple/cupy-cuda101/
Skipping link https://files.pythonhosted.org/packages/7c/cb/94b7aafd2344daf41c13bd152db14ed7eb2928be62575bc1421d94fbb490/cupy_cuda101-5.4.0-cp27-cp27mu-manylinux1_x86_64.whl#sha256=c422b46fc22232578d82168d73d2fd45d4ae303adad9e9e2bb6a60f6984e0438 (from https://pypi.org/simple/cupy-cuda101/); it is not compatible with this Python
[last line repeated for all ...]
ERROR: Could not find a version that satisfies the requirement cupy-cuda101 (from versions: none)
Cleaning up...
Removed build tracker '/private/var/folders/bz/cv2cs9y14qx6s5qf4hkz08s00000gn/T/pip-req-tracker-gfr00q13'
ERROR: No matching distribution found for cupy-cuda101
Exception information:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/pip/_internal/cli/base_command.py", line 178, in main
status = self.run(options, args)
File "/usr/local/lib/python3.5/site-packages/pip/_internal/commands/install.py", line 352, in run
resolver.resolve(requirement_set)
File "/usr/local/lib/python3.5/site-packages/pip/_internal/resolve.py", line 131, in resolve
self._resolve_one(requirement_set, req)
File "/usr/local/lib/python3.5/site-packages/pip/_internal/resolve.py", line 294, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/usr/local/lib/python3.5/site-packages/pip/_internal/resolve.py", line 242, in _get_abstract_dist_for
self.require_hashes
File "/usr/local/lib/python3.5/site-packages/pip/_internal/operations/prepare.py", line 282, in prepare_linked_requirement
req.populate_link(finder, upgrade_allowed, require_hashes)
File "/usr/local/lib/python3.5/site-packages/pip/_internal/req/req_install.py", line 198, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/local/lib/python3.5/site-packages/pip/_internal/index.py", line 792, in find_requirement
'No matching distribution found for %s' % req
pip._internal.exceptions.DistributionNotFound: No matching distribution found for cupy-cuda101
2nd attempt:
pip3.5 install cupy -vvvv
[...]
************************************************************
* CuPy Configuration Summary *
************************************************************
Build Environment:
Include directories: ['/usr/local/cuda/include']
Library directories: ['/usr/local/cuda/lib', '/usr/local/cuda/lib']
nvcc command : ['/usr/local/cuda/bin/nvcc']
Environment Variables:
CFLAGS : (none)
LDFLAGS : (none)
LIBRARY_PATH : (none)
CUDA_PATH : (none)
NVTOOLSEXT_PATH : (none)
NVCC : (none)
Modules:
cuda : Yes (version 10010)
cudnn : No
-> Include files not found: ['cudnn.h']
-> Check your CFLAGS environment variable.
nccl : No
-> Include files not found: ['nccl.h']
-> Check your CFLAGS environment variable.
cusolver : Yes
nvtx : Yes
thrust : Yes
WARNING: Some modules could not be configured.
CuPy will be installed without these modules.
Please refer to the Installation Guide for details:
https://docs-cupy.chainer.org/en/stable/install.html
************************************************************
[...]
copying cupy/cuda/cupy_thrust.cu -> build/lib.macosx-10.13-x86_64-3.5/cupy/cuda
running build_ext
building 'cupy.core._dtype' extension
creating build/temp.macosx-10.13-x86_64-3.5
creating build/temp.macosx-10.13-x86_64-3.5/cupy
creating build/temp.macosx-10.13-x86_64-3.5/cupy/core
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -D_FORCE_INLINES=1 -I/usr/local/cuda/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python35/3.5.7_1/Frameworks/Python.framework/Versions/3.5/include/python3.5m -c cupy/core/_dtype.cpp -o build/temp.macosx-10.13-x86_64-3.5/cupy/core/_dtype.o
cupy/core/_dtype.cpp:3068:52: warning: code will never be executed [-Wunreachable-code]
} else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
^~~~
cupy/core/_dtype.cpp:3068:38: note: silence by adding parentheses to mark code as explicitly dead
} else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
^
/* DISABLES CODE */ ( )
1 warning generated.
clang++ -bundle -undefined dynamic_lookup -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk build/temp.macosx-10.13-x86_64-3.5/cupy/core/_dtype.o -L/usr/local/cuda/lib -L/usr/local/cuda/lib -L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/sqlite/lib -L/usr/local/cuda/lib -L/usr/local/cuda/lib -lcublas -lcuda -lcudart -lcufft -lcurand -lcusparse -lnvrtc -o build/lib.macosx-10.13-x86_64-3.5/cupy/core/_dtype.cpython-35m-darwin.so -Wl,-rpath,/usr/local/cuda/lib,-rpath,/usr/local/cuda/lib -mmacosx-version-min=10.5
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9 [-Wdeprecated]
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang++' failed with exit status 1
error
ERROR: Failed building wheel for cupy
[...]
Any ideas what I'm doing wrong?
Update: Removed the Homebrew version of python 3.5 and installed the latest python 3.7 version using a conda installer and
pip install cupy
was successful.

undeclared identifier when trying to install libsodium-php on ubuntu 16.04

I'm having some trouble installing the php wrapper for libsodium on Ubuntu 16.04. I installed libsodium with sudo apt-get install libsodium but when I run sudo pecl install libsodium I get a undeclared identifier error.
running: make
/bin/bash /tmp/pear/temp/pear-build-root1K2CoA/libsodium-2.0.1/libtool --mode=compile cc -I. -I/tmp/pear/temp/libsodium -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-root1K2CoA/libsodium-2.0.1/include -I/tmp/pear/temp/pear-build-root1K2CoA/libsodium-2.0.1/main -I/tmp/pear/temp/libsodium -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/libsodium/libsodium.c -o libsodium.lo
libtool: compile: cc -I. -I/tmp/pear/temp/libsodium -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-root1K2CoA/libsodium-2.0.1/include -I/tmp/pear/temp/pear-build-root1K2CoA/libsodium-2.0.1/main -I/tmp/pear/temp/libsodium -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/libsodium/libsodium.c -fPIC -DPIC -o .libs/libsodium.o
/tmp/pear/temp/libsodium/libsodium.c: In function ‘zif_sodium_crypto_kdf_derive_from_key’:
/tmp/pear/temp/libsodium/libsodium.c:2899:29: error: ‘crypto_kdf_blake2b_CONTEXTBYTES’ undeclared (first use in this function)
memcpy(ctx_padded, ctx, crypto_kdf_blake2b_CONTEXTBYTES);
^
/tmp/pear/temp/libsodium/libsodium.c:2899:29: note: each undeclared identifier is reported only once for each function it appears in
Makefile:194: recipe for target 'libsodium.lo' failed
make: *** [libsodium.lo] Error 1
ERROR: `make' failed
It looks like apt-get wasn't installing the latest version of libsodium. After downloading and compiling the latest version I was able to install the php extension.

TensorFlow 1.1 “bazel build tensorflow/tools/graph_transforms:transform_graph"

When I build quantization tool use the command
"bazel build tensorflow/tools/graph_transforms:transform_graph"
The complie result as below:
WARNING: Sandboxed execution is not supported on your system and thus hermeticity of actions cannot be guaranteed. See http://bazel.build/docs/bazel-user-manual.html#sandboxing for more information. You can turn off this warning via --ignore_unsupported_sandboxing.
INFO: Found 1 target...
ERROR: /root/tensorflow-master/tensorflow/core/BUILD:1287:1: C++ compilation of rule '//tensorflow/core:framework_internal' failed: gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG ... (remaining 106 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
tensorflow/core/framework/reader_op_kernel.cc:20:61: error: definition of implicitly-declared 'tensorflow::ReaderOpKernel::ReaderOpKernel(tensorflow::OpKernelConstruction*)'
ReaderOpKernel::ReaderOpKernel(OpKernelConstruction* context)
^
tensorflow/core/framework/reader_op_kernel.cc:27:33: error: definition of implicitly-declared 'virtual tensorflow::ReaderOpKernel::~ReaderOpKernel()'
ReaderOpKernel::~ReaderOpKernel() {
^
tensorflow/core/framework/reader_op_kernel.cc:34:50: error: no 'void tensorflow::ReaderOpKernel::Compute(tensorflow::OpKernelContext*)' member function declared in class 'tensorflow::ReaderOpKernel'
void ReaderOpKernel::Compute(OpKernelContext* ctx) {
^
Target //tensorflow/tools/graph_transforms:transform_graph failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 5.989s, Critical Path: 5.02s
What's the problem?
Thanks!
Please try two things:
(1) configure the compile environment first and then compile, like
./configure
bazel build tensorflow/tools/graph_transforms:transform_graph
(2) You can also try:
sudo bazel build tensorflow/tools/graph_transforms:transform_graph
Point (2) worked for me sometimes to remove dependencies of including header files.
please download the latest tensorflow and bazel, if needed.

Problems installing pyhs2 in python3

I am using CentOS 6.5 and want to access a remote hive server. But I am unable to install pyhs2 using pip install pyhs2.
I have installed all the required dependencies:
gcc-c++
python-devel.x86_64
cyrus-sasl-devel.x86_64
But still I get the same error:
Failed building wheel for sasl
Failed to build sasl
Installing collected packages: sasl, pyhs2
Running setup.py install for sasl
Complete output from command /usr/local/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-vq9qfls4/sasl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-bjam3ra0-record/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
running egg_info
writing top-level names to sasl.egg-info/top_level.txt
writing dependency_links to sasl.egg-info/dependency_links.txt
writing sasl.egg-info/PKG-INFO
warning: manifest_maker: standard file '-c' not found
reading manifest file 'sasl.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'sasl.egg-info/SOURCES.txt'
running build_ext
building '_saslwrapper' extension
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Isasl -I/opt/include/python3.4m -c sasl/saslwrapper.cpp -o build/temp.linux-x86_64-3.4/sasl/saslwrapper.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
sasl/saslwrapper.cpp: In member function ‘void saslwrapper::ClientImpl::interact(sasl_interact_t*)’:
sasl/saslwrapper.cpp:341: warning: unused variable ‘input’
gcc -pthread -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Isasl -I/opt/include/python3.4m -c sasl/saslwrapper_wrap.cxx -o build/temp.linux-x86_64-3.4/sasl/saslwrapper_wrap.o
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++
sasl/saslwrapper_wrap.cxx: In function ‘void SWIG_Python_AddErrorMsg(const char*)’:
sasl/saslwrapper_wrap.cxx:884: error: ‘PyString_AsString’ was not declared in this scope
sasl/saslwrapper_wrap.cxx: In function ‘PySwigClientData* PySwigClientData_New(PyObject*)’:
sasl/saslwrapper_wrap.cxx:1275: error: ‘PyClass_Check’ was not declared in this scope
sasl/saslwrapper_wrap.cxx: In function ‘PyObject* PySwigObject_format(const char*, PySwigObject*)’:
sasl/saslwrapper_wrap.cxx:1348: error: ‘PyString_FromString’ was not declared in this scope
sasl/saslwrapper_wrap.cxx:1350: error: ‘PyString_Format’ was not declared in this scope
sasl/saslwrapper_wrap.cxx: In function ‘PyObject* PySwigObject_repr(PySwigObject*)’:
sasl/saslwrapper_wrap.cxx:1380: error: ‘PyString_AsString’ was not declared in this scope
sasl/saslwrapper_wrap.cxx:1380: error: ‘PyString_FromFormat’ was not declared in this scope
sasl/saslwrapper_wrap.cxx:1388: error: ‘PyString_ConcatAndDel’ was not declared in this scope
sasl/saslwrapper_wrap.cxx: In function ‘int PySwigObject_print(PySwigObject*, FILE*, int)’:
sasl/saslwrapper_wrap.cxx:1402: error: ‘PyString_AsString’ was not declared in this scope
sasl/saslwrapper_wrap.cxx: In function ‘PyObject* PySwigObject_str(PySwigObject*)’:
sasl/saslwrapper_wrap.cxx:1415: error: ‘PyString_FromString’ was not declared in this scope
sasl/saslwrapper_wrap.cxx: In function ‘PyTypeObject* _PySwigObject_type()’:
sasl/saslwrapper_wrap.cxx:1624: error: ‘coercion’ was not declared in this scope
sasl/saslwrapper_wrap.cxx:1624: error: expected ‘}’ before numeric constant
sasl/saslwrapper_wrap.cxx:1624: error: too many initializers for ‘PyNumberMethods’
sasl/saslwrapper_wrap.cxx:1624: error: invalid conversion from ‘PyObject* (*)(PyObject*, PyObject*)’ to ‘PyObject* (*)(PyObject*, PyObject*, PyObject*)’
sasl/saslwrapper_wrap.cxx:1624: error: invalid conversion from ‘PyObject* (*)(PyObject*, PyObject*, PyObject*)’ to ‘PyObject* (*)(PyObject*)’
sasl/saslwrapper_wrap.cxx:1624: error: invalid conversion from ‘PyObject* (*)(PyObject*)’ to ‘int (*)(PyObject*)’
sasl/saslwrapper_wrap.cxx:1624: error: invalid conversion from ‘int (*)(PyObject*)’ to ‘PyObject* (*)(PyObject*)’
sasl/saslwrapper_wrap.cxx:1624: error: expected ‘,’ or ‘;’ before numeric constant
sasl/saslwrapper_wrap.cxx:1604: warning: unused variable ‘swigobject_doc’
sasl/saslwrapper_wrap.cxx:1606: warning: unused variable ‘PySwigObject_as_number’
sasl/saslwrapper_wrap.cxx:1637: warning: no return statement in function returning non-void
sasl/saslwrapper_wrap.cxx: At global scope:
sasl/saslwrapper_wrap.cxx:1641: error: expected unqualified-id before ‘if’
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/stdexcept:38,
from sasl/saslwrapper_wrap.cxx:2542:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/exception:35: error: expected ‘}’ before end of line
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/exception:35: error: expected declaration before end of line
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/local/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-vq9qfls4/sasl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-bjam3ra0-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-vq9qfls4/sasl
This is an issue with Python3 and the dependency SASL. SASL is currently coded for Python2. This is seen with the error 'PyString_AsString not being declared in the scope'.
A short term solution, if possible, would be to use Python2. Long term, either the SASL dependency will need to be updated for Python3 or pyhs2 will need to use a different dependency.
Quick update:
It seems that now the "installation" of this module with pip-Python3 (I tried with 3.5 and 3.6) is possible.
However, even if it installs you won't be able to use it in Python3 because the module has never been ported to such version (for instance, it still uses the "cStringIO" module, which no longer exists in Python3).
Since pyhs2 is no longer maintained (see note in https://github.com/BradRuderman/pyhs2), you're stuck with Python2 or you'd better switch to another tool to connect to HiverServer2.

unable to `pip install numpy` on a specific machine

pip install numpy in a python virtualenv on my own Mac OSX machine and on another of my machine running Arch Linux works perfectly.
Unfortunately, the same command fails to work on a colleague's machine running Gentoo.
Here's the pip.log showing the error logs:-
building data_files sources
build_src: building npy-pkg config files
running build_py
copying numpy/version.py -> build/lib.linux-x86_64-2.7/numpy
copying build/src.linux-x86_64-2.7/numpy/__config__.py -> build/lib.linux-x86_64-2.7/numpy
copying build/src.linux-x86_64-2.7/numpy/distutils/__config__.py -> build/lib.linux-x86_64-2.7/numpy/distutils
running build_clib
customize UnixCCompiler
customize UnixCCompiler using build_clib
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize GnuFCompiler
customize IntelFCompiler
customize LaheyFCompiler
customize PGroupFCompiler
customize AbsoftFCompiler
customize NAGFCompiler
customize VastFCompiler
customize CompaqFCompiler
customize IntelItaniumFCompiler
customize IntelEM64TFCompiler
customize Gnu95FCompiler
customize Gnu95FCompiler
customize Gnu95FCompiler using build_ext
building 'numpy.linalg.lapack_lite' extension
compiling C sources
C compiler: x86_64-pc-linux-gnu-gcc -pthread -O3 -march=native -pipe -fomit-frame-pointer -fno-ident -fPIC
compile options: '-DNO_ATLAS_INFO=1 -Inumpy/core/include -Ibuild/src.linux-x86_64-2.7/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/include -I/usr/include/python2.7 -Ibuild/src.linux-x86_64-2.7/numpy/core/src/multiarray -Ibuild/src.linux-x86_64-2.7/numpy/core/src/umath -c'
x86_64-pc-linux-gnu-gcc: numpy/linalg/lapack_litemodule.c
x86_64-pc-linux-gnu-gcc: numpy/linalg/python_xerbla.c
/usr/bin/gfortran -Wall -s build/temp.linux-x86_64-2.7/numpy/linalg/lapack_litemodule.o build/temp.linux-x86_64-2.7/numpy/linalg/python_xerbla.o -L/usr/lib64 -L/usr/lib64 -Lbuild/temp.linux-x86_64-2.7 -llapack -lblas -lpython2.7 -lgfortran -o build/lib.linux-x86_64-2.7/numpy/linalg/lapack_lite.so
/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/../../../../lib64/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
error: Command "/usr/bin/gfortran -Wall -s build/temp.linux-x86_64-2.7/numpy/linalg/lapack_litemodule.o build/temp.linux-x86_64-2.7/numpy/linalg/python_xerbla.o -L/usr/lib64 -L/usr/lib64 -Lbuild/temp.linux-x86_64-2.7 -llapack -lblas -lpython2.7 -lgfortran -o build/lib.linux-x86_64-2.7/numpy/linalg/lapack_lite.so" failed with exit status 1
----------------------------------------
Command /home/stefan/.virtualenvs/senatus_env/bin/python2.7 -c "import setuptools;__file__='/home/stefan/.virtualenvs/senatus_env/build/numpy/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-Ebkksh-record/install-record.txt --install-headers /home/stefan/.virtualenvs/senatus_env/include/site/python2.7 failed with error code 1 in /home/stefan/.virtualenvs/senatus_env/build/numpy
Exception information:
Traceback (most recent call last):
File "/home/stefan/.virtualenvs/senatus_env/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py", line 104, in main
status = self.run(options, args)
File "/home/stefan/.virtualenvs/senatus_env/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/commands/install.py", line 250, in run
requirement_set.install(install_options, global_options)
File "/home/stefan/.virtualenvs/senatus_env/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 1133, in install
requirement.install(install_options, global_options)
File "/home/stefan/.virtualenvs/senatus_env/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 577, in install
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
File "/home/stefan/.virtualenvs/senatus_env/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/__init__.py", line 256, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command /home/stefan/.virtualenvs/senatus_env/bin/python2.7 -c "import setuptools;__file__='/home/stefan/.virtualenvs/senatus_env/build/numpy/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-Ebkksh-record/install-record.txt --install-headers /home/stefan/.virtualenvs/senatus_env/include/site/python2.7 failed with error code 1 in /home/stefan/.virtualenvs/senatus_env/build/numpy
It appears that the gfortran on my colleague's machine does not play well with the numpy package he is trying to install in the virtualenv. Any idea why this might be so?
If CFLAGS, CXXFLAGS, or LDFLAGS are set, it could cause this. The problem is that those environment variables override the settings in the compile script, causing problems.
Just unset them for the invocation of the pip command and you should be all set.
It looks to me that setuptools is not working correctly, setuptools has been superceded by the python "dist" utility so you might want to install that and retry the installation.