12

I work on project in pycharm , i'd like to use pdfminer in order to convert a pdf file to a text file. My problem is when i run the app i't doesn't work and it display this error message : ModuleNotFoundError: No module named 'pdfminer.high_level'

import re
from pdfminer.high_level import extract_pages, extract_text

text = extract_text("_DarkWeb_1642453520.pdf")
print(text)

the full error message:

 /home/oran/PycharmProjects/pythonProject/venv/bin/python /home/oran/PycharmProjects/pythonProject/main.py 
Traceback (most recent call last):
  File "/home/oran/PycharmProjects/pythonProject/main.py", line 2, in <module>
    from pdfminer.high_level import extract_pages, extract_text
ModuleNotFoundError: No module named 'pdfminer.high_level'


python version 3.10.4

oran ben david
  • 119
  • 1
  • 1
  • 5
  • You should always let people know what version of Python you are using at a mimimum. If I see a message like you got the first thing I would do is try to install the module. – MJMacarty Sep 23 '22 at 19:11
  • hi , my python version is 3.10.4 – oran ben david Sep 24 '22 at 06:42
  • I got this from another Stackoverflow question and it worked for me : "In order to use pdfminer.high_level, you will need to run pip3 install pdfminer.six. Then in order to use the package in your code, you will need to add the line import pdfminer.high_level after your import pdfminer line. This is because Python does not automatically import subpackages by default." – jvqp Nov 08 '22 at 17:18

1 Answers1

21

I suppose that you installed only pdfminer which is not maintained anymore.

To import the module pdfminer.high_level, you should go for pdfminer.six instead by first running this command from your terminal :

pip install pdfminer.six

If you use a virtual environement, use the dash instead of the dot.

pip install pdfminer-six
Timeless
  • 22,580
  • 4
  • 12
  • 30