pdftotext: pip install fails on macOS

Hi, I’m running on macOs and trying ton install pdftotext I tried pip install pdftotext and got this error

`Collecting pdftotext Using cached https://files.pythonhosted.org/packages/a6/a7/c202adb0bcd3adc3030b0c5f7f0e21f62a721913e93296e6c4ddc305cbd3/pdftotext-2.1.2.tar.gz Building wheels for collected packages: pdftotext Building wheel for pdftotext (setup.py) … error ERROR: Command errored out with exit status 1: command: /Users/romainvandelouw/venv/oreilly/bin/python3 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/private/var/folders/zg/8mfp262s1093qtv0klghbfnr0000gn/T/pip-install-oailros8/pdftotext/setup.py’“'”‘; file=’“'”‘/private/var/folders/zg/8mfp262s1093qtv0klghbfnr0000gn/T/pip-install-oailros8/pdftotext/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/zg/8mfp262s1093qtv0klghbfnr0000gn/T/pip-wheel-yvlotdyb --python-tag cp36 cwd: /private/var/folders/zg/8mfp262s1093qtv0klghbfnr0000gn/T/pip-install-oailros8/pdftotext/ Complete output (27 lines): running bdist_wheel running build running build_ext building ‘pdftotext’ 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/romainvandelouw/anaconda/include -arch x86_64 -I/Users/romainvandelouw/anaconda/include -arch x86_64 -DPOPPLER_CPP_AT_LEAST_0_30_0=1 -I/usr/local/include -I/Users/romainvandelouw/anaconda/include/python3.6m -c pdftotext.cpp -o build/temp.macosx-10.7-x86_64-3.6/pdftotext.o -Wall -mmacosx-version-min=10.9 In file included from pdftotext.cpp:5: /Users/romainvandelouw/anaconda/include/poppler/cpp/poppler-page.h:37:22: warning: rvalue references are a C++11 extension [-Wc++11-extensions] text_box(text_box&&) = default; ^ /Users/romainvandelouw/anaconda/include/poppler/cpp/poppler-page.h:37:28: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions] text_box(text_box&&) = default; ^ /Users/romainvandelouw/anaconda/include/poppler/cpp/poppler-page.h:38:33: warning: rvalue references are a C++11 extension [-Wc++11-extensions] text_box& operator=(text_box&&) = default; ^ /Users/romainvandelouw/anaconda/include/poppler/cpp/poppler-page.h:38:39: warning: defaulted function definitions are a C++11 extension [-Wc++11-extensions] text_box& operator=(text_box&&) = default; ^ 4 warnings generated. creating build/lib.macosx-10.7-x86_64-3.6 g++ -bundle -undefined dynamic_lookup -L/Users/romainvandelouw/anaconda/lib -arch x86_64 -L/Users/romainvandelouw/anaconda/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.7-x86_64-3.6/pdftotext.o -L/usr/local/lib -lpoppler-cpp -o build/lib.macosx-10.7-x86_64-3.6/pdftotext.cpython-36m-darwin.so 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 ‘g++’ failed with exit status 1

ERROR: Failed building wheel for pdftotext`

I read in previous issues that it could be related to dependencies but Popler is installed

Warning: pkg-config 0.29.2 is already installed and up-to-date To reinstall 0.29.2, run brew reinstall pkg-configWarning: poppler 0.81.0 is already installed and up-to-date To reinstall 0.81.0, runbrew reinstall poppler`

I read #26 but in my case it doesn’t work outside the virtualenv either…

verbose_pdftotext.txt is the result of pip --verbose install pdftotext :

What am I missing ? Thanks for your help !

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (3 by maintainers)

Most upvoted comments

I’ve encountered similar issue (pip install pdftotext fails on macos mojave) but w/o mentions libstdc. Smth related to C syntax

    In file included from pdftotext.cpp:5:
    /usr/local/include/poppler/cpp/poppler-page.h:39:22: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
        text_box(text_box&&) noexcept;
                         ^
    /usr/local/include/poppler/cpp/poppler-page.h:39:25: error: expected ';' at end of declaration list
        text_box(text_box&&) noexcept;
                            ^

fixed with $ CPPFLAGS="-std=c++11" pip install pdftotext

Make sure your poppler is linked. Check using brew install -s poppler.

I’m having a similar issue on macOS Catalina 10.15.2 when trying to install via pip (no conda)

In file included from pdftotext.cpp:5:
/usr/local/include/poppler/cpp/poppler-page.h:39:22: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
    text_box(text_box&&) noexcept;
                     ^
/usr/local/include/poppler/cpp/poppler-page.h:39:25: error: expected ';' at end of declaration list
    text_box(text_box&&) noexcept;
                        ^
                        ;
/usr/local/include/poppler/cpp/poppler-page.h:40:33: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
    text_box& operator=(text_box&&) noexcept;
                                ^
/usr/local/include/poppler/cpp/poppler-page.h:40:36: error: expected ';' at end of declaration list
    text_box& operator=(text_box&&) noexcept;
                                   ^
                                   ;
2 warnings and 2 errors generated.
error: command 'xcrun' failed with exit status 1
----------------------------------------

ERROR: Command errored out with exit status 1: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/private/tmp/pip-install-xzeuee1e/pdftotext/setup.py’“'”‘; file=’“'”‘/private/tmp/pip-install-xzeuee1e/pdftotext/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/tmp/pip-record-0aeh2b1f/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.