7

I was trying to update my Python and messed up my whole system.

I am currently now able to start my Software Centre. I tried Googling multiple fixes but nothing helped. My Software Centre can't start.

When I try starting it up, this error shows:

astephen@localhost:/usr/bin$ ./software-centerGtk-Message: Failed to load module "gtk-vector-screenshot"
Traceback (most recent call last):
File "./software-center", line 36, in <module>
from softwarecenter.utils import (
File "/usr/share/software-center/softwarecenter/utils.py", line 19, in <module>
import dbus
ImportError: No module named dbus

I tried reinstalling dbus using:

apt-get install --reinstall dbus

But it did not help.

astephen@localhost:/usr/bin$ sudo apt-get install --reinstall dbusReading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not      upgraded.
Need to get 0 B/231 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 676272 files and directories currently installed.)
Preparing to unpack .../dbus_1.6.18-0ubuntu4.3_amd64.deb ...
Unpacking dbus (1.6.18-0ubuntu4.3) over (1.6.18-0ubuntu4.3) ...
Processing triggers for ureadahead (0.100.0-16) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Setting up dbus (1.6.18-0ubuntu4.3) ...
Eliah Kagan
  • 117,780
  • 3
    I am on mobile currently, but I am pretty sure it is not dbus you need to (re) install, but something like python-dbus or python3-dbus (python bindings) If you use synaptic, you can easily search for t he right one. – Jacob Vlijm Jul 21 '16 at 07:58
  • i tried to run
    sudo -h pip install dbus

    however it returned : Could not find a version that satisfies the requirement dbus (from versions: ) No matching distribution found for dbus

    Any ideas ? :(

    – Adrian O'neil Stephen Aug 04 '16 at 06:49
  • Did you try what @user72216 said? – edwinksl Sep 13 '16 at 21:18

5 Answers5

4

Ok, it's been two years since that question was asked, but this didn't stop me to waste my time on the same problem.

pip3 install dbus-python

made me just run into some problems like:

... 
checking python extra linking flags... -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions
  checking consistency of all components of python development environment... no
  configure: error: in `/tmp/pip-build-407jqhld/dbus-python/build/temp.linux-x86_64-3.7':
  configure: error:
    Could not link test program to Python. Maybe the main Python library has been
    installed in some non-standard library path. If so, pass it to configure,
    via the LIBS environment variable.
    Example: ./configure LIBS="-L/usr/non-standard-path/python/lib"
    ============================================================================
     ERROR!
     You probably have to install the development version of the Python package
     for your distribution.  The exact name of this package varies among them.
    ============================================================================

  See `config.log' for more details
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-407jqhld/dbus-python/setup.py", line 111, in <module>
      tests_require=['tap.py'],
    File "/home/schwaigeradm/.local/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
      return distutils.core.setup(**attrs)
    File "/usr/lib/python3.7/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/lib/python3.7/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/home/schwaigeradm/.local/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 192, in run
      self.run_command('build')
    File "/usr/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-407jqhld/dbus-python/setup.py", line 64, in run
      cwd=builddir)
    File "/usr/lib/python3.7/subprocess.py", line 347, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['/tmp/pip-build-407jqhld/dbus-python/configure', '--disable-maintainer-mode', 'PYTHON=/usr/bin/python3', '--prefix=/tmp/pip-build-407jqhld/dbus-python/build/temp.linux-x86_64-3.7/prefix']' returned non-zero exit status 1.

  ----------------------------------------
  Failed building wheel for dbus-python
  Running setup.py clean for dbus-python
Failed to build dbus-python

Installing or re-installing of any of my current software didn't help. But I realized it's a python3.7 issue:

As in python2.7 it was possible to add import dbus, but in pyhon3.7 it failed with the same error:

Traceback (most recent call last):
    import dbus
  File "/usr/lib/python3/dist-packages/dbus/__init__.py", line 77, in <module>
    import dbus.types as types
  File "/usr/lib/python3/dist-packages/dbus/types.py", line 6, in <module>
    from _dbus_bindings import (
ModuleNotFoundError: No module named '_dbus_bindings'

The solution is rather easy:

sudo apt-get install python3.7-dev
pip3 install dbus-python
Qohelet
  • 699
4

A quick search reveals that the name of the Debian package for the Python DBUS module is called python-dbus (or python3-dbus). Why it isn't available despite being an explicit dependency of the software-center package is beyond me. You should re-install the two packages in case they were corrupted:

sudo apt-get install --reinstall software-center python-dbus
David Foerster
  • 36,264
  • 56
  • 94
  • 147
3

You must install dbus-python package using pip or pip3:

pip3 install dbus-python

or

pip install dbus-python

You may need sudo before the above commands.

0

If your python3 module cannot find the right version of packages, a possible hack is to create symlinks to old versions. In case of dbus, you can do the following. (Say you just upgrade python3.5 to python3.6) $ cd /usr/lib/python3/dist-packages/ $ ln -s _dbus_glib_bindings.cpython-{35m,36m}-x86_64-linux-gnu.so

If you get further errors, try to link all packages.

a=$(find /usr/lib/python3/dist-packages -name '*35m*so')
b=$(echo $a | tr 35m 36m)
IFS=' ' read -r -a a <<< $a
IFS=' ' read -r -a b <<< $b

for ((i=0;i<${#a[@]};++i)); do
    ln -s "${a[i]}" "${b[i]}"
done
0

Adrian O'neil Stephen :

i tried to run sudo -h pip install dbus however it returned : Could not find a version that satisfies the requirement dbus (from versions: ) No matching distribution found for dbus Any ideas ? :( –

Further information on what you did would be helpful, however, my hunches:

Consider a python3 upgrade issue

When upgrading to python3, the modules sometimes change names / the import procedure changes; did you remove your old python environment manually or installed something from git?

Try aptitude

Install aptitude, it recommends ways to solve dependencies. Be careful, however, always check what it wants to do, which other stuff may be affected by this change, and write down what you do, and what aptitude does so you always can undo possible missteps.

Reinstall your System

Sometimes it's just best to nuke everything (in a convoluted OS error issue, after backing up everything, using the export function of the apps apps you want to backup, preferrably. That makes things way easier).

hirsch
  • 181