Search code examples
pythonsqlmariadbcentos8

ModuleNotFoundError on Centos8


I am trying to run a python script to pull a table from MariaDB. I can run it locally on the MariaDB I installed on my device but when I go to run it on my vm it throws the ModuleNotFoundError. If I run 'pip-safe list' it shows both modules are there but when I run the script I get the error above. I have also tried moving the location that the modules are stored to see if it was a directory issue. I think that it's simply an issue with the import syntax with the '.' in mysql.connector but I can't figure out why. If anyone could help me troubleshoot this that would be greatly appreciated.

Code

Error Message


Solution

  • "pip-safe" was installing the modules to a virtualenv within my system. Where as "sudo pip3" would install to a different directory. When I installed mysql-connector-python via "sudo pip3" and ran the same script I didn't get any errors.

    I still don't fully understand why python3 wasn't able to find the modules that were istalled via "pip-safe" but the script is working.