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 using conda. error: no template named 'unique_ptr' in namespace 'std' #22

Closed
kelvinu opened this issue Aug 25, 2018 · 9 comments
Assignees

Comments

@kelvinu
Copy link

kelvinu commented Aug 25, 2018

I get an error on pip install pdftotext

In file included from pdftotext.cpp:5:
/usr/local/include/poppler/cpp/poppler-page.h:63:10: error: no template named 'unique_ptr' in namespace 'std'
    std::unique_ptr<text_box_data> m_data;
    ~~~~~^
1 error generated.
error: command 'gcc' failed with exit status 1
@jalan
Copy link
Owner

jalan commented Aug 27, 2018

Can you post the full output, starting from pip install pdftotext and ending where the error occurred? If there wasn't very much output, maybe pip --verbose install pdftotext would be better.

@windtalkerlv
Copy link

windtalkerlv commented Sep 4, 2018

I am experiencing the same issue, so I did the --verbose install. Here is the output

Collecting pdftotext
  1 location(s) to search for versions of pdftotext:
  * https://pypi.python.org/simple/pdftotext/
  Getting page https://pypi.python.org/simple/pdftotext/
  Looking up "https://pypi.python.org/simple/pdftotext/" in the cache
  Returning cached "301 Moved Permanently" response (ignoring date and etag information)
  Looking up "https://pypi.org/simple/pdftotext/" in the cache
  Current age based on date: 800
  Freshness lifetime from max-age: 600
  Freshness lifetime from request max-age: 600
  Starting new HTTPS connection (1): pypi.org
  "GET /simple/pdftotext/ HTTP/1.1" 304 0
  Analyzing links from page https://pypi.org/simple/pdftotext/
    Found link https://files.pythonhosted.org/packages/d2/cf/b65a7431b1c0eaa54063823d6f083ecd9a2a879646af3d243eb09bc8d0b6/pdftotext-1.0.0.tar.gz#sha256=dc645669e88f138ca4a3f7d1e32e0974d4f051da5dffbbabad7cad62dba7bfc4 (from https://pypi.org/simple/pdftotext/), version: 1.0.0
    Found link https://files.pythonhosted.org/packages/68/62/588c9a70a6c4acc6ec4fbc3c096a99032920c4965c4b231745bbd6e7d9f9/pdftotext-1.1.0.tar.gz#sha256=11536c3b91ea3fcdf9466109f304b897a4c49d25390c3ab231ec70acf6d5786d (from https://pypi.org/simple/pdftotext/), version: 1.1.0
    Found link https://files.pythonhosted.org/packages/16/e3/3b432ac931a7b360899686312145ddc9d0ce7b5ac610eba43c3920937ced/pdftotext-2.0.0.tar.gz#sha256=65b78d9c8858b1e98d6b89a6c83e6dfcdaf0bde014dca89cfe10ced7dc38fc39 (from https://pypi.org/simple/pdftotext/), version: 2.0.0
    Found link https://files.pythonhosted.org/packages/38/99/f247b4b27276f2789744900931d40e312564198a9412e653f3f1bb17def6/pdftotext-2.0.1.tar.gz#sha256=947359bde2f1d158d685414dcfb604a369f3fcee49012baf717a71816045d8ef (from https://pypi.org/simple/pdftotext/), version: 2.0.1
    Found link https://files.pythonhosted.org/packages/05/7c/67643e2c10e99f1ac27eadfd9a3d4e13b920c2e922906aad87152cdc154d/pdftotext-2.0.2.tar.gz#sha256=0b82a9fd255a3f2bf5c861cf9e3174d3c4223e1e441bb060c611dcb4e65c6cb8 (from https://pypi.org/simple/pdftotext/), version: 2.0.2
    Found link https://files.pythonhosted.org/packages/96/41/aa31f4a6809eb0574674d6c0cf6bc0e00aaf0ea53c62db8a2d9af50b7cc6/pdftotext-2.1.0.tar.gz#sha256=b7312302007e19fc784263a321b41682f01a582af84e14200cef53b3f4e69a50 (from https://pypi.org/simple/pdftotext/), version: 2.1.0
  Using version 2.1.0 (newest of versions: 1.0.0, 1.1.0, 2.0.0, 2.0.1, 2.0.2, 2.1.0)
  Looking up "https://files.pythonhosted.org/packages/96/41/aa31f4a6809eb0574674d6c0cf6bc0e00aaf0ea53c62db8a2d9af50b7cc6/pdftotext-2.1.0.tar.gz" in the cache
  Current age based on date: 1697
  Freshness lifetime from max-age: 365000000
  The response is "fresh", returning cached response
  365000000 > 1697
  Using cached https://files.pythonhosted.org/packages/96/41/aa31f4a6809eb0574674d6c0cf6bc0e00aaf0ea53c62db8a2d9af50b7cc6/pdftotext-2.1.0.tar.gz
  Downloading from URL https://files.pythonhosted.org/packages/96/41/aa31f4a6809eb0574674d6c0cf6bc0e00aaf0ea53c62db8a2d9af50b7cc6/pdftotext-2.1.0.tar.gz#sha256=b7312302007e19fc784263a321b41682f01a582af84e14200cef53b3f4e69a50 (from https://pypi.org/simple/pdftotext/)
  Running setup.py (path:/private/var/folders/dr/rb1tqvx53kgcwd66dfrvvks00000gn/T/pip-build-p43t__6r/pdftotext/setup.py) egg_info for package pdftotext
    Running command python setup.py egg_info
    running egg_info
    creating pip-egg-info/pdftotext.egg-info
    writing pip-egg-info/pdftotext.egg-info/PKG-INFO
    writing dependency_links to pip-egg-info/pdftotext.egg-info/dependency_links.txt
    writing top-level names to pip-egg-info/pdftotext.egg-info/top_level.txt
    writing manifest file 'pip-egg-info/pdftotext.egg-info/SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'pip-egg-info/pdftotext.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'pip-egg-info/pdftotext.egg-info/SOURCES.txt'
  Source in /private/var/folders/dr/rb1tqvx53kgcwd66dfrvvks00000gn/T/pip-build-p43t__6r/pdftotext has version 2.1.0, which satisfies requirement pdftotext from https://files.pythonhosted.org/packages/96/41/aa31f4a6809eb0574674d6c0cf6bc0e00aaf0ea53c62db8a2d9af50b7cc6/pdftotext-2.1.0.tar.gz#sha256=b7312302007e19fc784263a321b41682f01a582af84e14200cef53b3f4e69a50
