deadsnakes / issues

Issues for https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa
86 stars 6 forks source link

typing.py / sysconfigdata upgrade conflicts (3.6+) #207

Closed albertyw closed 2 years ago

albertyw commented 2 years ago

EDIT BY ASOTTILE

I synced python3.6+ with debian recently, the files packaged moved around a bit to reduce differences with upstream

to fix this you'll need to uninstall and reinstall. the easiest way to do the uninstall:

(read the output carefully to verify what you're removing first!)

sudo apt --fix-missing purge 'python3.10*' 'libpython3.10*'

then you should be able to install as normal


description

libpython3.10-minimal and libpython3.10-stdlib fails during aptitude installation:

$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  libpython3.10-minimal libpython3.10-stdlib
The following packages will be upgraded:
  libpython3.10-minimal libpython3.10-stdlib
2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
16 not fully installed or removed.
Need to get 0 B/2,543 kB of archives.
After this operation, 64.5 kB disk space will be freed.
Do you want to continue? [Y/n]
Setting up systemd-timesyncd (245.4-4ubuntu3.16) ...
Setting up systemd (245.4-4ubuntu3.16) ...
(Reading database ... 133119 files and directories currently installed.)
Preparing to unpack .../libpython3.10-stdlib_3.10.4-1+focal2_arm64.deb ...
Unpacking libpython3.10-stdlib:arm64 (3.10.4-1+focal2) over (3.10.4-1+focal1) ...
dpkg: error processing archive /var/cache/apt/archives/libpython3.10-stdlib_3.10.4-1+focal2_arm64.deb (--unpack):
 trying to overwrite '/usr/lib/python3.10/_sysconfigdata__linux_aarch64-linux-gnu.py', which is also in package libpython3.10-minimal:arm64 3.10.4-1+focal1
Preparing to unpack .../libpython3.10-minimal_3.10.4-1+focal2_arm64.deb ...
Unpacking libpython3.10-minimal:arm64 (3.10.4-1+focal2) over (3.10.4-1+focal1) ...
dpkg: error processing archive /var/cache/apt/archives/libpython3.10-minimal_3.10.4-1+focal2_arm64.deb (--unpack):
 trying to overwrite '/usr/lib/python3.10/typing.py', which is also in package libpython3.10-stdlib:arm64 3.10.4-1+focal1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/libpython3.10-stdlib_3.10.4-1+focal2_arm64.deb
 /var/cache/apt/archives/libpython3.10-minimal_3.10.4-1+focal2_arm64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

This looks similar to #136. Also relevant (with a workaround solution): #98

os information

lsb_release -a

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.4 LTS
Release:    20.04
Codename:   focal

uname -a

The above is from

Linux personal 5.4.0-107-generic #121-Ubuntu SMP Thu Mar 24 16:07:22 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

I also get a similar error for:

Linux albertyw-server 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
asottile commented 2 years ago

yeah this is just an unfortunate one-time thing -- to avoid future conflicts I re-synced with debian's packaging which means a few files moved around. an apt install -yf should fix things

albertyw commented 2 years ago

I'm getting the same error when running your command (--fix-broken and typing Y to continue should be equivalent to -yf)?

asottile commented 2 years ago

a heavier hammer may be to:

sudo apt --fix-broken purge (all the packages which conflict)
sudo apt --fix-broken install
albertyw commented 2 years ago

I had to purge dependencies too in order for apt to be happy:

sudo apt purge libpython3.10-minimal libpython3.10-stdlib libpython3.10 libpython3.10-dev python3.10 python3.10-minimal python3.10-dev python3.10-venv
sudo apt install python3.10

And now it works. Thanks @asottile !

asottile commented 2 years ago

nice!

craigmaloney commented 2 years ago

None of the above worked for me. I'm in a strange state with my dependencies:

root@lister:~# apt purge --fix-broken libpython3.10-minimal libpython3.10-stdlib python3.10 python3.10-minimal 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 python3.10-venv : Depends: python3.10 (= 3.10.4-1+bionic2) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
root@lister:~# apt purge --fix-broken libpython3.10-minimal libpython3.10-stdlib libpython3.10 libpython3.10-dev python3.10 python3.10-minimal python3.10-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'libpython3.10' is not installed, so not removed
Package 'libpython3.10-dev' is not installed, so not removed
Package 'python3.10-dev' is not installed, so not removed
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 python3.10-venv : Depends: python3.10 (= 3.10.4-1+bionic2) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
root@lister:~# apt install --fix-broken libpython3.10-minimal libpython3.10-stdlib libpython3.10 libpython3.10-dev python3.10 python3.10-minimal python3.10-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3.10 is already the newest version (3.10.4-1+bionic2).
python3.10-minimal is already the newest version (3.10.4-1+bionic2).
python3.10-minimal set to manually installed.
The following NEW packages will be installed:
  libpython3.10 libpython3.10-dev python3.10-dev
The following packages will be upgraded:
  libpython3.10-minimal libpython3.10-stdlib
2 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
8 not fully installed or removed.
Need to get 54.2 MB/56.8 MB of archives.
After this operation, 80.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic/main amd64 libpython3.10 amd64 3.10.4-1+bionic2 [1,762 kB]
Get:2 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic/main amd64 libpython3.10-dev amd64 3.10.4-1+bionic2 [52.0 MB]
Get:3 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic/main amd64 python3.10-dev amd64 3.10.4-1+bionic2 [501 kB]
Fetched 54.2 MB in 5s (10.0 MB/s)                   
(Reading database ... 494680 files and directories currently installed.)
Preparing to unpack .../libpython3.10-stdlib_3.10.4-1+bionic2_amd64.deb ...
Unpacking libpython3.10-stdlib:amd64 (3.10.4-1+bionic2) over (3.10.4-1+bionic1) ...
dpkg: error processing archive /var/cache/apt/archives/libpython3.10-stdlib_3.10.4-1+bionic2_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/python3.10/_sysconfigdata__linux_x86_64-linux-gnu.py', which is also in package libpython3.10-minimal:amd64 3.10.4-1+bionic1
Preparing to unpack .../libpython3.10-minimal_3.10.4-1+bionic2_amd64.deb ...
Unpacking libpython3.10-minimal:amd64 (3.10.4-1+bionic2) over (3.10.4-1+bionic1) ...
dpkg: error processing archive /var/cache/apt/archives/libpython3.10-minimal_3.10.4-1+bionic2_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/python3.10/typing.py', which is also in package libpython3.10-stdlib:amd64 3.10.4-1+bionic1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Selecting previously unselected package libpython3.10:amd64.
Preparing to unpack .../libpython3.10_3.10.4-1+bionic2_amd64.deb ...
Unpacking libpython3.10:amd64 (3.10.4-1+bionic2) ...
Selecting previously unselected package libpython3.10-dev:amd64.
Preparing to unpack .../libpython3.10-dev_3.10.4-1+bionic2_amd64.deb ...
Unpacking libpython3.10-dev:amd64 (3.10.4-1+bionic2) ...
Selecting previously unselected package python3.10-dev.
Preparing to unpack .../python3.10-dev_3.10.4-1+bionic2_amd64.deb ...
Unpacking python3.10-dev (3.10.4-1+bionic2) ...
Errors were encountered while processing:
 /var/cache/apt/archives/libpython3.10-stdlib_3.10.4-1+bionic2_amd64.deb
 /var/cache/apt/archives/libpython3.10-minimal_3.10.4-1+bionic2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@lister:~# 
craigmaloney commented 2 years ago

I was able to finally get it to purge, but unfortunately reinstalling didn't work:

root@lister:~# apt purge python3.10 libpython3.10 libpython3.10-dev python3.10-dev python3.10-minimal python3.10-venv
Reading package lists... Done                       
Building dependency tree     
Reading state information... Done
The following packages were automatically installed and are no longer required:
  python3.10-distutils python3.10-lib2to3                                      
Use 'apt autoremove' to remove them.     
The following packages will be REMOVED:
  libpython3.10* libpython3.10-dev* python3.10* python3.10-dev* python3.10-minimal* python3.10-venv*
0 upgraded, 0 newly installed, 6 to remove and 2 not upgraded.                                 
11 not fully installed or removed.
After this operation, 89.5 MB disk space will be freed.
Do you want to continue? [Y/n] y             
(Reading database ... 494880 files and directories currently installed.)      
Removing python3.10-dev (3.10.4-1+bionic2) ...
Removing libpython3.10-dev:amd64 (3.10.4-1+bionic2) ...
Removing libpython3.10:amd64 (3.10.4-1+bionic2) ...           
Removing python3.10-venv (3.10.4-1+bionic2) ...
Removing python3.10 (3.10.4-1+bionic2) ...                          
Removing python3.10-minimal (3.10.4-1+bionic2) ...
Setting up liblzma5:i386 (5.2.2-1.3ubuntu0.1) ...                       
Setting up python3.10-lib2to3 (3.10.4-1+bionic2) ...                         
Setting up xz-utils (5.2.2-1.3ubuntu0.1) ...                                       
Setting up liblzma-dev:amd64 (5.2.2-1.3ubuntu0.1) ...                                                                    
Setting up python3.10-distutils (3.10.4-1+bionic2) ...                                                                                                     
Processing triggers for desktop-file-utils (0.23-1ubuntu3.18.04.2) ...        
Processing triggers for install-info (6.5.0.dfsg.1-2) ...                           
install-info: warning: no info dir entry in `/usr/share/info/ocaml.info.hocaml.info.hind.gz'                              
install-info: warning: no info dir entry in `/usr/share/info/ocaml.info.haux.gz'                                          
install-info: warning: no info dir entry in `/usr/share/info/ocaml.info.hocaml.info.kwd.hind.gz'
Processing triggers for libc-bin (2.27-3ubuntu1.5) ...     
/sbin/ldconfig.real: /usr/local/lib/libguile-3.0.so.1.4.0-gdb.scm is not an ELF file - it has the wrong magic bytes at the start.

Processing triggers for man-db (2.8.3-2ubuntu0.1) ...       
Processing triggers for gnome-menus (3.13.3-11ubuntu1.1) ...          
Processing triggers for mime-support (3.60ubuntu1) ...
(Reading database ... 494644 files and directories currently installed.)
Purging configuration files for python3.10-venv (3.10.4-1+bionic2) ...    
dpkg: warning: while removing python3.10-venv, directory '/usr/lib/python3.10/ensurepip/_bundled' not empty so not removed
Purging configuration files for python3.10-minimal (3.10.4-1+bionic2) ...
root@lister:~# rm -rf /usr/lib/python3.10/ensurepip/_bundled
root@lister:~# apt install python3.10 python3.10-dev
Reading package lists... Done
Building dependency tree         
Reading state information... Done                                              
The following packages were automatically installed and are no longer required:
  python3.10-distutils python3.10-lib2to3
Use 'apt autoremove' to remove them.   
The following additional packages will be installed:                                                
  libpython3.10 libpython3.10-dev libpython3.10-minimal libpython3.10-stdlib python3.10-minimal
Suggested packages:               
  python3.10-venv                                      
The following NEW packages will be installed:
  libpython3.10 libpython3.10-dev python3.10 python3.10-dev python3.10-minimal
The following packages will be upgraded:      
  libpython3.10-minimal libpython3.10-stdlib           
2 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/59.3 MB of archives.           
After this operation, 86.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y                  
(Reading database ... 494644 files and directories currently installed.)
Preparing to unpack .../0-libpython3.10-stdlib_3.10.4-1+bionic2_amd64.deb ...
Unpacking libpython3.10-stdlib:amd64 (3.10.4-1+bionic2) over (3.10.4-1+bionic1) ...
dpkg: error processing archive /tmp/apt-dpkg-install-lypqeF/0-libpython3.10-stdlib_3.10.4-1+bionic2_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/python3.10/_sysconfigdata__linux_x86_64-linux-gnu.py', which is also in package libpython3.10-minimal:amd64 3.10.4-1+bionic1
Preparing to unpack .../1-libpython3.10-minimal_3.10.4-1+bionic2_amd64.deb ...
Unpacking libpython3.10-minimal:amd64 (3.10.4-1+bionic2) over (3.10.4-1+bionic1) ...
dpkg: error processing archive /tmp/apt-dpkg-install-lypqeF/1-libpython3.10-minimal_3.10.4-1+bionic2_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/python3.10/typing.py', which is also in package libpython3.10-stdlib:amd64 3.10.4-1+bionic1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)                            
Selecting previously unselected package python3.10-minimal.
Preparing to unpack .../2-python3.10-minimal_3.10.4-1+bionic2_amd64.deb ...                                                      
Unpacking python3.10-minimal (3.10.4-1+bionic2) ...
Selecting previously unselected package libpython3.10:amd64.
Preparing to unpack .../3-libpython3.10_3.10.4-1+bionic2_amd64.deb ...
Unpacking libpython3.10:amd64 (3.10.4-1+bionic2) ...  
Selecting previously unselected package libpython3.10-dev:amd64.        
Preparing to unpack .../4-libpython3.10-dev_3.10.4-1+bionic2_amd64.deb ...
Unpacking libpython3.10-dev:amd64 (3.10.4-1+bionic2) ...                                                                  
Selecting previously unselected package python3.10.                      
Preparing to unpack .../5-python3.10_3.10.4-1+bionic2_amd64.deb ...
Unpacking python3.10 (3.10.4-1+bionic2) ...
Selecting previously unselected package python3.10-dev.
Preparing to unpack .../6-python3.10-dev_3.10.4-1+bionic2_amd64.deb ...
Unpacking python3.10-dev (3.10.4-1+bionic2) ...
Errors were encountered while processing:                                      
 /tmp/apt-dpkg-install-lypqeF/0-libpython3.10-stdlib_3.10.4-1+bionic2_amd64.deb
 /tmp/apt-dpkg-install-lypqeF/1-libpython3.10-minimal_3.10.4-1+bionic2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@lister:~#  
craigmaloney commented 2 years ago

Cleared apt's cache. Still not allowing me to install on this machine.

asottile commented 2 years ago

perhaps you have more dependent packages -- try this?

(read the output carefully to verify what you're removing first!)

sudo apt --fix-missing purge $(dpkg -l | grep 'python3\.10' | awk '{print $2}')
craigmaloney commented 2 years ago

I had two stragglers:

apt purge python3.10-distutils python3.10-lib2to3

Once I got rid of them it installed cleanly.

Thanks!

Zeebrow commented 2 years ago

apt purge also worked for the same issue I had with 3.11.0~a7.

asottile commented 2 years ago

I've updated the original post with instructions that should work for either 3.10 or 3.11

zgoda commented 2 years ago

This also works for issue with overwriting /usr/lib/python3.7/distutils/__init__.py in both old python3.7-distutils and new libpython3.7-stdlib when updating to 3.7.13-1+focal3

UncleOwen commented 2 years ago

Couldn't this be prevented with a well-placed "Breaks: " line?

Breaks should be used when moving a file from one package to another (see Overwriting files and replacing packages - Replaces),

Debian Policy Manual

asottile commented 2 years ago

that doesn't quite work when it's a dependency as well and you don't realize until after the fact and the files are symlinks -- all three are relevant here

5cotts commented 2 years ago

Chiming in to say that this happened to me today and the below command solved the issue šŸ™ŒšŸ».

sudo apt --fix-missing purge 'python3.10*' 'libpython3.10*'

Then I did sudo apt install python3.10 and everything seems fine now.

My system info:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.6 LTS
Release:    18.04
Codename:   bionic

$ uname -a
Linux cortana 5.4.0-109-generic #123~18.04.1-Ubuntu SMP Fri Apr 8 09:48:52 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Morgan-iv commented 2 years ago

I had two stragglers:

apt purge python3.10-distutils python3.10-lib2to3

Once I got rid of them it installed cleanly.

Thanks!

I've tried to run apt purge on my blocking packages, but still got problems. Can someone help?

$ apt purge python3.7-distutils python3.7-lib2to3
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libpython3.7 : Depends: libpython3.7-stdlib (= 3.7.13-1+focal3) but 3.7.13-1+focal1 is to be installed
 libpython3.7-dev : Depends: libpython3.7-stdlib (= 3.7.13-1+focal3) but 3.7.13-1+focal1 is to be installed
 libpython3.7-stdlib : Depends: libpython3.7-minimal (= 3.7.13-1+focal1) but 3.7.13-1+focal3 is to be installed
 python3.7 : Depends: libpython3.7-stdlib (= 3.7.13-1+focal3) but 3.7.13-1+focal1 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
asottile commented 2 years ago

@Morgan-iv see the instructions in the original post