How to Install python 2.7 mysql on Digital Ocean - python

I tried install mysql using this command in my droplet on Digital Ocean:
pip install MySQL-python
But it not working and show this message:
Collecting MySQL-python
Using cached 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-build-kjiS0F/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-build-kjiS0F/MySQL-python/

might be issue with the locale settings.
try this:
$ export LC_ALL=C

Related

python setup.py egg_info error mysqlclient

I just started learning Python using Django and I just seemed to be stuck at the same place for 3 days, every time I try to run the following command in my terminal using Pycharm (Yep, I am using a Mac) I get the below error:
Command: pip install mysqlclient
Error:
Collecting mysqlclient
Using cached mysqlclient-1.3.12.tar.gz
Complete output from command python setup.py egg_info:
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/3z/_xzmzzh90z9dj90cb70p3q0c0000gn/T/pip-build-c7mudszc/mysqlclient/setup.py", line 17, in <module>
metadata, options = get_config()
File "/private/var/folders/3z/_xzmzzh90z9dj90cb70p3q0c0000gn/T/pip-build-c7mudszc/mysqlclient/setup_posix.py", line 44, in get_config
(venv) Mervins-MacBook-Pro:untitled mervinkobola$ pip install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-1.3.12.tar.gz
Complete output from command python setup.py egg_info:
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/3z/_xzmzzh90z9dj90cb70p3q0c0000gn/T/pip-build-w_jamo3b/mysqlclient/setup.py", line 17, in <module>
metadata, options = get_config()
File "/private/var/folders/3z/_xzmzzh90z9dj90cb70p3q0c0000gn/T/pip-build-w_jamo3b/mysqlclient/setup_posix.py", line 44, in get_config
(venv) Mervins-MacBook-Pro:untitled mervinkobola$ pip install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-1.3.12.tar.gz
Complete output from command python setup.py egg_info:
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/3z/_xzmzzh90z9dj90cb70p3q0c0000gn/T/pip-build-xefx4qk7/mysqlclient/setup.py", line 17, in <module>
metadata, options = get_config()
File "/private/var/folders/3z/_xzmzzh90z9dj90cb70p3q0c0000gn/T/pip-build-xefx4qk7/mysqlclient/setup_posix.py", line 44, in get_config
libs = mysql_config("libs_r")
File "/private/var/folders/3z/_xzmzzh90z9dj90cb70p3q0c0000gn/T/pip-build-xefx4qk7/mysqlclient/setup_posix.py", line 26, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
OSError: mysql_config not found
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/3z/_xzmzzh90z9dj90cb70p3q0c0000gn/T/pip-build-xefx4qk7/mysqlclient/
Please help me understand whats going on and how I can solve it. Above all I can't seem to run the following :
python manage.py migrate (as I haven't installed mysqlclient)
Thank you in advance for your assistance.
Sometimes the variable mysql_config is set in the Terminal but not in PyCharm so this is why you're getting this error.
The solution is:
run the PyCharm from the terminal with this command:
/Applications/PyCharm\ CE.app/Contents/MacOS/pycharm
After that (in PyCharm) install the packages you need (probably they are in your requirements.txt, for example the mysqlclient),
Close the program and re-open
Now it should have all the packages installed properly

i can't install mysqlclient and pillow in python

i want to install mysqlclient but it returns me
(venv)amir#amg76:~/Documents/Computer/Python/Django/vira/virasciencecom$ pip3 install mysqlclient==1.3.7
Collecting mysqlclient==1.3.7
Using cached mysqlclient-1.3.7.tar.gz
Complete output from command python setup.py egg_info:
/bin/sh: 1: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-c5i8m5ok/mysqlclient/setup.py", line 17, in <module>
metadata, options = get_config()
File "/tmp/pip-build-c5i8m5ok/mysqlclient/setup_posix.py", line 44, in get_config
libs = mysql_config("libs_r")
File "/tmp/pip-build-c5i8m5ok/mysqlclient/setup_posix.py", line 26, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
OSError: mysql_config not found
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-c5i8m5ok/mysqlclient/
the same thing happen when i try to install pillow and i use python 3.6 and ubuntu 17.10
can any body help me?
You need to install libmysqlclient-dev or libmariaclient-dev from your distro package repository, depending whether you're using mysql or mariadb respectively.

installing mysqldb for flask ERROR [OSX]

macOS 10.13.2
Python 2.7.14
Hi all! I'm currently working on a website made in python (flask), but I'm experiencing an issue when I try to install MYSQLDB for python. I want to use it for my database where I can store users and other data. First of all, here is the terminal output when I input:
pip install flask-mysqldb
Collecting flask-mysqldb
Using cached Flask-MySQLdb-0.2.0.tar.gz
Requirement already satisfied: Flask>=0.10 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from flask-mysqldb)
Collecting mysqlclient (from flask-mysqldb)
Using cached mysqlclient-1.3.12.tar.gz
Complete output from command python setup.py egg_info:
sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/b3/4tr2p1w10cx70rqpqh28m30r0000gn/T/pip-build-4sX19x/mysqlclient/setup.py", line 17, in <module>
metadata, options = get_config()
File "setup_posix.py", line 44, in get_config
libs = mysql_config("libs_r")
File "setup_posix.py", line 26, 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 /private/var/folders/b3/4tr2p1w10cx70rqpqh28m30r0000gn/T/pip-build-4sX19x/mysqlclient/
This error message doesn't help me at all, I don't know what to do with it. After getting the error I searched for a solution on different sites, but none of the solutions is working for me. Here are some 'solutions' I tried
sudo pip3 install git+https://github.com/donnemartin/gitsome.git
sudo -H pip3 install gitsome
sudo pip install --upgrade setuptools
When I input:
sudo -H pip install flask-mysqldb
This is the output:
Collecting flask-mysqldb
Downloading Flask-MySQLdb-0.2.0.tar.gz
Requirement already satisfied: Flask>=0.10 in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from flask-mysqldb)
Collecting mysqlclient (from flask-mysqldb)
Downloading mysqlclient-1.3.12.tar.gz (89kB)
100% |████████████████████████████████| 92kB 556kB/s
Complete output from command python setup.py egg_info:
sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/pip-build-P4Y1ub/mysqlclient/setup.py", line 17, in <module>
metadata, options = get_config()
File "setup_posix.py", line 44, in get_config
libs = mysql_config("libs_r")
File "setup_posix.py", line 26, 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 /private/tmp/pip-build-P4Y1ub/mysqlclient/
I would really appreciate any help to resolve this problem! Thanks in advance.
If your concern is to manipulate the DB, I will recommend using Flask-SQLAlchemy and right here you will find how to connect using MySQL databases.
Flask-SQLAlchemy is a ORM (Object Relational Mapper) so, you will probably have to code map the DB
I hope this helps!

