Installing mysql client in django virtual environment - mysql

I have created a virtual environment,with python 3 and installed django
I cant install mysqlclient ,it says problem with setup.py
jayanthi#jayanthi-Aspire-4920:~$ source env/bin/activate
(env) jayanthi#jayanthi-Aspire-4920:~$ pip install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-1.3.10.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-4pbezvx6/mysqlclient/setup.py", line 17, in <module>
metadata, options = get_config()
File "/tmp/pip-build-4pbezvx6/mysqlclient/setup_posix.py", line 44, in get_config
libs = mysql_config("libs_r")
File "/tmp/pip-build-4pbezvx6/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-4pbezvx6/mysqlclient/

on Ubuntu you must install the package:
sudo apt-get install libmysqlclient-dev

Related

MySQL running using Xampp but pip installing mysqlclient throws error EnvironmentError: mysql_config not found

I have installed XAMPP on my mac OSX that have mysql MariaDB running, now from terminal I can run MySQL but if I try to install mysqlclient I get the error saying :
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/43/m1qv9zf53q19sqh6h9kg9pz80000gn/T/pip-install-7vpJZR/mysqlclient/setup.py", line 16, in <module>
metadata, options = get_config()
File "setup_posix.py", line 53, in get_config
libs = mysql_config("libs_r")
File "setup_posix.py", line 28, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
I tried following this thread Mac OS X - EnvironmentError: mysql_config not found before posting it here, but I think since my MySQL is installed by XAMPP the configuration they are talking about in that thread does not apply to my case of problem.

Install MySQL-python using pip on QNAP TVS-473 Firmware 4.3.3.0361

i'm trying install MySQL-python on my NAS QNAP, but i'm getting this error "mysql_config not found", thanks for your support, below the output:
[/share/MD0_DATA/.qpkg/Python/src/bin] # ./pip install MySQL-python
Collecting MySQL-python
Using cached MySQL-python-1.2.5.zip
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 "/share/MD0_DATA/.qpkg/Qnapware/opt/tmp/pip-build-UYwTq4/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 /share/MD0_DATA/.qpkg/Qnapware/opt/tmp/pip-build-UYwTq4/MySQL-python/
Even if i try with a similar package..
[/share/MD0_DATA/.qpkg/Python/src/bin] # ./pip install mysqlclient
Collecting mysqlclient
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 "/share/MD0_DATA/.qpkg/Qnapware/opt/tmp/pip-build-lOv7DC/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
Pip command is failing with above error trace.
SOLVED:
I found that after install Python 2.7 via QPKG, the path to this one its different to the stock Pyhton, using ./pip inside this QPKG and using mysql-connector==older version, was installer without problem.

Error while installing mysqlclient on Fedora25

I am trying to install mysqlclient in my virtual environment which runs on python3.5.2 but it always throws error as:
(venv) [kevran#localhost mysite]$ pip install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-1.3.10.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 "/tmp/pip-build-m92fr1vk/mysqlclient/setup.py", line 17, in <module>
metadata, options = get_config()
File "/tmp/pip-build-m92fr1vk/mysqlclient/setup_posix.py", line 44, in get_config libs = mysql_config("libs_r")
File "/tmp/pip-build-m92fr1vk/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-m92fr1vk/mysqlclient/
Yu need to install mysql-devel package in OS.
yum install mysql-devel
or something like that.

Upgraded to Mavericks, now errors with python MySQL DB

How do I install MySQL python through pip?
I recently upgraded to Mavericks and now none of my packages and dependencies are working.
I was successfully able to install pip via python ez_setup.py which i found from here Can't install via pip because of egg_info error
But still keep getting this error.
Downloading MySQL-python-1.2.5.zip (108kB): 108kB downloaded
Running setup.py (path:/private/tmp/pip_build_root/MySQL-python/setup.py) egg_info for package MySQL-python
sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/private/tmp/pip_build_root/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
Complete output from command python setup.py egg_info:
sh: mysql_config: command not found
Traceback (most recent call last):
Command python setup.py egg_info failed with error code 1 in /private/var/folders/xl/lsdkfj09485039845/T/pip_build_Name/mysql-python
Storing debug log for failure in /Users/Name/Library/Logs/pip.log
I also tried running the command line; export path command I found in here.
https://stackoverflow.com/questions/5178292/pip-install-mysql-python-fails-with-environmenterror-mysql-config-not-found
download the shell script found here
http://www.macminivault.com/mysql-mavericks/
copy and paste the contents into as a .sh file i named mine fixeverything.sh
then from terminal run sh fixeverything.sh
then i ran this command to link mysql
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

installing mysql using pip

I've been trying to install mysql for hours now, I've gone through so many forums and everything can someone help me. Every time I run the command pip install mysql-python I get
(DjangoProject-env)Adams-MacBook-Air:DjangoProject AdamC$ pip install mysql-python
Downloading/unpacking mysql-python
Downloading MySQL-python-1.2.5.zip (108kB): 108kB downloaded
Running setup.py (path:/Users/AdamC/projects/Environment/DjangoProject-env/build/mysql- python/setup.py) egg_info for package mysql-python
sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/Users/AdamC/projects/Environment/DjangoProject-env/build/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
Complete output from command python setup.py egg_info:
sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/Users/AdamC/projects/Environment/DjangoProject-env/build/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
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /Users/AdamC/projects/Environment/DjangoProject-env/build/mysql-python
Storing debug log for failure in /Users/AdamC/.pip/pip.log
(DjangoProject-env)Adams-MacBook-Air:DjangoPoject AdamC$
I've tried sourcing a .profile
export PATH=/usr/local/mysql/bin:$PATH
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
And a few other things but I can't remember right now, any help would be greatly appreciated.
try doing
sudo apt-get install build-essential python-dev libmysqlclient-dev
later
sudo apt-get install python-mysqldb
I had this same error, but I'm not sure if it's from the same situation. I didn't originally have MySQL installed when I was trying to install mysql-python. It therefore couldn't use any MySQL commands like mysql-config.
If you don't have Mac Homebrew installed, go here to learn how to install it: http://brew.sh/
Then you can install MySQL with this command:
brew install mysql
And finally,
pip install mysql-python
should proceed to completion.
I had a similar situation. You can try:
Step1. Download the Postgres server at www.psequel.com
Step2. Select
the Gui Application link and then select the PSequel.
Step3.Once
everything has been downloaded, open your Postgres panel and then
launch the terminal by clicking "open psql." This takes you to the
terminal. Step4. You can now start using creating databases using
MySQL.
macos: If you do not use brew you can install mysql from the installer:
https://dev.mysql.com/downloads/mysql/