4

Ubuntu software center was being weird with me before, it wouldn't open up in the Dash and I couldn't open it up properly in terminal without something going wrong.

I googled the problem and people recommended the usual:

sudo apt-get update
sudo apt-get upgrade

This didn't work.

So then I tried

sudo apt-get install --reinstall software-center


me@me-computer:~$ sudo apt-get install --reinstall software-center
[sudo] password for sonney: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  apport
The following packages will be upgraded:
  apport
1 to upgrade, 0 to newly install, 1 reinstalled, 0 to remove and 19                 not to upgrade.
164 not fully installed or removed.
Need to get 0 B/535 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] me@me-computer:~$ 

suggesting that software-center is already on my computer. However when i type in

software-center

I get

sonney@sonney-UX32A:~$ software-center
bash: /usr/bin/software-center: /usr/bin/python: bad interpreter: No such file or directory

Can someone help me please? I'm running Ubuntu 14.04

Edit: To New USer:

I ran

ls /usr/bin/python*

to get a fairly large list

/usr/bin/python            /usr/bin/python3               /usr/bin/python3-config
/usr/bin/python2           /usr/bin/python3.4          /usr/bin/python3m
/usr/bin/python2.7         /usr/bin/python3.4-config   /usr/bin/python3m-config
/usr/bin/python2.7-config  /usr/bin/python3.4m         /usr/bin/python-config
/usr/bin/python2-config    /usr/bin/python3.4m-config  /usr/bin/pythonSAVE
  • what is the output of ls -l /usr/bin/python – Maythux Apr 29 '15 at 16:19
  • What happens with the command: /usr/bin/python /usr/bin/software-center? If that doesn't work, what is the output of which python? Also what happens if you just enter python on the command line (if the interpreter does appear you can exit with Ctrl+D). – TheSchwa Apr 29 '15 at 20:22
  • @TheSchwa /usr/bin/python /usr/bin/software-center returns bash: /usr/bin/python: No such file or directory. which python returns /usr/local/bin/python and python opens python stating Python 2.7.5 (default, Dec 30 2014, 22:28:34) [GCC 4.9.1] on linux2 – Sonney Patel Apr 29 '15 at 21:55
  • Huh...have you ever messed with your python installation? As New USer noticed there's some sort of problem with your script symlinks. What is the output of ls -l /etc/alternatives/python? And also the output of update-alternatives --display python? I probably have a solution but I want to make sure I understand what your current setup is doing. – TheSchwa Apr 29 '15 at 22:44
  • @TheSchwa, I've been trying to play around with Ubuntu for a couple of months, I had problems in the beginning installing python packages, as my stupid self didn't have virtualenvironment set up at the time (or know about it for that matter), I'm sure some serious damage has been caused. Running ` ls -l /etc/alternatives/python` returns ls: cannot access /etc/alternatives/python: No such file or directory and update-alternatives --display python returns update-alternatives: error: no alternatives for python – Sonney Patel Apr 29 '15 at 22:58
1

It seems broken symlink of python in /usr/bin.

 ls -l /usr/bin/python

list all the python binaries available.

Then simply creat a symlink with

sudo ln -s /usr/bin/python3.4 /usr/bin/python3
  • I tried to implement your changes, please see the edit (I didn't know you could use code in comments until just now) – Sonney Patel Apr 29 '15 at 16:14
  • What is the output of python --version? – Maythux Apr 29 '15 at 16:16
  • check the edit now – Maythux Apr 29 '15 at 16:17
  • Python 2.7.5, shall i perform the commands in your edit now? – Sonney Patel Apr 29 '15 at 16:21
  • sudo ln -s /usr/bin/python3.4 /usr/bin/python3 returns ln: failed to create symbolic link ‘/usr/bin/python3’: File exists – Sonney Patel Apr 29 '15 at 16:22
0

The problem is that software-center starts with the shebang line #!/usr/bin/python which apparently points to a non-existent file on your system. I'm assuming absolute paths are common for Ubuntu default programs, rather than the more commonly used by developers #!/usr/bin/env python which would default to the first entry on your path (potentially incompatible).

This should work based on the output in your comments:

sudo rm /usr/bin/python
sudo ln -s /usr/local/bin/python /usr/bin/python

If that doesn't work you could also try re-configuring python which should (hopefully) fix your script links:

sudo dpkg-reconfigure python

I'm not sure if completely re-installing is a good idea, since alot of stuff in Ubuntu depends on Python, but that's also an option:

sudo apt-get remove python
sudo apt-get install python

If that still doesn't work add an apt-get autoremove and try purge instead of remove to make sure everything goes away. Be careful using autoremove though, it can have unexpected consequences depending on the state of your packages:

sudo apt-get purge python
sudo apt-get autoremove
sudo apt-get install python
  • I tried everything that you wrote, and everything related to python was deleted, then i sudo apt-get install python and finally sudo apt-get install software-center, while this is happening, some errors popped up but i was unable to report the problem, it also returned an error: Errors were encountered while processing: update-notifier-common update-notifier update-manager ubuntu-release-upgrader-gtk E: Sub-process /usr/bin/dpkg returned an error code (1) Finally, I tried software-center, but that didn't work either, the same errors popped up as last time :( – Sonney Patel Apr 29 '15 at 23:44
  • Since everything is gone anyway, should i just start again? completely reboot my linux after backing up? – Sonney Patel Apr 29 '15 at 23:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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