wheedwhackerjones
wheedwhackerjones

Reputation: 39

Unable to install MySQL-python - failed with exit status 1

Part of my project requires the MySQL-python package. I'm running Linux Mint 20, kernel 5.11 I've had just about everything working fine up to this point. Just setup my virtual environment and all the packages install via poetry except MySQL-python. It fails with:

fatal error: my_config.h: No such file or directory
       44 | #include "my_config.h"
          |          ^~~~~~~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/matt/git/proj/test/python/.venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-f_UUOG/mysql-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-f_UUOG/mysql-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-XzgEIa/install-record.txt --single-version-externally-managed --compile --install-headers /home/matt/git/proj/test/python/.venv/include/site/python2.7/mysql-python Check the logs for full command output.

I tried adding a my_config_h folder to both /usr/local/mysql and /home/linuxbrew/.linuxbrew/Cellar/mysql/8.0.26 (where it is automatically setup). Not sure how to get past this.

I have export PATH=${PATH}:/usr/local/mysql/bin my bash config. I tried linking/unlinking mysql with brew.
Did lots of googling and solutions that worked for others do not work for me.

Thanks in advance.

EDIT: after solving a bunch of minor errors, the issue is now is this /home/linuxbrew/.linuxbrew/bin/ld: cannot find -lzstd These are packages I believe inside both usr/bin and the above directory.

Here is more of the error output:

    /home/linuxbrew/.linuxbrew/bin/ld: cannot find -lzstd
    collect2: error: ld returned 1 exit status
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1```

Upvotes: 0

Views: 1616

Answers (3)

wheedwhackerjones
wheedwhackerjones

Reputation: 39

This was resolved with the following command: sudo apt-get install libzstd-dev

Upvotes: 2

nbk
nbk

Reputation: 49373

With python 2.7 you can use

mysqlclient 1.3.5

pip install mysqlclient==1.3.5

MySQL-3.23 through 5.5 and Python-2.7, 3.3-3.4 are currently supported. PyPy is supported use for example instead

But you shopuld urentyl update to python 3.8 ot 3.9

mysql-connector-python 8.0.26

pip install mysql-connector-python

Upvotes: 0

zephyr
zephyr

Reputation: 1900

If you have the pip package manager on your system, try the following:

pip3 install mysql-python

In case pip is not there, run these commands first

sudo apt update
sudo apt install python3-pip

Upvotes: 0

Related Questions