jalan / pdftotext

Simple PDF text extraction
MIT License
870 stars 99 forks source link

Symbol not found in flat namespace #100

Closed caseydm closed 2 years ago

caseydm commented 2 years ago

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:

jalan commented 2 years ago

Newer versions are more likely to work in your environment. Try again with the latest version.

https://github.com/jalan/pdftotext/blob/master/CHANGES.md

caseydm commented 2 years ago

Ok thank you!

caseydm commented 2 years ago

Hi reopening because I initially thought the latest release worked. But I am getting the same error with 2.2.2. My python version is 3.9.5.

jalan commented 2 years ago

Can you provide full details of your setup?

I don't have a mac to do any testing, but all tests are passing in CI on macOS 10.15 and 11 with Python 2.7-3.10.

caseydm commented 2 years ago

Sure! Here are the details:

Of note I tried to install on a Macbook Pro with similar config and got the same error message. Thank you for any help!

jalan commented 2 years ago

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

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

caseydm commented 2 years ago

That worked! Thank you so much.

gree2 commented 5 months ago

(docs) ai@learn % pip freeze | grep pdftotext ~ pdftotext==2.2.2 (docs) ai@learn % python -c 'import pdftotext' ~ Traceback (most recent call last): File "", line 1, in ImportError: dlopen(/Users/ai/opt/anaconda3/envs/docs/lib/python3.10/site-packages/pdftotext.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '__ZN7poppler24set_debug_error_functionEPFvRKNSt3__112basic_stringIcNS0_11char_traitsIcEENS09allocatorIcEEEEPvES9' (docs) ai@learn [1] %

M2 macOS

dmitry-viskov commented 4 months ago

hi there! Faced with the same issue with M3 MacOS:

$ python
Python 3.12.4 (main, Jun 26 2024, 14:44:41) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pdftotext
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/dmitry/.pyenv/versions/ag-venv/lib/python3.12/site-packages/pdftotext.cpython-312-darwin.so, 0x0002): symbol not found in flat namespace '__ZN7poppler24set_debug_error_functionEPFvRKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPvES9_'

Tried this using python from brew and python from pyenv

jalan commented 4 months ago

Did you follow the steps in https://github.com/jalan/pdftotext/issues/100#issuecomment-1124001193 ?

Since there's about 9000 ways to install python and set up virtual envs and install libs and install packages, without knowing the details of your particular setup, I can't do much.