How to fix ModuleNotFoundError: No module named 'conans'

Problem:

When running conanfile.py or other Python scripts, you see an error message like

example.txt
Traceback (most recent call last):
  File "/home/myuser/myproject/conanfile.py", line 1, in <module>
    from conans import ConanFile, CMake
ModuleNotFoundError: No module named 'conans'

Solution

Install conan using one of the recommended methods such as the recommended install via pip

example.sh
pip install -U conan

Check out similar posts by category: C/C++, Python