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.

Initially I installed Python 3.3 from source, but then I removed and deleted the directory /usr/lib/python3.3.

When I am installing it using aptitude, I am getting this error.

Unpacking python3.3 (from .../python3.3_3.3.1-1ubuntu5_i386.deb) ...
Processing triggers for man-db ...
Processing triggers for bamfdaemon ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for desktop-file-utils ...
Setting up python3.3 (3.3.1-1ubuntu5) ...
python3.3: can't open file '/usr/lib/python3.3/py_compile.py': [Errno 2] No such file or directory
dpkg: error processing python3.3 (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 python3.3
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
Setting up python3.3 (3.3.1-1ubuntu5) ...
python3.3: can't open file '/usr/lib/python3.3/py_compile.py': [Errno 2] No such file or directory
dpkg: error processing python3.3 (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:

Any idea how to rectify the error?

share|improve this question
add comment

migrated from programmers.stackexchange.com Aug 26 '13 at 11:16

This question came from our site for professional programmers interested in conceptual questions about software development.

3 Answers

You've destroyed the libpython3.3-minimal package in that removal. Reinstall it, than try installing python3.3 again. If you have other packages installed that depend on libpython3.3-minimal, they may need to be reinstalled too.

Note: For next time, manually installed software should go in /usr/local or /opt, never to /usr directly. That avoids conflict between manually installed files and packages, because all packages are installed to /usr.

share|improve this answer
    
+1. Never touch system files in /usr directly! –  gertvdijk Aug 26 '13 at 20:28
    
While the diagnosis is not false, the recommend action does not address the OP's problem. He actually tries to install python3.3 again, but he can't. –  JoBo Aug 27 '13 at 8:10
    
@JoBo: The suggestion says "Reinstall libpython3.3-minimal". That solves the current OP's problem. I added the paragraph about where manual installations should go based on qertvdijk's comment. –  Jan Hudec Aug 27 '13 at 8:22
    
Yeah, you're right, you say "Reinstall it", I just read "try installing python 3.3 again". :) ...but the OP probably broke more than just libpython3.3-minimal. It is just the package whose file happens to trigger the error message while installing python3.3. We can't assume that other packages are not affected. –  JoBo Aug 27 '13 at 8:26
    
@JoBo: well, he does not have python3.3 installed, so he can't have anything that depends on it installed either. –  Jan Hudec Aug 27 '13 at 9:26
show 3 more comments

Since you have 'destroyed' parts of you Python install---as Jan Hudec points out---installing python3.3 fails because dpkg thinks other packages are still there. Check for the packages that were affected by your action:

# dpkg -S /usr/lib/python3.3/
python3-gdbm:i386, python3.3, libpython3.3-minimal:i386, libpython3.3-stdlib:i386, libpython3.3:i386: /usr/lib/python3.3

And reinstall explicitly all packages that provides files under that directory. This will ensure that the file /usr/lib/python3.3/py_compile.py and others that are pre-depends will be there at the right time during install and that any files that are affected by your action get repaired.

Note: Your output from above command may differ, adjust the following accordingly.

# aptitude reinstall python3-gdbm python3.3 libpython3.3-minimal libpython3.3-stdlib libpython3.3
share|improve this answer
add comment

To install python version 3.3.2 here are the steps I followed and it worked

wget http://python.org/ftp/python/3.3.2/Python-3.3.2.tar.bz2

tar -xvjf ./Python-3.3.2.tar.bz2

cd ./Python-3.3.2

./configure --prefix=/opt/python3.3

make && make install

mkdir ~/bin

ln -s /opt/python3.3/bin/python ~/bin/py

echo 'alias py="/opt/python3.3/bin/python3"' >> .bashrc
share|improve this answer
    
+1 for using /opt as target –  JoBo Aug 27 '13 at 7:21
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.