Fresh install of 400b16: No module named 'pymysql'

109 views
Skip to first unread message

Lucas Heijst

unread,
Mar 17, 2020, 11:33:02 AM3/17/20
to weewx-development
Tom,

I followed the install instructions of v4.0.0b16 for python3, see below.
After startup I got a ModuleNotFoundError: No module named 'pymysql'
So I added to the install:
apt-get install python3-mysqldb

Luc

install instructions
=====
apt-get install python3-pip -y

# Required packages:
sudo python3 -m pip install configobj
sudo python3 -m pip install cheetah3
sudo python3 -m pip install pillow

# Required if hardware is serial or USB, respectively:
sudo python3 -m pip install pyserial
sudo python3 -m pip install pyusb

# Required if using MySQL. If this does not
# install cleanly, then see https://pypi.org/project/mysqlclient/
sudo python3 -m pip install mysqlclient

# Optional: for extended almanac information:
sudo python3 -m pip install pyephem
====

startup
====
Mar 17 12:18:42 pi37 weewx[7000] INFO __main__: Initializing weewx version 4.0.0b16
...
Mar 17 12:18:42 pi37 weewx[7004] DEBUG weewx.engine: Loading service user.cmon.ComputerMonitor
Mar 17 12:18:42 pi37 /weewxd: cmon: service version is 0.17
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__: Caught unrecoverable exception:
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****  No module named 'pymysql'
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****  Traceback (most recent call last):
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****    File "/home/weewx/bin/weedb/mysql.py", line 12, in <module>
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****      import MySQLdb
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****    File "/usr/local/lib/python3.7/dist-packages/MySQLdb/__init__.py", line 18, in <module>
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****      from . import _mysql
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****  ImportError: libmariadb.so.3: cannot open shared object file: No such file or directory
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****  During handling of the above exception, another exception occurred:
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****  Traceback (most recent call last):
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****    File "/home/weewx/bin/weewxd", line 148, in main
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****      engine = weewx.engine.StdEngine(config_dict)
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****    File "/home/weewx/bin/weewx/engine.py", line 75, in __init__
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****      self.loadServices(config_dict)
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****    File "/home/weewx/bin/weewx/engine.py", line 136, in loadServices
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****      obj = weeutil.weeutil.get_object(svc)(self,config_dict)
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****    File "/home/weewx/bin/user/cmon.py", line 705, in __init__
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****      initialize=True)
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****    File "/home/weewx/bin/weewx/manager.py", line 523, in get_manager
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****      self.manager_cache[data_binding] = open_manager(manager_dict, initialize)
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****    File "/home/weewx/bin/weewx/manager.py", line 673, in open_manager
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****      manager_dict['schema'])
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****    File "/home/weewx/bin/weewx/manager.py", line 150, in open_with_create
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****      connection = weedb.connect(database_dict)
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****    File "/home/weewx/bin/weedb/__init__.py", line 86, in connect
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****      __import__(db_dict['driver'])
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****    File "/home/weewx/bin/weedb/mysql.py", line 15, in <module>
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****      import pymysql as MySQLdb
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****  ModuleNotFoundError: No module named 'pymysql'
Mar 17 12:18:42 pi37 weewx[7004] CRITICAL __main__:     ****  Exiting.
====

Thomas Keffer

unread,
Mar 17, 2020, 6:57:26 PM3/17/20
to Lucas Heijst, weewx-development
Which version of Raspbian is your Pi running?

-tk

--
You received this message because you are subscribed to the Google Groups "weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-developm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-development/3a5ea761-f277-4cf4-a042-85ea282ebb65%40googlegroups.com.

Thomas Keffer

unread,
Mar 17, 2020, 7:14:01 PM3/17/20
to Lucas Heijst, weewx-development
Oh, and I should mention, the instructions do say "If this does not install cleanly, then see https://pypi.org/project/mysqlclient/"

Did you try following the instructions there?

-tk

Lucas Heijst

unread,
Mar 18, 2020, 8:46:46 AM3/18/20
to weewx-development
Tom,

I did not follow the instructions in https://pypi.org/project/mysqlclient/"
Version 2019-07-10-raspbian-buster-lite
I forgot to mention, another module was missing during report generation, I forgot the name, sorry.

Below the way I install the software for weewx for all my Raspberri PI's.

Luc

=====
pi11 RPI1B
Mar 18 08:21:48 pi11 weewx[24204] INFO __main__: Initializing weewx version 4.0.0b16
Mar 18 08:21:48 pi11 weewx[24204] INFO __main__: Using Python 3.7.3 (default, Dec 20 2019, 18:57:59) #012[GCC 8.3.0]
Mar 18 08:21:48 pi11 weewx[24204] INFO __main__: Platform Linux-4.19.97+-armv6l-with-debian-10.3
2019-07-10-raspbian-buster-lite,  cmon, webcam, pihole
apt-get install python3-pip python3-pil python3-configobj python3-distutils python3-cheetah mariadb-client-10.0 python3-mysqldb python3-ephem

