Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't install on MacOS via pip #9

Closed
sfsdfd opened this issue Dec 20, 2017 · 10 comments
Closed

Can't install on MacOS via pip #9

sfsdfd opened this issue Dec 20, 2017 · 10 comments

Comments

@sfsdfd
Copy link

sfsdfd commented Dec 20, 2017

Running pip, with or without su, on MacOS produces the following error:

Command "/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;file='/private/var/folders/cm/60_4h2mj23d_70fhqwvtjf7m0000gn/T/pip-build-bd88s9/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 /var/folders/cm/60_4h2mj23d_70fhqwvtjf7m0000gn/T/pip-eNla3s-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/cm/60_4h2mj23d_70fhqwvtjf7m0000gn/T/pip-build-bd88s9/pdftotext/

This library is DOA until the dependency issue is resolved.

@jalan
Copy link
Owner

jalan commented Dec 20, 2017

I only have linux, so we'll have to rely on Mac users like you to diagnose this and suggest a fix. The snippet you provided doesn't have much info. Perhaps pip has created, or can create, a more thorough log?

@rmharriman
Copy link

I had a similar error before using Homebrew to install poppler and pkg-config. It works fine now on MacOSX 10.11.6.

@jalan
Copy link
Owner

jalan commented Dec 20, 2017

I have added macOS instructions to the README. Thanks, @rmharriman 👍

@jalan jalan closed this as completed Dec 20, 2017
@pgg1610
Copy link

pgg1610 commented Jan 31, 2019

Hello,
In spite of using Homebrew to install pkg-config and poppler I am getting an error when pip installing the package.
` Failed building wheel for pdftotext
Running setup.py clean for pdftotext
Failed to build pdftotext
Installing collected packages: pdftotext
Running setup.py install for pdftotext ... error
Complete output from command /Users/pghaneka/miniconda3/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/_r/6hhq_8ps5118p6sqqz231j480000gq/T/pip-install-bs_fmc2s/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/var/folders/_r/6hhq_8ps5118p6sqqz231j480000gq/T/pip-record-z7no6qza/install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_ext
building 'pdftotext' extension
creating build
creating build/temp.macosx-10.7-x86_64-3.7
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/pghaneka/miniconda3/include -arch x86_64 -I/Users/pghaneka/miniconda3/include -arch x86_64 -DPOPPLER_CPP_AT_LEAST_0_30_0=1 -I/Users/pghaneka/miniconda3/include/python3.7m -c pdftotext.cpp -o build/temp.macosx-10.7-x86_64-3.7/pdftotext.o -Wall -mmacosx-version-min=10.9
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&&);
^
/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&&);
^
2 warnings generated.
creating build/lib.macosx-10.7-x86_64-3.7
g++ -bundle -undefined dynamic_lookup -L/Users/pghaneka/miniconda3/lib -arch x86_64 -L/Users/pghaneka/miniconda3/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.7-x86_64-3.7/pdftotext.o -lpoppler-cpp -o build/lib.macosx-10.7-x86_64-3.7/pdftotext.cpython-37m-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

----------------------------------------

Command "/Users/pghaneka/miniconda3/bin/python -u -c "import setuptools, tokenize;file='/private/var/folders/_r/6hhq_8ps5118p6sqqz231j480000gq/T/pip-install-bs_fmc2s/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/var/folders/_r/6hhq_8ps5118p6sqqz231j480000gq/T/pip-record-z7no6qza/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/_r/6hhq_8ps5118p6sqqz231j480000gq/T/pip-install-bs_fmc2s/pdftotext/`

@jalan
Copy link
Owner

jalan commented Jan 31, 2019

@pgg1610 Does it work if you do this first?

conda install libgcc

@shanmukh5
Copy link

@pgg1610 Does it work if you do this first?

conda install libgcc

@jalan This works for me. I faced the same issue

@vish1200
Copy link

vish1200 commented Aug 7, 2019

Hi, I'm having issues installing this via pip on my Mac. I have installed all of the dependencies in listed in the read me file. The error I get is below

Building wheels for collected packages: pdftotext
  Building wheel for pdftotext (setup.py) ... error
  ERROR: Complete output from command /Users/vishalpatel/anaconda3/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/f1/wd32_gd10q58w4bdk8t5f1540000gn/T/pip-install-_esxfiou/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/f1/wd32_gd10q58w4bdk8t5f1540000gn/T/pip-wheel-rmq22rql --python-tag cp36:
  ERROR: 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/vishalpatel/anaconda3/include -arch x86_64 -I/Users/vishalpatel/anaconda3/include -arch x86_64 -DPOPPLER_CPP_AT_LEAST_0_30_0=1 -I/usr/local/include -I/Users/vishalpatel/anaconda3/include/python3.6m -c pdftotext.cpp -o build/temp.macosx-10.7-x86_64-3.6/pdftotext.o -Wall -mmacosx-version-min=10.9
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]
  In file included from pdftotext.cpp:5:0:
  /Users/vishalpatel/anaconda3/include/poppler/cpp/poppler-page.h:37:22: error: expected ‘,’ or ‘...’ before ‘&&’ token
       text_box(text_box&&) = default;
                        ^
  /Users/vishalpatel/anaconda3/include/poppler/cpp/poppler-page.h:37:28: error: invalid constructor; you probably meant ‘poppler::text_box (const poppler::text_box&)’
       text_box(text_box&&) = default;
                              ^
  /Users/vishalpatel/anaconda3/include/poppler/cpp/poppler-page.h:38:33: error: expected ‘,’ or ‘...’ before ‘&&’ token
       text_box& operator=(text_box&&) = default;
                                   ^
  /Users/vishalpatel/anaconda3/include/poppler/cpp/poppler-page.h:63:5: error: ‘unique_ptr’ in namespace ‘std’ does not name a type
       std::unique_ptr<text_box_data> m_data;
       ^
  /Users/vishalpatel/anaconda3/include/poppler/cpp/poppler-page.h:38:15: error: defaulted declaration ‘poppler::text_box& poppler::text_box::operator=(poppler::text_box)’
       text_box& operator=(text_box&&) = default;
                 ^
  /Users/vishalpatel/anaconda3/include/poppler/cpp/poppler-page.h:38:15: error: does not match expected signature ‘poppler::text_box& poppler::text_box::operator=(poppler::text_box&)’
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pdftotext

Any idea why this is? I'm new to this so apologies if I have not provided the correct information here

@jalan
Copy link
Owner

jalan commented Aug 7, 2019

@vish1200 It looks like your anaconda build environment doesn't support C++11 by default. Can you try again with CPPFLAGS="-std=c++11" pip install pdftotext?

@dmitri-f
Copy link

dmitri-f commented Dec 17, 2019

@vish1200 It looks like your anaconda build environment doesn't support C++11 by default. Can you try again with CPPFLAGS="-std=c++11" pip install pdftotext?

Thanks, that helped me (Mac OS 10.14.6, brew)

@mvasil
Copy link

mvasil commented May 28, 2020

I faced many of the same issues mentioned above; the fixes worked for me (MacOSX 10.14.6, python 3.7):

brew install pkg-config poppler
conda install libgcc
pip install pdftotext

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants