pdfminer - ImportError: No module named pdfminer.pdfdocument

Viewed 40679

I am trying to install pdfMiner to work with CollectiveAccess. My host (pair.com) has given me the following information to help in this quest:

When compiling, it will likely be necessary to instruct the
installation to use your account space above, and not try to install
into the operating system directories. Typically, using "--
home=/usr/home/username/pdfminer" at the end of the install command should allow for that.

I followed this instruction when trying to install. The result was:

running install
running build
running build_py
running build_scripts
running install_lib
running install_scripts
changing mode of /usr/home/username/pdfminer/bin/latin2ascii.py to 755
changing mode of /usr/home/username/pdfminer/bin/pdf2txt.py to 755
changing mode of /usr/home/username/pdfminer/bin/dumppdf.py to 755
running install_egg_info
Removing /usr/home/username/pdfminer/lib/python/pdfminer-20140328.egg-info
Writing /usr/home/username/pdfminer/lib/python/pdfminer-20140328.egg-info

I don't see anything wrong with that (I'm very new to python), but when I try to run the sample command $ pdf2txt.py samples/simple1.pdf I get this error:

Traceback (most recent call last):   File "pdf2txt.py", line 3, in <module>
    from pdfminer.pdfdocument import PDFDocument ImportError: No module named pdfminer.pdfdocument

I'm running python 2.7.3. I can't install from root (shared hosting). The most recent version of pdfminer, which is 2014/03/28. I've seen some posts on similar issues ("no module named. . . " but nothing exactly the same. The proposed solutions either don't help (such as installing with sudo - not an option; specifying the path for python (which doesn't seem to be the issue), etc.).

Or is this a question for my host? (i.e., something amiss or different about their setup)

4 Answers

use this command worked for me and removed the error

pip install pdfminer.six

I have a virtual environment and I had to activate it before I did a pip3 install to have the venv see it.

source ~/venv/bin/activate
Related