0
votes

Im trying to install on Synology DS215j the Python lib (mysqlclient) to connect Mysql

1) I install Python 3.5 from the package manager (OK)

2) Then i SSh to Synology Station and i get admin right --> sudo -i

3) install Pip3 curl -k https://bootstrap.pypa.io/get-pip.py | python3 (OK)

I cheek what pakage are in the system --> /volume1/@appstore/py3k/usr/local/bin/pip3 list Package Version


pip 19.1.1 setuptools 41.0.1 wheel 0.33.4

4) Then i try to install --> mysqlclient --> /volume1/@appstore/py3k/usr/local/bin/pip3 install mysqlclient

But i get this error Message.

ERROR: Complete output from command python setup.py egg_info: ERROR: /bin/sh: mysql_config: command not found Traceback (most recent call last): File "", line 1, in File "/tmp/pip-install-kfd9_v0o/mysqlclient/setup.py", line 16, in metadata, options = get_config() File "/tmp/pip-install-kfd9_v0o/mysqlclient/setup_posix.py", line 51, in get_config libs = mysql_config("libs") File "/tmp/pip-install-kfd9_v0o/mysqlclient/setup_posix.py", line 29, in mysql_config raise EnvironmentError("%s not found" % (_mysql_config_path,)) OSError: mysql_config not found ---------------------------------------- ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-kfd9_v0o/mysqlclient/

Unfortunately i have no idea how to fix this problem. I will appreciate some help. Thanks marco

2
Mysql client need to be installed before attempting to install mysqlclient pip package. Can you try issuing mysql --version and share the output?nightgaunt
MySQL on a Synology? Do people use NAS as a general computer?phd
Possible duplicate of Ubuntu 17: Can't install mysqlclientphd

2 Answers

1
votes

I also could not install modules mysqlclient, mysql or mariadb... I'm sorry to suggest here only a workaround: installing "PyMySQL", a pure Python MySql client. This way resolves some issues like lack of gcc on Synology NAS, missing pip dependencies, etc... My solution/workaround:

/volume1/@appstore/py3k/usr/local/bin/pip3 install pymysql

For my usage, functions were the same so I just had to change the import:

>>> import pymysql  # import pure Python SQL client
>>> conn = pymysql.connect(database="usersdb", user="web", port=3307)
0
votes

Ok, I solved my problem. At the beginning I thought that the issue on install mysqlclient was due to the fact that PIP had some problems. I was wrong. Pip Works well.

Mysqlclient just wont install on Synology.

I then try to install another Mysql Connector, i tried PyMySQL and it install easy an works fine. Probably i was able to install PyMySQL because it (contains a pure-Python MySQL client library, based on PEP 249.)

https://pypi.org/project/PyMySQL/