pi21 RPI2B
Mar 18 08:25:32 pi21 klim[2945] INFO __main__: Initializing weewx version 4.0.0b14
Mar 18 08:25:32 pi21 klim[2945] INFO __main__: Using Python 3.7.3 (default, Dec 20 2019, 18:57:59) #012[GCC 8.3.0]
Mar 18 08:25:32 pi21 klim[2945] INFO __main__: Platform Linux-4.19.97-v7+-armv7l-with-debian-10.3
2019-07-10-raspbian-buster-lite,  cmon, vpro, mstk, klim
apt-get install python3-pil python3-configobj python3-distutils python3-cheetah mariadb-client-10.0 python3-mysqldb python3-ephem
apt-get install python3-serial
apt-get install python3-usb

pi31 RPRI3B
Mar 18 08:19:02 pi31 tfrc[27179] INFO __main__: Initializing weewx version 4.0.0b16
Mar 18 08:19:02 pi31 tfrc[27179] INFO __main__: Using Python 3.5.3 (default, Sep 27 2018, 17:25:39) #012[GCC 6.3.0 20170516]
Mar 18 08:19:02 pi31 tfrc[27179] INFO __main__: Platform Linux-4.19.66-v7+-armv7l-with-debian-9.11
2019-04-08-raspbian-stretch-lite, cmon, webcam, tfrc
apt-get install python3-pil python3-configobj mariadb-client-10.0 python3-mysqldb python3-ephem python3-pip python3-dev
sudo pip3 install cheetah3

pi34 RPRI3B+
Mar 18 08:30:13 pi34 weewx[5520] INFO __main__: Initializing weewx version 4.0.0b16
Mar 18 08:30:13 pi34 weewx[5520] INFO __main__: Using Python 3.7.3 (default, Dec 20 2019, 18:57:59) #012[GCC 8.3.0]
Mar 18 08:30:13 pi34 weewx[5520] INFO __main__: Platform Linux-4.19.97-v7+-armv7l-with-debian-10.3
2019-07-10-raspbian-buster-lite,  cmon, as3935
apt-get install python3-pil python3-configobj python3-distutils python3-cheetah mariadb-client-10.0 python3-mysqldb python3-ephem

pi35 RPRI3B+
Mar 18 08:36:44 pi35 rtld[12389] INFO __main__: Initializing weewx version 4.0.0b14
Mar 18 08:36:44 pi35 rtld[12389] INFO __main__: Using Python 3.5.3 (default, Sep 27 2018, 17:25:39) #012[GCC 6.3.0 20170516]
Mar 18 08:36:44 pi35 rtld[12389] INFO __main__: Platform Linux-4.19.66-v7+-armv7l-with-debian-9.11
2019-04-08-raspbian-stretch-lite, cmon, rtld, bmp280
apt-get install python3-pil python3-configobj mariadb-client-10.0 python3-mysqldb python3-ephem python3-pip python3-dev
sudo pip3 install cheetah3

pi36 RPRI3B+
Mar 18 08:41:32 pi36 weewx[6723]: engine: Initializing weewx version 3.9.2
Mar 18 08:41:32 pi36 weewx[6723]: engine: Using Python 2.7.16 (default, Oct 10 2019, 22:02:15) #012[GCC 8.3.0]
Mar 18 08:41:32 pi36 weewx[6723]: engine: Platform Linux-4.19.97-v7+-armv7l-with-debian-10.3
2019-07-10-raspbian-buster-lite,  cmon, webcam
sudo apt-get install python-configobj  python-cheetah  python-imaging python-serial python-usb python-mysqldb python-dev python-pip rsync sshpass
sudo pip install pyephem

pi37 RPRI3B+
Mar 18 08:44:16 pi37 weewx[13912] INFO __main__: Initializing weewx version 4.0.0b16
Mar 18 08:44:16 pi37 weewx[13912] INFO __main__: Using Python 3.7.3 (default, Dec 20 2019, 18:57:59) #012[GCC 8.3.0]
Mar 18 08:44:16 pi37 weewx[13912] INFO __main__: Platform Linux-4.19.97-v7+-armv7l-with-debian-10.3
2019-07-10-raspbian-buster-lite,  cmon, webcam
apt-get install python3-pip python3-pil python3-configobj python3-distutils python3-cheetah mariadb-client-10.0 python3-mysqldb python3-ephem
=====


On Tuesday, 17 March 2020 20:14:01 UTC-3, Tom Keffer wrote:
Oh, and I should mention, the instructions do say "If this does not install cleanly, then see https://pypi.org/project/mysqlclient/"

Did you try following the instructions there?

-tk

On Tue, Mar 17, 2020 at 3:56 PM Thomas Keffer <tke...@gmail.com> wrote:
Which version of Raspbian is your Pi running?

-tk

To unsubscribe from this group and stop receiving emails from it, send an email to weewx-de...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages