2

I have tried a few different ways to get this installed. mysqlclient and also tried pip install MySQL-python both result in error.

pi@raspberrypi:/ $ pip install MySQL-python
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting MySQL-python
  Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
    Complete output from command python setup.py egg_info:
    sh: 1: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-YvczBg/MySQL-python/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 25, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-YvczBg/MySQL-python/
pi@raspberrypi:/ $ pip install MySQLclient
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting MySQLclient
  Downloading https://files.pythonhosted.org/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e03a/mysqlclient-1.4.6.tar.gz (85kB)
    100% |████████████████████████████████| 92kB 1.3MB/s
    Complete output from command python setup.py egg_info:
    sh: 1: mysql_config: not found
    sh: 1: mariadb_config: not found
    sh: 1: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-n01LjQ/MySQLclient/setup.py", line 16, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 61, in get_config
        libs = mysql_config("libs")
      File "setup_posix.py", line 29, in mysql_config
        raise EnvironmentError("%s not found" % (_mysql_config_path,))
    EnvironmentError: mysql_config not found

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-n01LjQ/MySQLclient/
pi@raspberrypi:/ $

Is something wrong with my install on rasbian buster?

This worked last week for 10 other Pis i have. But this week I cannot get anything to install. I tested my pip3 to see if it was a bad pip install but that works for other installs. for whatever reason I cannot get mysqlclients to install. Any ideas?

What I have tried

  1. I have uninstalled and reinstalled python 1,2,3
  2. I have reinstalled Buster I have pulled my hair out! lol
  3. I have also used pip3 install mysqlclient and same results.
  4. I have used sudo pip3 install but same results

I have also tried installing from rasbian repository

pi@raspberrypi:/ $ sudo apt-get install mysqlclient
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package mysqlclient
pi@raspberrypi:/ $ sudo apt-get install MySQL-python
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package MySQL-python
  • Why are you not installing from the Raspbian repository with apt install? – joan Nov 22 '19 at 15:27
  • pi@raspberrypi:/ $ sudo apt-get install mysqlclient Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package mysqlclient – David Morin Nov 22 '19 at 15:41
  • it is not available via the rasbian repository – David Morin Nov 22 '19 at 15:42
  • The non-python MySQL stuff has been replaced with mariaSQL. – goldilocks Nov 22 '19 at 16:35
1

After rethinking how this works I was able to install mysqldb with the following command.

 sudo apt-get install python3-mysqldb

This works for my above script.

|improve this answer|||||
  • 2
    For future reference apt search mysql | grep python might have saved you time guessing at package names here. – goldilocks Nov 22 '19 at 16:36
  • 1
    Another way to find packages on the repository: apt list 'python*mysql*'. – Ingo Nov 22 '19 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.