Installing collected packages: pdftotext
  Running setup.py install for pdftotext ...     Running command /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/dr/rb1tqvx53kgcwd66dfrvvks00000gn/T/pip-build-p43t__6r/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/dr/rb1tqvx53kgcwd66dfrvvks00000gn/T/pip-jzol2wpc-record/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.6-intel-3.6
    /usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -DPOPPLER_CPP_AT_LEAST_0_30_0=1 -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pdftotext.cpp -o build/temp.macosx-10.6-intel-3.6/pdftotext.o -Wall
    In file included from pdftotext.cpp:5:
    /usr/local/include/poppler/cpp/poppler-page.h:70:10: error: no type named 'unique_ptr' in namespace 'std'
        std::unique_ptr<text_box_data> m_data;
        ~~~~~^
    /usr/local/include/poppler/cpp/poppler-page.h:70:20: error: expected member name or ';' after declaration specifiers
        std::unique_ptr<text_box_data> m_data;
        ~~~~~~~~~~~~~~~^
    2 errors generated.
    error: command '/usr/bin/clang' failed with exit status 1
error
Cleaning up...
  Removing source in /private/var/folders/dr/rb1tqvx53kgcwd66dfrvvks00000gn/T/pip-build-p43t__6r/pdftotext
Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/dr/rb1tqvx53kgcwd66dfrvvks00000gn/T/pip-build-p43t__6r/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/dr/rb1tqvx53kgcwd66dfrvvks00000gn/T/pip-jzol2wpc-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/dr/rb1tqvx53kgcwd66dfrvvks00000gn/T/pip-build-p43t__6r/pdftotext/
Exception information:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/req/req_install.py", line 878, in install
    spinner=spinner,
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/utils/__init__.py", line 707, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/dr/rb1tqvx53kgcwd66dfrvvks00000gn/T/pip-build-p43t__6r/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/dr/rb1tqvx53kgcwd66dfrvvks00000gn/T/pip-jzol2wpc-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/dr/rb1tqvx53kgcwd66dfrvvks00000gn/T/pip-build-p43t__6r/pdftotext/

@jalan
Copy link
Owner

jalan commented Sep 5, 2018

@windtalkerlv thanks for the detailed output!

creating build/temp.macosx-10.6-intel-3.6

Are you using macOS 10.6, from roughly 2009? It might be that it doesn't support some C++11 features by default. Maybe

CFLAGS="-std=c++11" pip install --verbose pdftotext

will help. Otherwise, maybe it's time to do some updates?

@windtalkerlv
Copy link

