ModuleNotFound error for installed package (beautifulsoup4)

Hi all. I’m running AppDaemon in docker, first time using it so this is probably a silly mistake. I want to use beautifulsoup4, so I have added it to requirements.txt:


Running pip3 install beautifulsoup4 confirms that the package is already installed:

/usr/src/app # pip3 install beautifulsoup4
Requirement already satisfied: beautifulsoup4 in /usr/local/lib/python3.8/site-packages (4.9.1)
Requirement already satisfied: soupsieve>1.2 in /usr/local/lib/python3.8/site-packages (from beautifulsoup4) (2.0.1)
WARNING: You are using pip version 20.0.2; however, version 20.2 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.

And I’m importing it in my script (the actual body of the script is a mess of unfinished stuff and arbitrary values being passed as proof of concept, so please ignore it unless it’s directly relevant):

import hassapi as hass
import datetime
import beautifulsoup4
# Hello World App
# Args:

class bins(hass.Hass):

  def initialize(self):
# create object 'monday'
#     monday = datetime.weekday(0)
     time = datetime.time(22, 2, 0)
# callback to run script when it is monday
#     self.run_weekly(self.run_weekly_callback, monday)
     self.run_daily(self.run_daily_callback, time)
     self.log("Bins succesfully initialised")

  def run_daily_callback(self, kwargs):
     req = Request('https://XXXXXXXXXX')
     self.set_state("sensor.bins", state="03-08-2020")
     self.log("Bin sensor updated")

But when AppDaemon tries to initialise the app, it throws a ModuleNotFoundError relating to beautifulsoup4:

2020-08-02 22:31:01.111313 INFO AppDaemon: Reloading Module: /conf/apps/
2020-08-02 22:31:01.111527 INFO AppDaemon: Loading App Module: bin
2020-08-02 22:31:01.113523 WARNING Error: ------------------------------------------------------------
2020-08-02 22:31:01.113635 WARNING Error: Unexpected error loading module: /conf/apps/
2020-08-02 22:31:01.113715 WARNING Error: ------------------------------------------------------------
2020-08-02 22:31:01.114332 WARNING Error: Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/appdaemon/", line 566, in read_app
KeyError: 'bin'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/appdaemon/", line 788, in check_app_updates
await utils.run_in_executor(self, self.read_app, mod["name"], mod["reload"])
File "/usr/local/lib/python3.8/site-packages/appdaemon/", line 276, in run_in_executor
response = future.result()
File "/usr/local/lib/python3.8/concurrent/futures/", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.8/site-packages/appdaemon/", line 571, in read_app
File "/usr/local/lib/python3.8/site-packages/appdaemon/", line 580, in read_app
self.modules[module_name] = importlib.import_module(module_name)
File "/usr/local/lib/python3.8/importlib/", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/conf/apps/", line 3, in <module>
import beautifulsoup4
ModuleNotFoundError: No module named 'beautifulsoup4'

2020-08-02 22:31:01.114430 WARNING Error: ------------------------------------------------------------
2020-08-02 22:31:01.114508 WARNING AppDaemon: Removing associated apps:
2020-08-02 22:31:01.114592 WARNING AppDaemon: bins

Does anyone have an idea of why this is happening or what I can do to fix it?

I’ve even copy-pasted the package name from the docs to make sure I’m not spelling beautiful wrong. :grinning:

Did you rebuild the container after adding beautifulsoup to requiremwnts.txt?

I did, all these logs were taken after rebuilding.