Canedje
Posts: 265
Joined: Thu Mar 26, 2015 7:18 am

how to install rrdtool for python3?

Sat Nov 12, 2016 6:09 pm

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.

wh7qq
Posts: 1345
Joined: Thu Oct 09, 2014 2:50 am

Re: how to install rrdtool for python3?

Sat Nov 12, 2016 7:39 pm

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.

Canedje
Posts: 265
Joined: Thu Mar 26, 2015 7:18 am

Re: how to install rrdtool for python3?

Sat Nov 12, 2016 7:55 pm

Indeed.
A littlebit disapointing.
I needed also a workaround for mysql

User avatar
DougieLawson
Posts: 36540
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: how to install rrdtool for python3?

Sat Nov 12, 2016 8:37 pm

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.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Canedje
Posts: 265
Joined: Thu Mar 26, 2015 7:18 am

Re: how to install rrdtool for python3?

Sat Nov 12, 2016 8:41 pm

I did find a workaround by adding this code in my python code:

Code: Select all

import pymysql as mdb
mdb.install_as_MySQLdb()

Return to “Troubleshooting”