Mysqlclient fails to install - python

I am trying to install mysqlclient on mac to use mysql in a django project. I have made sure that setup tools is installed and that mysql connector c is installed as well. I keep getting the error Command "python setup.py egg_info" failed with error code 1 in. This is my first django project since switching from rails. Is there something I am missing? I am using python 3 and I use pip install mysqlclient.

I was able to fix this by running pip install mysql. I do not understand why this worked because I already had MySQL installed on my system and had been using it.
I am going to assume it is because Python uses environments and MySQL wasn't installed in the environment but I would like to know for sure.

Related

Command "python setup.py egg_info" failed with error code 1 with table package

I am trying to install a specific version of python package tables==2.4.0 for some reasons. But every time I am getting the error
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-tJYQ8o/tables/.
If I try with pip install tables, then this works fine and tables package with version 3.4.3 will be installed. But I need specifically 2.4.0 or 2.x.
I have also checked
https://stackoverflow.com/questions/44981793/python-setup-py-egg-info-failed-with-error-code-1
and
https://stackoverflow.com/questions/35991403/pip-install-returns-python-setup-py-egg-info-failed-with-error-code-1
but didn't get success.I also tried virtualenv, the same error is coming with this version and latest version is working fine.I am using virtualenv for python version 2.7.12 in Ubuntu 14.04. Can anybody suggest me for this issue.
Thanks.
I think the problem is that the version of tables you want to install (2.4.0) is not compatible with the version of numpy you have installed. The incompatibility is due to a bug in setup.py that comes with the tables package.
See the following bug report https://github.com/PyTables/PyTables/issues/601
The person that reported the bug provides a patch here: https://gist.github.com/prehensilecode/2eb790476c38299e520ce5ea40896e08
To try and fix this myself I downloaded the 2.4.0 table package (pip download tables==2.4.0) and applied the patch to setup.py
I made sure I had the tables dependencies installed (numpy, numexpr and cython), and you will also need to make sure you install the necessary HDF5 files (sudo apt install libhdf5-serial-dev) then I ran:
sudo python setup.py install --hdf5=/usr/lib/i386-linux-gnu/hdf5/serial/
The path to your HDF5 files may be different to mine of course.
import tablesfrom a python prompt then works

Can't install MySQL-python [CentOS]

I need mysql-python on my CentOS 7 server to run a script I wrote. I haven't found any success installing it I always get the following error:
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-
build-mpl_yksf/mysql-python/
I am running CentOS 7 and accessing my machine through ssh.
I have tried the following:
-Installing mysql-python on Centos
-can't install MySQL-Python
python-dev is installed hopefully for the right version of python, gcc is also installed in fact I run:
# yum groupinstall "Developper Tools"
-mysql_config not found when installing mysqldb python interface
Tried the solution provided here to install the package directly in the same directory as python 3.7 instead of the default one which was the one containing python 2.7:
https://unix.stackexchange.com/questions/323532/yum-install-package-name-to-different-directory
I
# yum --installroot=/usr/local/bin/ --releasever=/ install MySQL-python
Per this I can't simply uninstall python 2.6:
-How to uninstall Python2.6
And I don't think simply creating an alias will solve my problem generally python 3 launches automatically not python 2 but my problem is regarding mysql-python
Essentially I think I have narrowed it down to the fact that I don't have mysql-python accessible to pthon 3.7 for some reason. It seems my 2 versions of python are somehow conflicting. I am wondering what I can do to fix this ? Before you suggest I tried running my program through python 2 but some exceptions I have to catch were not yet available.
All I want to do is get rid of this error message:
ModuleNotFoundError: No module named 'mysql'
Could someone please help me ? I wasn't sure whether it was better to post in unix.stackexchange.com but it seems appropriate to stackoverflow
The error you are getting (Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-mpl_yksf/mysql-python/) is because of a missing package ConfigParser.
In Python 3, ConfigParser was renamed to be configparser (all lowercase) to comply with PEP 8 standards. As of now, MySQL-python has not been updated to support Python 3.
You are left with two choices:
Use Python 2 for whatever you are trying to do. This implies using pip2 command instead of pip3.
Use an alternative package, such as mysqlclient.
To install mysqlclient, you will first need libmysqlclient-devel. Then you can install the Python 3 module via pip.
$ pip3 install mysqlclient

Cant find pg_config even after installing Postgres 9.5

I have been trying to debug this for quite a while now (and read lots of related Q/A on StackOverflow) but unable to figure this out.
Trying to setup Django on my Mac OS X 10.11.6. I followed the detailed tutorial. This is what I did:
1) Installed Python 3.5.2 (by directly downloading the package from the Python web site and running it).
2) Installed PostGres 9.5 using the fink package (fink install postgresql95)
3) Installed psycopg2 using the fink package (fink install psycopg2-py35).
4) Updated pip.
5) Setup a virtual environment and activated it.
6) After activating the environment, installed Django (via pip).
Next, when I tried to setup a sample app in the environment and ran python manage.py migrate, it gave me the error : Error loading psycopg2 module: No module named 'psycopg2'
After reading a lot of posts on StackOverflow, it seemed that I have to install psycopg2 again within the virtualenv (and for some reason, I cant use Fink again?). So as suggested on some posts, I tried to install it using:
pip install psycopg2
Got this error:Error: pg_config executable not found.
I am sure my Fink install of Postgres 9.5 was successful earlier, so I tried to search for pg_config from root dir:
sudo find . -name "pg_config"
But it returned nothing!
My question is, is it possible that fink package did not come with pg_config? If it didnt, is my only option now to uninstall postgres and install it with another package? (FYI: I was able to start PostGres and create a user and a database on it already)
Thanks in advance,
Anupam
Update: After waiting a while to get answers from SO, I gave up and just uninstalled the postgres fink package. Then installed the postgres.app instead, on my mac. Working fine for me. The command python manage.py migrate worked fine for me this time and the psycopg2 installation also went fine (with pip). I wonder why the psycopg2 installation page (http://initd.org/psycopg/docs/install.html#installation) only mentions Fink and MacPorts as the installation options especially when the Fink packages dont seem to be very reliable. I had posted a message on the Fink users group also about improving the installation documentation in another context but didnt get a response : (

Installing txMYSQL on Python

I am trying to establish MYSQL connection with my twisted server script. I found out that txMYSQL is a good choice to use, I dowloaded the package out of Github and tried installing from the setup.py file, but it didn't work.
I tried inslalling txMYSQL by using easy_install txmysql but it dosen't appear to be found through this command since its not on pythons server.
How can I install txMYSQL ?
I am currently using python 2.7.8 on my Windows machine.
Try to install using pip and referencing Github repo. I tried here and worked well on a Ubuntu 12.04.4
pip install git+https://github.com/hybridlogic/txMySQL.git

Error installing psycopg2 on Windows using pip and virtualenv

I'm following Heroku's "Getting started with Django on Heroku" article and am getting a long series of errors on "pip install psycopg2". Django 1.4.3 and PostgreSQL 9.2.2 are already installed, and yes, the postgres \bin\ directory is on the PATH.
Any ideas?
It doesn't look like Psycopg on Windows is as simple as using pip. The Psycopg website recommends using these Windows builds.
As a windows users running through the Python Getting Started tutorial on Heroku I ran into a similar issue. I found pycopg2 here: http://www.stickpeople.com/projects/python/win-psycopg/
And then used easy_install in the virtual env directory.

Categories

Resources