Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install Python-Dbus in virtualenv

Tags:

I am running an application in a virtual environment that needs access to DBus (to interact with the Network Manager, mainly).

I tried to install Dbus-Python with easyinstall and pip, but both fail.

When I try to do this:

(myvirtualenv)borrajax@borrajax-computer:~/Documents/Projects/VirtualEnvs/current_env$ bin/pip install dbus-python 

Pip yells at me with:

Downloading/unpacking dbus-python   Downloading dbus-python-1.1.1.tar.gz (596kB): 596kB downloaded   Running setup.py egg_info for package dbus-python     Traceback (most recent call last):       File "<string>", line 16, in <module>     IOError: [Errno 2] No such file or directory: '/home/borrajax/Documents/Projects/VirtualEnvs/current_env/build/dbus-python/setup.py'     Complete output from command python setup.py egg_info:     Traceback (most recent call last):    File "<string>", line 16, in <module>  IOError: [Errno 2] No such file or directory: '/home/borrajax/Documents/Projects/VirtualEnvs/current_env/build/dbus-python/setup.py'  ---------------------------------------- Command python setup.py egg_info failed with error code 1 in /home/borrajax/Documents/Projects/VirtualEnvs/current_env/build/dbus-python Storing complete log in /home/borrajax/.pip/pip.log 

I've had some issues with the python dbus bindings and their "accessibility" from my Python modules in the past, so I don't really know what may be the best way to set Dbus-Python in a virtual environment. Has anyone successfully achieved this? Or does anyone have an idea on how to do this?

Thank you in advance.

like image 285
BorrajaX Avatar asked Nov 13 '12 17:11

BorrajaX


People also ask

What is python3 Dbus?

D-Bus is a message bus, used for sending messages between applications. Conceptually, it fits somewhere in between raw sockets and CORBA in terms of complexity. This package provides a Python 3 interface to D-Bus. See the dbus description for more information about D-Bus in general.


2 Answers

Go to your Venv follow this 2 steps :

1)sudo apt-get install libdbus-glib-1-dev libdbus-1-dev  2)pip install dbus-python 

verify with:

3) pip freeze 

if installed properly you will see: dbus-python==1.2.8

like image 140
cryptoKTM Avatar answered Sep 21 '22 02:09

cryptoKTM


My suggestion is to install the system package for the Python DBUS bindings and then create the virtualenv with the --system-site-packages command line option to enable access to the system-wide Python packages (including the dbus package) from the activated virtualenv. For example on Debian/Ubuntu (or a derived distribution):

$ sudo apt-get install python-dbus $ virtualenv --system-site-packages dbus-venv 

To use the built in Python 3 venv module instead of virtualenv:

$ sudo apt-get install python-dbus $ sudo apt-get install python3-venv $ python3 -m venv --system-site-packages my_venv 
like image 31
Pedro Romano Avatar answered Sep 22 '22 02:09

Pedro Romano