No module named 'Cheetah'

444 views
Skip to first unread message

Steve

unread,
Oct 31, 2022, 1:29:34 PM10/31/22
to weewx-user
Probably the wrong forum to ask, but I'm at my wits end. I've always used the setup.py method to update WeeWx.

I updated WeeWX to 4.9.1 from maybe 4.3.0? Followed the setup.py instructions (in /usr there are python3 and python3.5 directories).

I get an error in the log file "No module named 'Cheetah'"

I get this in my terminal 

@rpi3:~# pip install Cheetah3
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: Cheetah3 in /usr/local/lib/python2.7/dist-packages (3.2.6.post1)

Tom Keffer

unread,
Oct 31, 2022, 1:43:43 PM10/31/22
to weewx...@googlegroups.com
I can think of two reasons why this might be happening.

1. You are using a Python 2 version of pip, which will install packages in the Python 2 directory hierarchy. If you then run weewxd using Python 3, it won't find it. 

I almost never invoke Python as "python", nor pip as "pip". Instead, use the "3" suffix: python3 or pip3. That way you can be sure of which version you're getting.

2. Did you try to install Cheetah from the weewx distribution subdirectory? If so, pip will see the setup.cfg in there and install it in a funny place where Python can't find it. Take a look in /home/weewx/bin and see if Cheetah ended up there.

If that's the case, cd to something else and try again.

cd /home/weewx
pip install Cheetah3



--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/9d0031f0-08eb-465e-a16d-a3c6cfba5721n%40googlegroups.com.

vince

unread,
Oct 31, 2022, 2:45:07 PM10/31/22
to weewx-user
On Monday, October 31, 2022 at 10:29:34 AM UTC-7 Steve wrote:
@rpi3:~# pip install Cheetah3
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. 

Now would be a great time to switch to python3 if you can, given that python2 is almost two years out of support....especially since you are running a setup.py installation and can easily do a backup of the whole /home/weewx tree in one step...just in case.

As Tom suggested, just use 'pip3' and 'python3' to be darn certain you use the desired 'supported' python version for your os.

Also, your os is 'really' out of date as well if you see python 3.5 in /usr/lib.  A current raspi would have python 3.9 in /usr/lib, so you might think about spending the five or so bucks and tossing a new SD card in with current RaspiOS and getting everything current now.  Your time is worth something to you too, as you might be battling version things for a long time otherwise....


Steve

unread,
Oct 31, 2022, 3:03:21 PM10/31/22
to weewx-user
I did try @rpi3:/home/weewx/bin# sudo pip3 install cheetah3

Traceback (most recent call last):
  File "/usr/local/bin/pip3", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3019, in <module>
    @_call_aside
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3003, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3032, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 657, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 670, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 849, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==8.1.0' distribution was not found and is required by the application
@rpi3:/home/weewx/bin#

Steve

unread,
Oct 31, 2022, 3:07:55 PM10/31/22
to weewx-user
Thanks Vince.

I will update the OS when I get a chance, the Pi does a few other things besides Weewx. But like you mentioned, unless I get it current, I'll be battling stuff like this forever. I rolled back to v4.3.0 as I saved the image before playing with it.

On Tuesday, 1 November 2022 at 05:45:07 UTC+11 vince wrote:

Tom Keffer

unread,
Oct 31, 2022, 3:18:08 PM10/31/22
to weewx...@googlegroups.com
For some reason your copy of pip3 is using packages in the Python 2 library. Somehow it got broken. Perhaps it has the wrong shebang at the top? 

Try reinstalling it.

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages