How To Friendly Inform Python Users To Install Missing Modules With Pip.Txt

Pavol Kutaj
Jan 13, 2022

--

The aim of this page📝 is to note a simple pattern (anti-pattern for some?) to instruct users to re-run

pip install -r requirements

If you run a python script and you have a missing dependency you get a variation of

Traceback (most recent call last):
File "<foo>", line 4, in <module>
import <bar>
File "<foobar>", line 1, in <module>
from <foobar> import <barfoo>
ModuleNotFoundError: No module named '<barfoo>'

I prefer to print a more elegant instruction

Missing dependency module: Run "pip install -r requirements.txt" → Retry

--

--

No responses yet