@jalan thanks for the help! I am using High Sierra 10.13.6, and I tired CFLAGS="-std=c++11" pip install --verbose pdftotext. still same problem. heres the log:

$ CFLAGS="-std=c++11" pip3 install --verbose pdftotext
Collecting pdftotext
  1 location(s) to search for versions of pdftotext:
  * https://pypi.python.org/simple/pdftotext/
  Getting page https://pypi.python.org/simple/pdftotext/
  Looking up "https://pypi.python.org/simple/pdftotext/" in the cache
  Returning cached "301 Moved Permanently" response (ignoring date and etag information)
  Looking up "https://pypi.org/simple/pdftotext/" in the cache
  Current age based on date: 36
  Freshness lifetime from max-age: 600
  Freshness lifetime from request max-age: 600
  The response is "fresh", returning cached response
  600 > 36
  Analyzing links from page https://pypi.org/simple/pdftotext/
    Found link https://files.pythonhosted.org/packages/d2/cf/b65a7431b1c0eaa54063823d6f083ecd9a2a879646af3d243eb09bc8d0b6/pdftotext-1.0.0.tar.gz#sha256=dc645669e88f138ca4a3f7d1e32e0974d4f051da5dffbbabad7cad62dba7bfc4 (from https://pypi.org/simple/pdftotext/), version: 1.0.0
    Found link https://files.pythonhosted.org/packages/68/62/588c9a70a6c4acc6ec4fbc3c096a99032920c4965c4b231745bbd6e7d9f9/pdftotext-1.1.0.tar.gz#sha256=11536c3b91ea3fcdf9466109f304b897a4c49d25390c3ab231ec70acf6d5786d (from https://pypi.org/simple/pdftotext/), version: 1.1.0
    Found link https://files.pythonhosted.org/packages/16/e3/3b432ac931a7b360899686312145ddc9d0ce7b5ac610eba43c3920937ced/pdftotext-2.0.0.tar.gz#sha256=65b78d9c8858b1e98d6b89a6c83e6dfcdaf0bde014dca89cfe10ced7dc38fc39 (from https://pypi.org/simple/pdftotext/), version: 2.0.0
    Found link https://files.pythonhosted.org/packages/38/99/f247b4b27276f2789744900931d40e312564198a9412e653f3f1bb17def6/pdftotext-2.0.1.tar.gz#sha256=947359bde2f1d158d685414dcfb604a369f3fcee49012baf717a71816045d8ef (from https://pypi.org/simple/pdftotext/), version: 2.0.1
    Found link https://files.pythonhosted.org/packages/05/7c/67643e2c10e99f1ac27eadfd9a3d4e13b920c2e922906aad87152cdc154d/pdftotext-2.0.2.tar.gz#sha256=0b82a9fd255a3f2bf5c861cf9e3174d3c4223e1e441bb060c611dcb4e65c6cb8 (from https://pypi.org/simple/pdftotext/), version: 2.0.2
    Found link https://files.pythonhosted.org/packages/96/41/aa31f4a6809eb0574674d6c0cf6bc0e00aaf0ea53c62db8a2d9af50b7cc6/pdftotext-2.1.0.tar.gz#sha256=b7312302007e19fc784263a321b41682f01a582af84e14200cef53b3f4e69a50 (from https://pypi.org/simple/pdftotext/), version: 2.1.0
  Using version 2.1.0 (newest of versions: 1.0.0, 1.1.0, 2.0.0, 2.0.1, 2.0.2, 2.1.0)
  Looking up "https://files.pythonhosted.org/packages/96/41/aa31f4a6809eb0574674d6c0cf6bc0e00aaf0ea53c62db8a2d9af50b7cc6/pdftotext-2.1.0.tar.gz" in the cache
  Current age based on date: 36
  Freshness lifetime from max-age: 365000000
  The response is "fresh", returning cached response
  365000000 > 36
  Using cached https://files.pythonhosted.org/packages/96/41/aa31f4a6809eb0574674d6c0cf6bc0e00aaf0ea53c62db8a2d9af50b7cc6/pdftotext-2.1.0.tar.gz
  Downloading from URL https://files.pythonhosted.org/packages/96/41/aa31f4a6809eb0574674d6c0cf6bc0e00aaf0ea53c62db8a2d9af50b7cc6/pdftotext-2.1.0.tar.gz#sha256=b7312302007e19fc784263a321b41682f01a582af84e14200cef53b3f4e69a50 (from https://pypi.org/simple/pdftotext/)
  Running setup.py (path:/private/var/folders/dr/rb1tqvx53kgcwd66dfrvvks00000gn/T/pip-build-3z_fud3b/pdftotext/setup.py) egg_info for package pdftotext
    Running command python setup.py egg_info
    running egg_info
    creating pip-egg-info/pdftotext.egg-info
    writing pip-egg-info/pdftotext.egg-info/PKG-INFO
    writing dependency_links to pip-egg-info/pdftotext.egg-info/dependency_links.txt
    writing top-level names to pip-egg-info/pdftotext.egg-info/top_level.txt
    writing manifest file 'pip-egg-info/pdftotext.egg-info/SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'pip-egg-info/pdftotext.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'pip-egg-info/pdftotext.egg-info/SOURCES.txt'
  Source in /private/var/folders/dr/rb1tqvx53kgcwd66dfrvvks00000gn/T/pip-build-3z_fud3b/pdftotext has version 2.1.0, which satisfies requirement pdftotext from https://files.pythonhosted.org/packages/96/41/aa31f4a6809eb0574674d6c0cf6bc0e00aaf0ea53c62db8a2d9af50b7cc6/pdftotext-2.1.0.tar.gz#sha256=b7312302007e19fc784263a321b41682f01a582af84e14200cef53b3f4e69a50
