Python Forum
I think I messed up python....
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I think I messed up python....
#1
I was doing some stuff and installing some new web-site on my ubuntu dedicated server when one website was asking for php7.1 and up mine is 7.0.3.x so I went to update it. At firts it was saying to put that command: sudo add-apt-repository ppa:ondrej/php. When I done that it was saying an error saying apt-add-repository not found I search and found something and now it was saying apt_pkg so things goes up and I make some moedification some apt-get isntall / remouve finaly my python get messed up like a stupid guy I tyoe sudo apt-get purge python3 and deleted python file location and tried to reinstall it. I think my python 2.7 is fine but now the python3 is very messed up like when I tried to add software-properties or remove python3 stuff its just give me this all the time:

root@ns544936:~# sudo add-apt-repository ppa:ondrej/php
Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 11, in <module>
    from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
ImportError: No module named softwareproperties.SoftwareProperties
root@ns544936:~# sudo apt-get install --reinstall python3-software-properties
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libapparmor-perl libcgi-fast-perl libcgi-pm-perl libevent-core-2.0-5
  libfcgi-perl libhtml-template-perl mysql-server-core-5.7 powermgmt-base
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 1 not upgraded.
20 not fully installed or removed.
Need to get 8,710 B of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://ubuntu.mirrors.ovh.net/ubuntu xenial/main amd64 python3 amd64 3.5.1-3 [8,710 B]
Fetched 8,710 B in 0s (14.5 kB/s)
E: Internal Error, No file name for python3-software-properties:amd64
root@ns544936:~# sudo apt-get install  python3-software-properties
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-software-properties is already the newest version (0.96.20.8).
The following packages were automatically installed and are no longer required:
  libapparmor-perl libcgi-fast-perl libcgi-pm-perl libevent-core-2.0-5
  libfcgi-perl libhtml-template-perl mysql-server-core-5.7 powermgmt-base
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
20 not fully installed or removed.
Need to get 0 B/8,710 B of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
dpkg: error processing package python3 (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
dpkg: dependency problems prevent configuration of lsb-release:
 lsb-release depends on python3:any (>= 3.4~); however:
  Package python3 is not configured yet.

dpkg: error processing package lsb-release (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-apt:
 python3-apt depends on python3 (<< 3.6); however:
  Package python3 is not configured yet.
 python3-apt depends on python3 (>= 3.5~); however:
  Package python3 is not configured yet.

dpkg: error processing package python3-apt (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-dbus:
 python3-dbus depends on python3 (<< 3.6); however:
  Package python3 is not configured yet.
 python3-dbus depends on python3 (>= 3.5~); however:
  Package python3 is not configured yet.

dpkg: error processing package python3-dbus (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-gi:
 python3-gi depends on python3 (<< 3.6); however:
  Package python3 is not configured yet.
 python3-gi depends on python3 (>= 3.5~); however:
  Package python3 is not configured yet.

dpkg: error processing package python3-gi (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-pkg-resources:
 python3-pkg-resources depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.

dpkg: error processing package python3-pkg-resources (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-chardet:
 python3-chardet depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.
 python3-chardet depends on python3-pkg-resources; however:
  Package python3-pkg-resources is not configured yet.

dpkg: error processing package python3-chardet (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-six:
 python3-six depends on python3:any (>= 3.4~); however:
  Package python3 is not configured yet.

dpkg: error processing package python3-six (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-debian:
 python3-debian depends on python3-chardet; however:
  Package python3-chardet is not configured yet.
 python3-debian depends on python3-six (>> 1.4~); however:
  Package python3-six is not configured yet.
 python3-debian depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.

dpkg: error processing package python3-debian (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-pip:
 python3-pip depends on python3:any (>= 3.4~); however:
  Package python3 is not configured yet.

dpkg: error processing package python3-pip (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-pycurl:
 python3-pycurl depends on python3 (<< 3.6); however:
  Package python3 is not configured yet.
 python3-pycurl depends on python3 (>= 3.5~); however:
  Package python3 is not configured yet.

dpkg: error processing package python3-pycurl (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-pytoml:
 python3-pytoml depends on python3:any (>= 3.4~); however:
  Package python3 is not configured yet.

dpkg: error processing package python3-pytoml (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-urllib3:
 python3-urllib3 depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.
 python3-urllib3 depends on python3-six; however:
  Package python3-six is not configured yet.

dpkg: error processing package python3-urllib3 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-requests:
 python3-requests depends on python3-urllib3 (>= 1.13.1); however:
  Package python3-urllib3 is not configured yet.
 python3-requests depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.
 python3-requests depends on python3-chardet; however:
  Package python3-chardet is not configured yet.
 python3-requests depends on python3-urllib3 (<< 1.13.2); however:
  Package python3-urllib3 is not configured yet.

dpkg: error processing package python3-requests (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-setuptools:
 python3-setuptools depends on python3-pkg-resources (= 20.7.0-1); however:
  Package python3-pkg-resources is not configured yet.
 python3-setuptools depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.

dpkg: error processing package python3-setuptools (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-software-properties:
 python3-software-properties depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.
 python3-software-properties depends on python3; however:
  Package python3 is not configured yet.
 python3-software-properties depends on python3-apt (>= 0.6.20ubuntu16); however:
  Package python3-apt is not configured yet.
 python3-software-properties depends on python3-pycurl; however:
  Package python3-pycurl is not configured yet.
 python3-software-properties depends on lsb-release; however:
  Package lsb-release is not configured yet.

dpkg: error processing package python3-software-properties (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of software-properties-common:
 software-properties-common depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.
 software-properties-common depends on python3; however:
  Package python3 is not configured yet.
 software-properties-common depends on python3-gi; however:
  Package python3-gi is not configured yet.
 software-properties-common depends on python3-dbus; however:
  Package python3-dbus is not configured yet.
 software-properties-common depends on python3-software-properties (= 0.96.20.8); however:
  Package python3-software-properties is not configured yet.

dpkg: error processing package software-properties-common (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-wheel:
 python3-wheel depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.

dpkg: error processing package python3-wheel (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ssh-import-id:
 ssh-import-id depends on python3-requests (>= 1.1.0); however:
  Package python3-requests is not configured yet.
 ssh-import-id depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.

dpkg: error processing package ssh-import-id (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of dh-python:
 dh-python depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.

dpkg: error processing package dh-python (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python3
 lsb-release
 python3-apt
 python3-dbus
 python3-gi
 python3-pkg-resources
 python3-chardet
 python3-six
 python3-debian
 python3-pip
 python3-pycurl
 python3-pytoml
 python3-urllib3
 python3-requests
 python3-setuptools
 python3-software-properties
 software-properties-common
 python3-wheel
 ssh-import-id
 dh-python
E: Sub-process /usr/bin/dpkg returned an error code (1)
I hope that some of you can help because I dont want to reinstall all my dedicated with all the stuf I put in it and time too :/ Sad PS: I'm new here sorry if I didn't post at the right place

Update I almost can't do nothing it's always saying error when I tried to install a package pls help!!!!
Reply
#2
Good thing to use is a method copying your server (snapshot). When you make a change, create a state beforehand, then you can always revert back to it if you mess it up very easy to revert. Of course that doesnt help if you did not create a snapshot at all. We have all done similar things. Next time i would simulate the action you are planning to take by doing and reports what packages would be affected.
apt-get -s
Rolleyes

What ubuntu version is this on? Was python3 the default version or python2.7? Which one did you add to the server? And which was was the default? I havent used the latest ubuntu versions so i am not sure if they are now using python3.x for their base python?

(Jul-29-2019, 11:45 PM)XavPro_QC Wrote: I make some moedification some apt-get isntall / remouve finaly my python get messed up
You didnt mess up python, you messed up your linux server. You possibly removed more than just python.

First i would check
/var/log/dpkg.log
to find the managers logs to see what packages were removed
Then check here for every packaged modified or removed
/var/log/apt/history.log
This should show you what you saw when you purged it (including lists of what packages were going to be removed)
/var/log/apt/term.log
I would then install all packages that you removed when you purged python.

Also if you removed necessary package for Ubuntu you can resintate such packages with
sudo apt-get update && sudo apt-get install ubuntu-deskto
If you installed python3 though, that wont help.

Here is an example of what to do only this guy did it with python2.x. You may need the same packages, but for python3.x
https://askubuntu.com/questions/1097554/...me-restore
Recommended Tutorials:
Reply
#3
(Jul-30-2019, 02:20 AM)metulburr Wrote: Good thing to use is a method copying your server (snapshot). When you make a change, create a state beforehand, then you can always revert back to it if you mess it up very easy to revert. Of course that doesnt help if you did not create a snapshot at all. We have all done similar things. Next time i would simulate the action you are planning to take by doing and reports what packages would be affected.

Yeah I didn't think this so didn't make any snapshot....

(Jul-30-2019, 02:20 AM)metulburr Wrote: What ubuntu version is this on? Was python3 the default version or python2.7? Which one did you add to the server? And which was was the default? I havent used the latest ubuntu versions so i am not sure if they are now using python3.x for their base python?

My ubuntu version is:
Système (OS)
Ubuntu Server 16.04 "Xenial Xerus" LTS
Original python was 2.6 or 2.7 and then I installed 3.5 for bot compatibility

At the moment my official version is 2.7 and I remve python3 but like you see on my commandline it's messed up but I'm gonna take a look to waht you said to do reinstall thing and check logs. Thanks for that and I will give news soon
when I tape python -V it's said 2.7.x

I tried to foolow the guy error and I tried:
sudo apt-get install python3-all
but it automaticly adding this package to the list error...

it's always thae sam things for all python3 package:
dpkg: error processing package python3-all (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of dh-python:
 dh-python depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.
its said python3 is not configured yet...

when I tried:
root@ns544936:~# sudo apt-get install python3.5
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3.5 is already the newest version (3.5.2-2ubuntu0~16.04.5).
Reply
#4
(Jul-30-2019, 05:15 PM)XavPro_QC Wrote: Package python3 is not configured yet.
try this
sudo dpkg -r python3
close and run an update

You can also try
sudo dpkg --configure -a
sudo apt-get install -f
What happens when you do?
$ python3.5 -V
Since python3.x was installed by you and not required for the system (since its not the default), you can simply just install a new version anywhere. Then create an alias to the new python3.x in your ~/.bashrc file. Append to the bottom of that
alias python3='python3.5'
or to whatever path you installed python3.5 to

restart terminal and see if you get a python3.5 prompt with the command
python3
You can also checkout this as its a similar error as to the one you are getting
https://askubuntu.com/questions/316189/b...er-upgrade

Also Ubuntu forums would be a better place to get help with such issues. Im just kinda throwing shit at the wall to see if it sticks. They would know exactly the correct procedure to undo what you did. I would surely be interested in the correct procedure to revert your purge.
Recommended Tutorials:
Reply
#5
(Jul-30-2019, 05:15 PM)XavPro_QC Wrote: Système (OS)
Ubuntu Server 16.04 "Xenial Xerus" LTS
Original python was 2.6 or 2.7 and then I installed 3.5 for bot compatibility
It do not say Python 2.6 or 2.7 in release doc of Ubuntu 16.04 LTS (Xenial Xerus).
Python 3.
features in 16.04 LTS(Xenial Xerus) Wrote:Python2 is not installed anymore by default on the server, cloud and the touch images, long live Python3! Python3 itself has been upgraded to the 3.5 series.

If you have your own programs based on Python 2, fear not! Python 2 will continue to be available (as the python package) for the foreseeable future.
So it should be Python 3.5 default,should defiantly not remove Python 3.5 as it should be default and can mess up stuff,and only install python 2 package if needed.
Reply
#6
That means you purged your default python. Linux requires its default python for everything. I have done this once before, and came to the conclusion to reinstall linux. It was just easier at that time.

I would bypass my last response then, and try to reinstate your python3.5 via my first post. If that does not work, then i would seek help from the ubuntu forums i linked earlier.

Im not sure what your server is serving? If it is a small website or personal stuff, you could quite easily remedy it by saving config files before re-installation. If its a big website, i would tucker on to ubuntu forums to try to fix it as is.

If Ubuntu forums comes to a conclusion, please link us to it. I would be interested in what they say for a fix.
Recommended Tutorials:
Reply
#7
I'm using Kubuntu 16.04 and the default python is python 2.7.
Reply
#8
(Jul-30-2019, 08:56 PM)metulburr Wrote:
(Jul-30-2019, 05:15 PM)XavPro_QC Wrote: Package python3 is not configured yet.
try this
sudo dpkg -r python3
close and run an update

You can also try
sudo dpkg --configure -a
sudo apt-get install -f
What happens when you do?
$ python3.5 -V
Since python3.x was installed by you and not required for the system (since its not the default), you can simply just install a new version anywhere. Then create an alias to the new python3.x in your ~/.bashrc file. Append to the bottom of that
alias python3='python3.5'
or to whatever path you installed python3.5 to

restart terminal and see if you get a python3.5 prompt with the command
python3
You can also checkout this as its a similar error as to the one you are getting
https://askubuntu.com/questions/316189/b...er-upgrade

Also Ubuntu forums would be a better place to get help with such issues. Im just kinda throwing shit at the wall to see if it sticks. They would know exactly the correct procedure to undo what you did. I would surely be interested in the correct procedure to revert your purge.

thanks for the commands I will take a look!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Text Order is Kinda Messed Up? Prithak 0 1,012 Feb-03-2022, 04:00 PM
Last Post: Prithak
  python2 python3 messed up : How to fix ? hary 15 7,837 Dec-30-2020, 08:26 PM
Last Post: hary
  Matplotlib is all messed up! 64humans 1 3,393 Mar-16-2019, 08:04 PM
Last Post: libervurto
  windows grep messed up Larz60+ 4 4,450 Mar-27-2017, 01:58 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020