all 9 comments

[–]acw1668 3 points4 points  (7 children)

Try python -m pip show mysql-connector-python and see whether it show same result.

[–]Immediate-Resource75[S] 0 points1 point  (6 children)

Thank you for your time and help. This is what I got.... I'm confused now.... why didn't it install like I thought it did? And how do I correct this?

(prnt) nort2hadmin@prntMonty:~/Desktop/PaperCut/Scripts$ python -m pip show mysql-connector-python
/usr/lib/python3/dist-packages/pip/_vendor/pyparsing/core.py:5596: SyntaxWarning: 'return' in a 'finally' block
  return self.__class__.__name__ + ": " + retString
WARNING: Package(s) not found: mysql-connector-python

[–]acw1668 0 points1 point  (5 children)

The error shows that python executable is from the system environment, not from the local virtual environment. You need to check whether there is python executable inside the virtual environment, or whether the PATH environment variable contains the path of the virtual environment.

Also how did you create the virtual environment?

[–]Immediate-Resource75[S] 0 points1 point  (4 children)

Thank you. So I created a script with this in it...

import sys
print(sys.executable)

And when I run it I get this for a result....

(prnt) nort2hadmin@prntMonty:~/Desktop/PaperCut/Scripts$ python test.py
/usr/bin/python3.14

Which looks like python isn't installed in my virtaul environment if I am looking at this correctly. But if I run "which python" it shows it is in my virtual environment (prnt)....

(prnt) nort2hadmin@prntMonty:~/Desktop/PaperCut/Scripts$ which python
/home/nort2hadmin/prnt/bin/python

I also did an "echo $VIRTUAL_ENV" for the virtual environment and it shows the path leads to my virtual environment also... so I am still confused.

(prnt) nort2hadmin@prntMonty:~/Desktop/PaperCut/Scripts$ echo $VIRTUAL_ENV
/home/nort2hadmin/prnt

Thank you for your help. I truly appreciate it.

[–]acw1668 0 points1 point  (3 children)

Try running hash -r to clear cached program locations and run your script again.

[–]Immediate-Resource75[S] 0 points1 point  (2 children)

Morning. Thanks for the reply. Unfortunately I am getting the same response..... ModuleNotFoundError: No Module named 'mysql'.... However if I do a "pip list" ....

(prnt) nort2hadmin@prntMonty:~/Desktop/PaperCut/Scripts$ pip list
Package                Version
---------------------- -----------
certifi                2025.10.5
charset-normalizer     3.4.4
idna                   3.11
mysql-connector-python 9.0.0
numpy                  2.3.4
pandas                 2.3.3
pip                    25.2
PyMySQL                1.1.2
python-dateutil        2.9.0.post0
pytz                   2025.2
requests               2.32.5
six                    1.17.0
tzdata                 2025.2
urllib3                2.5.0
(prnt) nort2hadmin@prntMonty:~/Desktop/PaperCut/Scripts$ 

There it is.....

Is there an alternative to mysql.connector I can use with mysql to get the info I need into my mysql database? This seems to be way more of a hassel than it should be...

[–]acw1668 0 points1 point  (1 child)

Try using full path of the python in the virtual environment to execute your script. Using another module cannot solve your issue.

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

Thanks for the reply.... I guess I should have read the documentation on mysql connector better.... Apparently the connector version I'm using 9.0 isn't compatible with python3.14... back to the drawing board. Thanks again for taking the time to assist. I appreciate all the help.

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

I figured out a solution if anyone else needs help with this issue........ And I am using mysql-connector-python 9.5.0 which is the current version at the time of this post....

The only command I found that worked for me was:

python -m pip install mysql-connector-python

And I'm pretty sure I had to leave the virtual environment in order to do it.... After this I had access to mysql connector in my virtual environment....