RaspberryPi - MySQLdb

Hello Stackoverflow users,
For my student project i need to use python and mysql, but when i try to use i've this kind of error
Traceback (most recent call last):
File "myRFIDserv.py", line 2, in
import MySQLdb
ImportError: No module named MySQLdb
I 've try to fix this with the installation of python-mysqldb but they have also a error ...
Package python-mysqldb is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'python-mysqldb' has no installation candidate
MySQL-server are already install !
I've try sudo pip install MySQL-python but i have this kind of error
Collecting MySQL-python
Using cached 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 20, in <module>
File "/tmp/pip-build-lbb0Fd/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-build-lbb0Fd/MySQL-python
I don't understand, someone can help me ? ;)
maybe you can try
pip install MySQL-python

What package should I use to query Mysql Databases in Python?

I need to query a Mysql database with Python.
I have virtual env installed and also PIP, I have tried to install this package, http://pypi.python.org/pypi/MySQL-python/#downloads but without success.
I have parformed the command:
sudo pip install http://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.3.tar.gz#md5=215eddb6d853f6f4be5b4afc4154292f
And I have got the error:
(python_virtualenv)andre#ubuntu:~/workspace/RS_r/src$ sudo pip install http://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.3.tar.gz#md5=215eddb6d853f6f4be5b4afc4154292f
[sudo] password for andre:
Downloading/unpacking http://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.3.tar.gz#md5=215eddb6d853f6f4be5b4afc4154292f
Downloading MySQL-python-1.2.3.tar.gz (70Kb): 70Kb downloaded
Running setup.py egg_info for package from http://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.3.tar.gz#md5=215eddb6d853f6f4be5b4afc4154292f
sh: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/tmp/pip-l0kPkg-build/setup.py", line 15, 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 24, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
Complete output from command python setup.py egg_info:
sh: mysql_config: not found
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/tmp/pip-l0kPkg-build/setup.py", line 15, 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 24, 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
Storing complete log in /home/andre/.pip/pip.log
My questions. What package should I install to query Mysql databases and how should I install? Pip install should be used in this case?
Give me a clue.
Best regards,
The error message is self-speaking
sh: mysql_config: not found
mysql_config is part of the MySQL installation is either not installed nor not available
from the $PATH. This is the problem to be solved - not the question about binding alternatives.
The error message shows you are missing mysql_config (and seem to be on an Ubuntu machine):
EnvironmentError: mysql_config not found
...
sh: mysql_config: not found
dpkg -S can show which package provides mysql_config -- assuming you have a machine with mysql_config installed... :)
% dpkg -S $(which mysql_config)
libmysqlclient-dev: /usr/bin/mysql_config
Therefore, it looks like you need to install the libmysqlclient-dev package.
PS. If you don't have a machine with mysql_config installed, the same info can be found at http://packages.ubuntu.com/.
Have a look at this links: one, two, three
The source you can find here

Categories

Resources