Symbol not found in flat namespace

See original GitHub issue

Hi all. I’m getting this error when trying to import pdftotext in a flask project and cannot figure out how to resolve it.

ImportError: dlopen(/Users/casey/PycharmProjects/virtual environments/oadoi/lib/python3.9/site-packages/pdftotext.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace '__ZN7poppler24set_debug_error_functionEPFvRKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPvES9_'

My installation details are:

  • Mac M1
  • pdftotext version 2.1.5
  • Installed poppler with homebrew, set to version 22.04.0
  • Ensured poppler visible to pdftotext by setting these environment variables in my shell:
export LDFLAGS="-L/opt/homebrew/opt/openssl/lib -L/opt/homebrew/lib $LDFLAGS"
export CPPFLAGS="-I/opt/homebrew/opt/openssl/include -I/opt/homebrew/include $CPPFLAGS"

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
caseydmcommented, May 12, 2022

That worked! Thank you so much.

0reactions
jalancommented, May 11, 2022

I wonder if there’s some conflict between the things you installed via brew and the things you have installed otherwise. I would suggest first trying to see if you can get it all to work with only brew, on the command line, without a separately installed copy of Python and without PyCharm.

If you’re willing to give it a try, here’s how (as best I can remember):

  • uninstall the Python you have
  • install everything via homebrew in a new terminal. Make sure you aren’t in any virtualenv when you do this: brew install pkg-config poppler python3 virtualenv
  • check to make sure the right python3 is being found: which python3
  • create a new virtualenv on the command line, pointed to that Python install. Something like python3 -m venv test_venv
  • activate that env: source test_env/bin/activate
  • pip install pdftotext
  • test if it works: python -c 'import pdftotext'

If it works, you can then configure PyCharm to point to that existing virtual environment.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What does "Symbol not found / Expected in: flat namespace ...
Symbol not found means the definition of the declared function or variable was not found. When a header file of a ...
Read more >
symbol not found in flat namespace (protobuf 3.20.2) · Issue ...
Same: macOS 12.6, Python 3.10.6, protobuf==3.20.2 and Mac M1. For me, I am not using even using Protobuf, but one of the dependencies...
Read more >
symbol not found in flat namespace '_FT_Done_Face'
The reason is that reportlab is not able to find freetype library which render fonts. Solution. Force pip to build reportlab package again...
Read more >
Symbol Not Found Error: Tensorflow Metal for Apple M1
... Expected in: flat namespace. I have seen similar issues reported related to the "Symbol not found: " portion of the traceback, but...
Read more >
[reportlab-users] Symbol not found in flat namespace when ...
[reportlab-users] Symbol not found in flat namespace when running on macOS ... I suspect freetype should be listed there as a load command,...
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