Ran into this error when running pip3 install <mymodule> .. I checked that I had no version conflict.
pip3 install <mymodule> .
What fixed it, was upgrading pip (to version 23.0.1) :
23.0.1
pip3 install --upgrade pip