Request for assistance (hopefully not OT)
Chris Angelico
rosuav at gmail.com
Tue May 17 08:48:54 EDT 2022
On Tue, 17 May 2022 at 21:22, o1bigtenor <o1bigtenor at gmail.com> wrote:
>
> Greetings
>
> I was having space issues in my /usr directory so I deleted some
> programs thinking that the space taken was more an issue than having
> older versions of the program.
>
> So one of the programs I deleted (using rm -r) was python3.9.
> Python3.10 was already installed so I thought (naively!!!) that things
> should continue working.
> (Python 3.6, 3.7 and 3.8 were also part of this cleanup.)
Did you install Python 3.9 using apt? If so, you should definitely
have removed it using apt - if for no reason than to find out if
something's depending on it.
Generally, Linux systems have just one "system Python" that other
applications depend on. Any other installed version is completely
independent.
> So now I have problems.
>
> Following is the system barf that I get when I run '# apt upgrade'.
>
> What can I do to correct this self-inflicted problem?
>
> (running on debian testing 5.17
I presume 5.17 is the Linux kernel version? Depending on how
up-to-date your Debian Testing is, that should theoretically mean that
the system Python is 3.10, which would imply that it should have been
safe to remove 3.9... but only if you had done it with apt.
> Setting up python2.7-minimal (2.7.18-13.1) ...
> Could not find platform independent libraries <prefix>
> Could not find platform dependent libraries <exec_prefix>
> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
> /usr/bin/python2.7: can't open file
> '/usr/lib/python2.7/py_compile.py': [Errno 2] No such file or
> directory
Did you also use rm to get rid of Python 2.7?
> dpkg: error processing package python2.7-minimal (--configure):
> installed python2.7-minimal package post-installation script
> subprocess returned error exit status 2
> Setting up python3.9-minimal (3.9.12-1) ...
> update-binfmts: warning: /usr/share/binfmts/python3.9: no executable
> /usr/bin/python3.9 found, but continuing anyway as you request
> /var/lib/dpkg/info/python3.9-minimal.postinst: 51: /usr/bin/python3.9: not found
> dpkg: error processing package python3.9-minimal (--configure):
> installed python3.9-minimal package post-installation script
> subprocess returned error exit status 127
> dpkg: dependency problems prevent configuration of python3.9:
> python3.9 depends on python3.9-minimal (= 3.9.12-1); however:
> Package python3.9-minimal is not configured yet.
>
> dpkg: error processing package python3.9 (--configure):
> dependency problems - leaving unconfigured
> dpkg: dependency problems prevent configuration of python2.7:
> python2.7 depends on python2.7-minimal (= 2.7.18-13.1); however:
> Package python2.7-minimal is not configured yet.
>
> dpkg: error processing package python2.7 (--configure):
> dependency problems - leaving unconfigured
> dpkg: dependency problems prevent configuration of python3.9-dev:
> python3.9-dev depends on python3.9 (= 3.9.12-1); however:
> Package python3.9 is not configured yet.
>
> dpkg: error processing package python3.9-dev (--configure):
> dependency problems - leaving unconfigured
> . . .
> Errors were encountered while processing:
> python2.7-minimal
> python3.9-minimal
> python3.9
> python2.7
> python3.9-dev
So, yeah, you're definitely going to need to reinstate some parts of
Python to get this going.
If you can figure out which exact Python versions you need, it might
be possible to restore them manually. Download the packages from
packages.debian.org, then try to manually install them with dpkg, and
if that fails, unpack them and put the files into the right places.
It's going to be a pain. A lot of pain. And next time, use apt to
uninstall what apt installed :)
Something else to consider, though: It might not be Python that's
taking up all the space. On my system, /usr is dominated by /usr/lib
and /usr/local/lib, and while it might look like the pythonx.y
directories there are the large part, it's actually not Python itself
that's so big: it's other libraries, installed using either apt or
pip. So when you're trying to free up space, look to see whether you
have packages installed into every version of Python you have; the
largest directories in my python3.9/site-packages are scipy, plotly,
numpy, pandas, speech_recognition, matplotlib, and Cython - all great
tools, but if you have a copy for 3.9, a copy for 3.10, a copy for
3.11, etc, it adds up fast.
"Ten minutes with a hacksaw will save you thirty with a shovel"
-- Miss Pauling, discussing the art of uninstalling.... something
ChrisA
More information about the Python-list
mailing list