Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have tried to install the pyPdf package by using apt-get. The package seems to have been installed in /usr/share/pyshared/. The problem is that python doesn't see the package and thus can't import it, giving me the following traceback when importing:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pyPdf

print sys.path gives the following:

['', '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload', '/home/grieverheart/.local/lib/python2.7/site-packages', '/usr/local/lib/python2.7/site-packages']

And the version reported with sys.version is 2.7.3.

Do you have any idea why this is happening and what I could do to fix it? I'm using ubuntu 13.04 btw.

share|improve this question
1  
Please include in your question the exact traceback after running the import ... statement (also include the import statement itself). Also provide the output of import sys; print sys.path; print sys.version run from a Python console (IDLE, iPython, etc.). –  gertvdijk Jul 20 '13 at 15:33
    
Should I use strace or simply post the errors? –  user1294203 Jul 20 '13 at 15:39
    
Include the Python traceback you get, by editing your question. Or any other error that support your statement "cannot import" (which is not very descriptive). strace isn't very helpful here (Python isn't native). –  gertvdijk Jul 20 '13 at 15:42
    
Thanks, I have included the traceback and the output of the two commands. Hope it helps. –  user1294203 Jul 20 '13 at 15:48
3  
I see you have installed your own Python interpreter (from the /usr/local paths). Don't do this. Use the Python that came with Ubuntu. Share how you replaced Python and perhaps I could provide you with an answer how to revert this. Reverting to the Ubuntu Python will solve your issue. It also does not make any sense to install an older 2.7 version of the one that came with Ubuntu. –  gertvdijk Jul 20 '13 at 15:54
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.