Unable to install (Error: 'cstring' file not found) - MacOS Mojave

See original GitHub issue
Collecting tesserocr
  Using cached https://files.pythonhosted.org/packages/f8/6d/4e81e041f33a4419e59edcb1dbdf3c56e9393f60f5ef531381bd67a1339b/tesserocr-2.3.1.tar.gz
Building wheels for collected packages: tesserocr
  Running setup.py bdist_wheel 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'))" bdist_wheel -d /private/var/folders/2h/ty244jbd1vd3d1l0m4k3_g980000gn/T/pip-wheel-5b3wyn1i --python-tag cp36:
  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 bdist_wheel
  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

  ----------------------------------------
  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

    ----------------------------------------
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" failed with error code 1 in /private/var/folders/2h/ty244jbd1vd3d1l0m4k3_g980000gn/T/pip-install-wgh41bv0/tesserocr/

Hi,

I’m trying to install tesserocr but encountering the above error. I’ve tried a few different ways to install, as well as a different potential fixes in previous posts, 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 with no problems, I also installed on a Ubuntu VM w/o issue), however I’m still posting here hoping for people who are close to this package can offer some insights.

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.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:5
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
poke1024commented, Jun 24, 2019

@PinkFloyded’s fix works for me on macOS 10.14.5 / tesseract 4, but I also need to set MACOSX_DEPLOYMENT_TARGET, otherwise I get:

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)

So, this works for me:

export CFLAGS="-stdlib=libc++"
export MACOSX_DEPLOYMENT_TARGET=10.9
python setup.py install
0reactions
Jhonhensoncommented, Mar 27, 2020

image QT project also do.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't compile C program on a Mac after upgrade to Mojave
When trying to compile pyRFR, I was getting errors about stdexcept not being found, which apparently was not installed in /usr/include with ...
Read more >
[OpenFOAM.com] Install v2006 on macOS Mojave failed
I tried to install OpenFOAM v2006 from terminal on macOS Mojave. ... no member named 'memcpy' in the global namespace using ::memcpy;
Read more >
Clang linking error MacOS Big Sur
I solved this problem by installing the CommandLineTool from Xcode. Before solving this problem, I found that there is no CommandLineTools folder in...
Read more >
Clang and gcc on macOS Catalina - Finding the include paths
It is able to download the files from Apple and creates an installer. ... fatal error: 'string.h' file not found #include_next <string.h> ...
Read more >
Unable to install visual studio for mac on my macOS Mojave
As a workaround: You can try manually mounting VisualStudioForMac.dmg from <USER_HOME>/Library/Caches/VisualStudioInstaller/downloads and update ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found