You are not logged in.

#1 2017-08-09 08:35:48

Stephentt
Member
Registered: 2017-08-09
Posts: 11

[SOLVED] Blueman can't run because dbus in python 3

I'm trying to make the bluetooth in my laptop work, I'm using blueman.

The problem is. Blueman can not run! When run it in terminal, it show:

  ~ blueman-applet 
Traceback (most recent call last):
  File "/usr/bin/blueman-applet", line 12, in <module>
    import dbus
ModuleNotFoundError: No module named 'dbus'

Okay, So my python 3 don't have dbus module. So:

sudo pacman -S python-dbus

. After install, it's still not work!
Hmmm. I open a terminal and try:

➜  ~ python 
Python 3.6.2 |Anaconda custom (64-bit)| (default, Jul 20 2017, 13:51:32) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dbus
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'dbus'
>>> 

Another try:

➜  ~ python2
Python 2.7.13 (default, Jul 21 2017, 03:24:34) 
[GCC 7.1.1 20170630] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import dbus
>>> 

So, I have dbus in python 2 but not python 3?

But python-dbus is Python 3 binding!

  ~ pacman -Qi python-dbus
Name            : python-dbus
Version         : 1.2.4-2
Description     : Python 3.6 bindings for DBUS
Architecture    : x86_64
URL             : http://www.freedesktop.org/wiki/Software/DBusBindings
...

------

I tried:

sudo vim /usr/bin/blueman-applet

And change #!/usr/bin/env python into #!/usr/bin/python2. But it really mess.

➜  ~ blueman-applet 
Traceback (most recent call last):
  File "/usr/bin/blueman-applet", line 14, in <module>
    from blueman.Constants import *
ImportError: No module named blueman.Constants

------

My env:

➜  ~ which python
/home/myusername/.anaconda3/bin/python
➜  ~ python --version
Python 3.6.2 :: Anaconda custom (64-bit)

How can I make blueman work? Thank you very much!

Last edited by Stephentt (2017-08-10 09:18:30)

Offline

#2 2017-08-09 08:58:06

stupidus
Member
Registered: 2012-02-27
Posts: 124

Re: [SOLVED] Blueman can't run because dbus in python 3

/home/myusername/.anaconda3/bin/python

Looks like you are using some 3rd party python within your homefolder. However, you installed the python-dbus package via pacman (as you should).
You should probably remove anaconda from your $PATH, then blueman should work using the arch python packages.

Offline

#3 2017-08-09 09:56:39

Stephentt
Member
Registered: 2017-08-09
Posts: 11

Re: [SOLVED] Blueman can't run because dbus in python 3

Thanks for your reply, I'm using Anaconda python distribution. But even if I removed it, it still not work!

$ which python 
/usr/bin/python

$ blueman-applet 
Traceback (most recent call last):
  File "/usr/bin/blueman-applet", line 14, in <module>
    from blueman.Constants import *
ImportError: No module named blueman.Constants

Offline

#4 2017-08-09 10:14:19

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,521
Website

Re: [SOLVED] Blueman can't run because dbus in python 3

Undo your change to the /usr/bin/blueman-applet shebang..


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#5 2017-08-09 11:15:13

Stephentt
Member
Registered: 2017-08-09
Posts: 11

Re: [SOLVED] Blueman can't run because dbus in python 3

WorMzy wrote:

Undo your change to the /usr/bin/blueman-applet shebang..

Yes, I already do it.

➜  ~ head /usr/bin/blueman-applet 
#!/usr/bin/env python

from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from __future__ import unicode_literals

import sys
import os.path
import os

Offline

#6 2017-08-09 18:10:45

stupidus
Member
Registered: 2012-02-27
Posts: 124

Re: [SOLVED] Blueman can't run because dbus in python 3

Maybe you should just reinstall blueman, in case you changed something else during your experiments. So, just run pacman -S blueman again.

Otherwise, what happens if you run "/usr/bin/env python"?

Offline

#7 2017-08-10 00:00:00

Stephentt
Member
Registered: 2017-08-09
Posts: 11

Re: [SOLVED] Blueman can't run because dbus in python 3

➜  ~ sudo pacman -S blueman
warning: blueman-2.0.4-3 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (1) blueman-2.0.4-3

Total Installed Size:  5.22 MiB
Net Upgrade Size:      0.00 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring                                                                            [###############################################################] 100%
(1/1) checking package integrity                                                                          [###############################################################] 100%
(1/1) loading package files                                                                               [###############################################################] 100%
(1/1) checking for file conflicts                                                                         [###############################################################] 100%
(1/1) checking available disk space                                                                       [###############################################################] 100%
:: Processing package changes...
(1/1) reinstalling blueman                                                                                [###############################################################] 100%
:: Running post-transaction hooks...
(1/4) Compiling GSettings XML schema files...
(2/4) Updating icon theme caches...
(3/4) Arming ConditionNeedsUpdate...
(4/4) Updating the desktop file MIME type cache...
➜  ~ blueman-applet 
Traceback (most recent call last):
  File "/usr/bin/blueman-applet", line 12, in <module>
    import dbus
ModuleNotFoundError: No module named 'dbus'
➜  ~ /usr/bin/env python --version 
Python 3.6.2 :: Anaconda custom (64-bit)
➜  ~ 

I'm using Anaconda distribution, but I'm already try system Python 2 & 3. I believe Anaconda is not a problem. So strange because Python (in Anaconda and system python) not recognize dbus module.

Offline

#8 2017-08-10 00:44:57

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,726

Re: [SOLVED] Blueman can't run because dbus in python 3

This is really simple. blueman depends on python-dbus, so it's already installed; but you've screwed up your python environment so that it can find the lib installed with the package manager. Whatever you've done, undo it.

Offline

#9 2017-08-10 09:25:04

Stephentt
Member
Registered: 2017-08-09
Posts: 11

Re: [SOLVED] Blueman can't run because dbus in python 3

Thank you @stupidus, @WorMzy, @Scimmia. I solved this problem.

The problem is from... Anaconda. At first, I think it not a problem by run some test. But after delete anaconda3 dir. It can run again. Summary:
+ Anaconda3, still not understand why, it can not detect dbus from system module.
+ I mess my $PATH variable environment. It's duplicated, so when I think I removed python from anaconda3 dir, but it not, it still there. (And I just fix it)

Now I can happily using Bluetooth again. Thanks all! smile

Offline

#10 2017-08-10 11:35:00

stupidus
Member
Registered: 2012-02-27
Posts: 124

Re: [SOLVED] Blueman can't run because dbus in python 3

If you still want to use anaconda, it should be possible. Just don't add it to your path, so it does not mess with your system. Instead you can define an alias in your .bashrc:

alias python-anaconda='~/.anaconda3/bin/python'

Offline

Board footer

Powered by FluxBB