Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pdfminer - ImportError: No module named pdfminer.pdfdocument

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)

like image 443
KLL Avatar asked Mar 09 '16 23:03

KLL


1 Answers

I had an error like this:

No module named 'pdfminer.pdfinterp'; 'pdfminer' is not a package

My problem was that I had named my script pdfminer.py which for the reasons that I don't know, Python took it for the original pdfminer package files and tried to compiled it.

I renamed my script to something else, deleted all the *.pyc file and __pycache__ directory and my problem was solved.

like image 125
zoot Avatar answered Oct 18 '22 09:10

zoot