Deleted python3.10 from /usr/bin

GoodBetterBest

Supremacy Member
Joined
Jan 23, 2019
Messages
6,239
Reaction score
2,119
Hi !

I'm using WSL Ubuntu.
I've tried to unlink python3 from python3.8 but mistakenly delete python3.10.
Now my /usr/bin does not have python3.10.

I've tried to just install:
sudo apt-get install --reinstall python3
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 173 not upgraded.
1 not fully installed or removed.
Need to get 47.6 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 python3 amd64 3.8.2-0ubuntu2 [47.6 kB]
Fetched 47.6 kB in 1s (40.7 kB/s)
(Reading database ... 145732 files and directories currently installed.)
Preparing to unpack .../python3_3.8.2-0ubuntu2_amd64.deb ...
running python pre-rtupdate hooks for python3.8...
Unpacking python3 (3.8.2-0ubuntu2) over (3.8.2-0ubuntu2) ...
Setting up python3.10 (3.10.1-1+focal2) ...
/var/lib/dpkg/info/python3.10.postinst: 9: /usr/bin/python3.10: not found
dpkg: error processing package python3.10 (--configure):
installed python3.10 package post-installation script subprocess returned error exit status 127
Setting up python3 (3.8.2-0ubuntu2) ...
running python rtupdate hooks for python3.8...
running python post-rtupdate hooks for python3.8...
Processing triggers for man-db (2.9.1-1) ...
Errors were encountered while processing:
python3.10
E: Sub-process /usr/bin/dpkg returned an error code (1)


I've tried to install:

Reading package lists... Done
Building dependency tree
Reading state information... Done
python3 is already the newest version (3.8.2-0ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 173 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up python3.10 (3.10.1-1+focal2) ...
/var/lib/dpkg/info/python3.10.postinst: 9: /usr/bin/python3.10: not found
dpkg: error processing package python3.10 (--configure):
installed python3.10 package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
python3.10
E: Sub-process /usr/bin/dpkg returned an error code (1)


Last time, I accidentally deleted from /usr/bin, my colleague told me to copy from somewhere. Is the file in /usr/bin stored somewhere ?

Thanks.
 

GoodBetterBest

Supremacy Member
Joined
Jan 23, 2019
Messages
6,239
Reaction score
2,119
I've recovered the file. I boot up my ubuntu on VirtualBox and install python3.10, then copy over the file.
Thanks.
 

GoodBetterBest

Supremacy Member
Joined
Jan 23, 2019
Messages
6,239
Reaction score
2,119

Discussion purpose:

The problem I had was a mistake. I deleted the bin when trying to unlink it (which I didn't expect unlink can do !). In the office env, I won't be able to issue sudo the method not suitable for non administrator.

In python, they provide a way to handle multiple version of python and packages with pipenv to create virtual environments. I think Anaconda also can but I don't use.

We can have a Python2 and a Python3 environment for different app, or different numpy/pandas/etc.

Thanks again. Greatly appreciated. :)
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,547
Reaction score
1,301
Discussion purpose:

The problem I had was a mistake. I deleted the bin when trying to unlink it (which I didn't expect unlink can do !). In the office env, I won't be able to issue sudo the method not suitable for non administrator.

In python, they provide a way to handle multiple version of python and packages with pipenv to create virtual environments. I think Anaconda also can but I don't use.

We can have a Python2 and a Python3 environment for different app, or different numpy/pandas/etc.

Thanks again. Greatly appreciated. :)

What I meant is you shouldn’t even attempt to meddle with the system wide installation in that manner.

The community has adopted certain approaches in dealing with versioning and installation for different distros. Even if python has no virtual env, it is often not the wise choice to unlink or delete stuffs from /usr/bin, /bin, /usr/sbin, /sbin, because it can often break other utilities that may be dependencies on it.
 
Important Forum Advisory Note
This forum is moderated by volunteer moderators who will react only to members' feedback on posts. Moderators are not employees or representatives of HWZ Forums. Forum members and moderators are responsible for their own posts. Please refer to our Community Guidelines and Standards and Terms and Conditions for more information.
Top