Attempting to pip install MySQL-python in a virtual environment, also getting an error trying to pip install it outside of a virtual environment.
I've read similar questions and tried all the proposed solutions, but 1) none worked and 2) I don't really understand the cause of this still. Could someone help me out?
Apologies in advance for the noobish question, I'm pretty new to this.
Here's the error:
(env)ryans-air:outreach ryanfarley$ pip install MySQL-python
Collecting MySQL-python
/Users/ryanfarley/Desktop/outreach/env/lib/python2.7/site-packages/pip/vendor/requests/packages/urllib3/util/ssl.py:90:
InsecurePlatformWarning: A true SSLContext object is not available.
This prevents urllib3 from configuring SSL appropriately and may cause
certain SSL connections to fail. For more information, see
https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning 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 "", line 20, in
File "/private/var/folders/fb/5pp5q35x541493ccjj7g0w580000gn/T/pip-build-BIQjaP/MySQL-python/setup.py",
line 17, in
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
/private/var/folders/fb/5pp5q35x541493ccjj7g0w580000gn/T/pip-build-BIQjaP/MySQL-python
The MySQL libraries have not been installed or cannot be found by pip when installing the package. The MySQL-python package will rely on MySQL libraries and executables (in the case of mysql_config) on your system.
See pip install mysql-python fails with EnvironmentError: mysql_config not found.
Related
Everytime I execute my python code, it gives me the above ModuleNotFound error when I execute with python3. With python, it gives me an ImportError.
I have updated setuptools using pip install --upgrade setuptools.
I have also tried multiple commands such as: pip install mysqlclient, pip install MySQL-python, pip install pymysql.
I have tried these commands with pip3 as well (Not sure if it makes a difference).
Everytime I try these commands, it gives me the following error:
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/0y/xsr1t8rs36l0vlq3_f2q42g40000gn/T/pip-install-soxlcjei/mysqlclient/setup.py", line 16, in <module>
metadata, options = get_config()
File "/private/var/folders/0y/xsr1t8rs36l0vlq3_f2q42g40000gn/T/pip-install-soxlcjei/mysqlclient/setup_posix.py", line 51, in get_config
libs = mysql_config("libs")
File "/private/var/folders/0y/xsr1t8rs36l0vlq3_f2q42g40000gn/T/pip-install-soxlcjei/mysqlclient/setup_posix.py", line 29, 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/0y/xsr1t8rs36l0vlq3_f2q42g40000gn/T/pip-install-soxlcjei/mysqlclient
How do I fix this? I am using a macOS High Sierra. I have gone through solutions for similar problems on ubuntu/debian systems and have to tried to apply it here. None of that works on a mac. Also, i already have mysql installed and it works perfectly. It is constantly running on my system.
you should download a tar named as Mysql-python-1.2.4b4.tar.gz, and unzip it, cd to the dir and update the file site.cfg: # mysql_config = /usr/local/mysql/bin/mysql_config to mysql_config = /usr/local/mysql/bin/mysql_config
and then python setup.py install, after you installed the mysql-python,then you can not get the error.
I cannot seem to understand why I am getting this issue whenever I am running the command pip install MySQL-python in Ubuntu. This is what I am getting.
pip install MySQL-python
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020.
Please upgrade your Python as Python 2.7 won't be maintained after that
date. A future version of pip will drop support for Python 2.7.
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-dggKCf/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-dggKCf/MySQL-python/
Your version of python is close to the end, so you are invited to upgrade your python's version.
Mysql-python needs this old version of python and become deprecated.
i'm trying to update the pyodbc package from 4.0.16 to 4.0.22.
i dont have internet access on the machine i'm working on so downloaded the file and copied to across the network.
running
pip install S:\Temp\PMCD\pyodbc-4.0.22-py27hc56fc5f_0(1).tar.bz2
results in the following error:
Processing s:\temp\pmcd\pyodbc-4.0.22-py27hc56fc5f_0(1).tar.bz2
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
IOError: [Errno 2] No such file or directory: 'c:\\users\\adm_pa~2\\appdata\\local\\temp\\2\\pip-yf25bd-build\\setup.py'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\adm_pa~2\appdata\local\temp\2\pip-yf25bd-build\
setuptools has already been updated to latest(38.5.1) and pip as well (9.0.1)
i used pip to update setuptools and pip itself (via downloaded whl files), so i dont think pip is an issue.
i already managed to sucessfully upgrade pyodbc on my local machine from 16 to 22, so the whl file i have not sure whats going on.
Any ideas whats going on?
Could i manually unzip the package and place it directly in the site-packages? that didnt seem to do anything.
If your target machine does not have a direct Internet connection you can still install pyodbc by
using another machine to download the appropriate wheel (.whl) file from PyPI,
copying that file to your target machine (via LAN, SneakerNet, ...), and
using pip install <wheel_file_location>
For example,
pip install C:\__tmp\pyodbc-4.0.22-cp27-cp27m-win_amd64.whl
The naming convention for wheel files is described in PEP 491.
The 64-bit wheel files for Windows are tagged as "win_amd64" because that's what the Windows version of distutils reports as the platform:
>>> from distutils import util
>>> distutils.util.get_platform()
'win-amd64'
I have a EC2 instance created on AWS and use PuTTY to connect to it.
I'm unable to install MySQL-python using python pip command as follows:
pip install MySQL-python(via root privileges)
Here is the console output of the error
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 20, in <module>
File "/tmp/pip-build-JGbAEI/MySQL-python/setup.py", line 17, in <module>
metadata, options = get_config()
File "/tmp/pip-build-JGbAEI/MySQL-python/setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "/tmp/pip-build-JGbAEI/MySQL-python/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-JGbAEI/MySQL-python
However I'm able to install other packages using pip
Please Guide.
mysql_config is available after installation of the following package on Amazon Linux:
sudo yum install -y mysql-devel
It looks like mysql_config is missing, so make sure mysql_config is really installed.
For example on Debian/Ubuntu you must install the package:
sudo apt-get install libmysqlclient-dev
I use macports and I have successfully install mysql5 using macports, and my python also managed by macports. Currently I am trying to do pip install mysql-python on my virtualenv but I am getting an error which says, mysql_config not found:
~/code]$pip install mysql-python
Downloading/unpacking mysql-python
Running setup.py egg_info for package mysql-python
sh: mysql_config: command not found
Traceback (most recent call last):
File "<string>", line 16, in <module>
File "~/myVirtualEnv/build/mysql-python/setup.py", line 18, 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 16, in <module>
File "~/myVirtualEnv/build/mysql-python/setup.py", line 18, 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
I read many google examples but more I read helped me to confuse myself further.
Looks like macport have had a issue but it has been closed for while.. http://trac.macports.org/ticket/6982
MacPort creates a symbolic link mysql_config5 in /opt/local/bin to /opt/local/lib/mysql5/bin/mysql_config. Create another link called mysql_config.
cd /opt/local/bin
sudo ln -s /opt/local/lib/mysql5/bin/mysql_config .
I seem to recall having to create a my.cnf too. By default Mac OSX uses all the defaults and doesn't create a my.cnf, create one /etc/my.cnf, it can be trivial.
Mine is just:
[mysqld]
bind-address = 0.0.0.0
port = 3306
mysql_config is an executable that it is in the libmysqlclient package so you need to install. On Deb systems you could install this using
sudo apt-get install libmysqlclient-dev
in RPM
RPM equivalent: sudo yum install mysql-devel
in mac maybe
Macports - port install mysql5 +server
Add /opt/local/lib/mysql5/bin/ to your command search path and then rerun the "pip install" command should solve the problem.
export PATH=/opt/local/lib/mysql55/bin/:$PATH
pip install mysql-python
I encountered the same issue, and solved it:
Install mysql. If you have installed it, ignore this step.
yum install mysql-devel
If you encountered error like Python.h: No such file or directory,
run yum -y install python-devel