Installing collected packages: pdftotext
  Running setup.py install for pdftotext ...     Running command /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/dr/rb1tqvx53kgcwd66dfrvvks00000gn/T/pip-build-3z_fud3b/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/dr/rb1tqvx53kgcwd66dfrvvks00000gn/T/pip-r25jq0_p-record/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.6-intel-3.6
    /usr/bin/clang -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -std=c++11 -DPOPPLER_CPP_AT_LEAST_0_30_0=1 -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c pdftotext.cpp -o build/temp.macosx-10.6-intel-3.6/pdftotext.o -Wall
    In file included from pdftotext.cpp:5:
    /usr/local/include/poppler/cpp/poppler-page.h:70:10: error: no template named 'unique_ptr' in namespace 'std'
        std::unique_ptr<text_box_data> m_data;
        ~~~~~^
    1 error generated.
    error: command '/usr/bin/clang' failed with exit status 1
error
Cleaning up...
  Removing source in /private/var/folders/dr/rb1tqvx53kgcwd66dfrvvks00000gn/T/pip-build-3z_fud3b/pdftotext
Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/dr/rb1tqvx53kgcwd66dfrvvks00000gn/T/pip-build-3z_fud3b/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/dr/rb1tqvx53kgcwd66dfrvvks00000gn/T/pip-r25jq0_p-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/dr/rb1tqvx53kgcwd66dfrvvks00000gn/T/pip-build-3z_fud3b/pdftotext/
Exception information:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/req/req_install.py", line 878, in install
    spinner=spinner,
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/utils/__init__.py", line 707, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/dr/rb1tqvx53kgcwd66dfrvvks00000gn/T/pip-build-3z_fud3b/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/dr/rb1tqvx53kgcwd66dfrvvks00000gn/T/pip-r25jq0_p-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/dr/rb1tqvx53kgcwd66dfrvvks00000gn/T/pip-build-3z_fud3b/pdftotext/
You are using pip version 9.0.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

@edwardsdl
Copy link

I'm having the same problem. Did you ever find a solution?

@jalan
Copy link
Owner

jalan commented Sep 20, 2018

It looks like I'll finally have to download this anaconda stuff and give it a try, see what sort of build environment it creates. I hope to have time for it this weekend.

@jalan jalan self-assigned this Sep 20, 2018
@edwardsdl
Copy link

edwardsdl commented Sep 21, 2018

I got it working by setting MACOSX_DEPLOYMENT_TARGET. I have no idea why it matters - the installation worked great for my coworkers.

@kelvinu @windtalkerlv give this a try: MACOSX_DEPLOYMENT_TARGET=10.13 pip install -r requirements.txt (you might have to use something other than 10.13 of course).

@jalan
Copy link
Owner

jalan commented Sep 22, 2018

Thanks, @edwardsdl, that's a good lead. I'll try to find what minimum setting for MACOSX_DEPLOYMENT_TARGET allows the build to succeed in anaconda and see if I can set that automatically in setup.py.

@jalan
Copy link
Owner

jalan commented Oct 7, 2018

I added -mmacosx-version-min=10.9 to the compiler flags on macOS, which gets the C++11 features required. I pushed a new release with this change. Tested it out in anaconda on macOS and it works now.

For anyone curious, anaconda seems to be the oddball here, shipping a python distribution that builds for ancient 10.6 by default. The macOS system python2, python2 from brew, and python3 from brew all build for 10.13. 🤷‍♂️

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

4 participants