Watchdog: watchmedo crashes: ModuleNotFoundError: No module named 'yaml'

Created on 17 May 2020  ·  6Comments  ·  Source: gorakhargosh/watchdog

Seems like pip install watchdog didn't install pyyaml.

It would be nice if watchmedo didn't even try to import this package if there is no yaml file to read too, which is my case.

watchmedo

Most helpful comment

Hmm.. and when I install pyyaml (which was unpleasant, because pip install yaml doesn't work since the package and the module are different names), it crashes with ModuleNotFoundError: No module named 'argh'.

Installing argh seems to have worked though.

All 6 comments

Hmm.. and when I install pyyaml (which was unpleasant, because pip install yaml doesn't work since the package and the module are different names), it crashes with ModuleNotFoundError: No module named 'argh'.

Installing argh seems to have worked though.

I see both packages are included as extra_requirements, which makes it seem like a conscious decision. Why is that so?

I also encountered this error when trying to run watchmedo after simply installing with pip install watchdog.
As mentioned in the README, watchmedo is an optional script and its dependencies can be installed with pip install watchdog[watchmedo].

python -m pip install watchdog[watchmedo]

is the good command to use to install watchmedo and its dependencies.

@BoboTiG well that's not very helpful. Why doesn't it install dependencies by default like all other packages in the world? And if you use just the minimal command why does it hard crash instead of telling you something useful?

watchmedo was moved in extra packages since #297. This is on purpose that it is no more installable via a simple python -m pip install watchdog.

If you want watchmedo, then you install the extra package. And dependencies will be installed too.

As for the second message, we could improve slightly the situation here by skipping the ImportError when yaml is not installed. It would work when one does not use yaml at all.

As for the "crash": it is not a crash. The error message is quite explicit though :)

Was this page helpful?
0 / 5 - 0 ratings