Page 1 of 1

how to install rrdtool for python3?

Posted: Sat Nov 12, 2016 6:09 pm
by Canedje
Does anybody know how to install rrdtool for python3?
If I try to run a program in python3 I do get an import error for rrdtool:

Code: Select all

ImportError: No module named 'rrdtool'
If I do run the same programm in python2 , no problem.

Code: Select all

sudo apt-get install rrdtool
Is installing rrdtool for python2

I checked the internet but didn't find a solution for python3

Edit:

I did found this on internet:

Code: Select all

Unfortunately python-rrdtool package from Ubuntu/Debian is a python 2.x package only. So it will work in python 2.7 and not in python 3.4.
If you must use rrdtool in python 3.x then you will have to use some alternative python to rrdtool binding. There are several to choose from if you look at pypi.python.org (which you can then install with pip). I have not used them as they all seem to have low version count and am weary of possible bugs. If someone did try those perhaps they could share their experience...
It looks like there is no straight rrdtool solution.
Somebody experience doing this with a different solution as mentioned?

by the way I recognize a lot of import problems with python3!!
Beside this MySQL is also not importable. It looks like python 3 is not yet accepted as the new standard

Thanks.

Re: how to install rrdtool for python3?

Posted: Sat Nov 12, 2016 7:39 pm
by wh7qq
Sounds like you should use python 2.7 if rrdtool is not yet available for 3.x. The message looks like a lot of work to get it to get it working on 3.

Re: how to install rrdtool for python3?

Posted: Sat Nov 12, 2016 7:55 pm
by Canedje
Indeed.
A littlebit disapointing.
I needed also a workaround for mysql

Re: how to install rrdtool for python3?

Posted: Sat Nov 12, 2016 8:37 pm
by DougieLawson
Canedje wrote: I needed also a workaround for mysql
Python3 works perfectly with MySQL (or MariaDB). You just need python3-mysql.connector rather than python-mysqldb. mysql.connector provides an identical interface.

Re: how to install rrdtool for python3?

Posted: Sat Nov 12, 2016 8:41 pm
by Canedje
I did find a workaround by adding this code in my python code:

Code: Select all

import pymysql as mdb
mdb.install_as_MySQLdb()