I feel like I am missing something incredibly simple, but I can't, for the life of me figure out what it is.
I am trying to run a Python3 script on a Windows box, and I get the error
ModuleNotFoundError: No module named 'argparse_formatter'
. However, when I check to see if the module is installed, it shows it is.
pip3 install argparse_formatter
Requirement already satisfied: argparse_formatter in c:\users\scott\appdata\local\programs\python\python311\lib\site-packages (1.4)
And when I look in that directory, it is indeed there. Yet, I get an error with this
python3 -c "import argparse_formatter; print(argparse_formatter);"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'argparse_formatter'
I read that it could be some environmental variables, but they all seem to be correct. And most posts about this are Linux based... which is not exactly helpful for Windows based users.
Any help would be much appreciated!
It seems that python is not using the PIP packages location for imports.
You can add to the package location programmatically, for example:
sys.path.append("c:\users\scott\appdata\local\programs\python\python311\lib\site-packages")
For more information about sys.path consult the Python documentation https://docs.python.org/3/library/sys_path_init.html
You may also want to look into using virtual environments for your Python projects. I've had good experience with the Linux version of this project: https://github.com/pyenv-win/pyenv-win