When installing mysqldb on mac osx 10.5:
sudo ../bin/python /Users/Awais/mysqlpython/setup.py install
I get the following error:
Traceback (most recent call last):
File "/Users/Awais/mysqlpython/setup.py", line 15, in <module>
metadata, options = get_config()
File "/Users/Awais/mysqlpython/setup_posix.py", line 32, in get_config
metadata, options = get_metadata_and_options()
File "/Users/Awais/mysqlpython/setup_common.py", line 7, in get_metadata_and_options metadata = dict(config.items('metadata'))
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ConfigParser.py", line 564, in items
raise NoSectionError(section)
ConfigParser.NoSectionError: No section: 'metadata'
It seems that you are installing MySQL for Python but you have to have MySQL installed first. So, first download the MySQL installer from http://dev.mysql.com/downloads/mysql/ and install it and then try installing MySQL for Python.
I am trying port an older Linux server RH EL 5 Workstation to CentOS 6.4 64-bit. One of the two things I have had to do -- because it had been a while since I had built a Python-based MySQL server -- was make sure mysql-devel was installed, and from the menu-software install, as well as MySQL-python was installed.
The advantage to installing MySQL-python this way that the CentOS 6.4 distribution matches MySQL-python-1.2.3-0.3.c1.1.el6.x86_64 matches the version of MySQL installed 5.1.69.
Prior to this, I tried building and installing MySQL-python with no success. In a perfect world, I would figure out why, but, like many things, I am on a deadline, and this worked, and was also recommended in posts I read both on SO and elsewhere.
Related
Setup Details:
1x EC2 running Ubuntu 14.04 with Postgres 9.3,
1x RDS running Postgres 9.3
I am trying to move a postgres database that I have on an EC2 onto an RDS. I am using Londiste, which is recommended by AWS for migrating databases with minimal downtime. Specifically, I am using Londiste/Skytools 2.1.13, because Londiste3 requires superuser privileges on both systems.
I have tried installing Skytools both via the zip from their website and via apt-get (both 2.1.13). I have installed what I believe to be all of the dependencies: postgres,libpq-dev, postgresql-server-dev-9.3, pip, and psycopg2.
Regardless, whenever I try to use any skytools commands, I get the following error:
Traceback (most recent call last):
File "/usr/local/bin/pgqadm.py", line 9, in
from pgq.ticker import SmartTicker File "/usr/local/lib/python2.7/dist-packages/pgq/init.py", line 6, in
import pgq.consumer File "/usr/local/lib/python2.7/dist-packages/pgq/consumer.py", line 6,
in
from pgq.baseconsumer import BaseConsumer, BaseBatchWalker File "/usr/local/lib/python2.7/dist-packages/pgq/baseconsumer.py", line 75,
in
class BaseConsumer(skytools.DBScript): File "/usr/local/lib/python2.7/dist-packages/skytools/apipkg.py", line 114,
in __makeattr
result = importobj(modpath, attrname) File "/usr/local/lib/python2.7/dist-packages/skytools/apipkg.py", line 37,
in importobj
module = import(modpath, None, None, ['doc']) File "/usr/local/lib/python2.7/dist-packages/skytools/scripting.py", line
23,
in
default_skylog = skytools.installer_config.skylog
AttributeError: 'module' object has no attribute 'skylog'
Am I missing a dependency? (Skylog seems to be a part of skytools, so I've concluded it's not that.) Has anyone else hit this issue? (There don't seem to be any google results with this error.) Thanks!
tl;dr:
make sure you're running pgqadm.py that is in your local skytools-2.x.y installation directory, eg: ./python/pgqadm.py ticker.ini install
This can be a problem if you have previously installed Skytools 3.x, which may come up first in your PATH.
Background
I just ran into this same issue. I have the same use case (migrating pg->rds), and followed the same recommendation from the AWS documentation.
I had initially installed Skytools 3.x before noticing that it requires superuser privileges on the would-be replica. which pgqadm.py returns /usr/bin/pgqadm.py, which is an artifact of my abandoned Skytools 3.x installation.
I became suspicious of a version conflict when I went to the Skytools source repository looking for instances of skylog. The first result was here:
https://github.com/pgq/skytools-legacy/blob/11afc5210a92d4a2ccf701e4f92138488c31a3cb/python/skytools/installer_config.py.in
However, I realized that this repository is now tracking the latest 3.x release. I switched to the apparent 2.1.x branch, and skylog was nowhere to be found, as expected:
https://github.com/pgq/skytools-legacy/blob/skytools_2_1_stable/python/skytools/installer_config.py.in
Fully-qualifying the path to pgqadm.py resolves this issue in this case.
I used easy_install to install pip, pip to install django, virtualenv, and virtualenvwrapper.
I have just returned to it a few weeks later and django does not seem to work anymore, but more concerning is I can't start the process over again as easy_install is returning the following error:
Traceback (most recent call last):
File "/usr/bin/easy_install-2.7", line 10, in <module>
load_entry_point('setuptools==0.6c12dev-r88846', 'console_scripts', 'easy_install')()
File "/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 318, in load_entry_point
File "/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 2220, in load_entry_point
ImportError: Entry point ('console_scripts', 'easy_install') not found
After a good evening of hunting I am stumped as to how to resolve this.
You seem to have a version conflict; note the setuptools-0.6c11-py2.7.egg path, but the /usr/bin/easy_install-2.7 script wants to load 0.6c12dev-r88846 instead.
The latter is a development version; it has the revision number of a subversion repository embedded in the version (dev-r88846).
I suspect you have two python installations; one is the system version (in /System/Library and the other is installed with the python installer into /Library/, and the stub script in /usr/bin/ may be installed with the system python.
If so, there'll be another copy of the stub at /Library/Python/2.7/bin/easy_install-2.7, which should work correctly.
I had the same issue, eventually ended up running the 2.7.3 easy_install by
/opt/python2.7.3/bin/easy_install which worked fine
This question already has answers here:
installing MySQLdb for Python 2.6 on OSX [duplicate]
(4 answers)
Closed 9 years ago.
*My larger problem is that I cannot launch a web application using dev_apperver.py from my command line*
However, I also cannot install MySQLdb as well.
Joes-MacBook-Pro:MySQL-python-1.2.3 MoeJancini$ python setup.py build
sh: mysql_config: command not found
Traceback (most recent call last):
File "setup.py", line 15, in <module>
metadata, options = get_config()
File "/Users/MoeJancini/Desktop/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "/Users/MoeJancini/Desktop/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
Joes-MacBook-Pro:MySQL-python-1.2.3 MoeJancini$
I have looked at similar questions an navigated other forums but I still cannot get past the setup.py build command. Explicit instructions on how to get MySQLdb working would be useful since I'm a noob. Thank you
It depends on what your source for MySQL is. If you're using MacPorts, you may find that you have to use mysql_config5in order for it to work. Edit site.cfg so that it has the right path. Then again, if you're using MacPorts, you should just sudo port install py-mysql and that will install it for you.
So if you're not using MacPorts, you're probably using the mysql.com packages. In that case, you need to install their Connector/C package, which includes development headers and libraries and mysql_config.
I am trying to setup the environment in Ubuntu (making a shift from
MS-Windows).
It has, of course, Python 2.6.
I did setup MySQL 5512 and MySQLdb from 'Ubuntu Software Centre'.
import dabo
import MySQLdb
works OK. No error.
But while establishing a connection, is says that there is a mismatch in
versions of MySQLdb & _mysql.
ImportError: this is MySQLdb version (1, 2, 3, 'gamma', 1), but _mysql
is version (1, 2, 2, 'final', 0)
How do I solve this?
Complete traceback ---->
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "dabovmd/hotel.py", line 4, in <module>
empconn = dabo.db.dConnection(empci)
File "dabo/db/dConnection.py", line 32, in __init__
self._connection = self._openConnection(**kwargs)
File "dabo/db/dConnection.py", line 80, in _openConnection
return
self._connectInfo.getConnection(forceCreate=self._forceCreate, **kwargs)
File "dabo/db/dConnectInfo.py", line 105, in getConnection
return self._backendObject.getConnection(self, **kwargs)
File "dabo/db/dbMySQL.py", line 25, in getConnection
import MySQLdb as dbapi
File "/media/pyth/python26/Lib/site-packages/MySQLdb/__init__.py",
line 23, in <module>
(version_info, _mysql.version_info))
ImportError: this is MySQLdb version (1, 2, 3, 'gamma', 1), but _mysql
is version (1, 2, 2, 'final', 0)
Thanks in advance,
Vineet
This seems like a version mismatch between your MySQL-server and your python-mysqldb.
Which version of Ubuntu are you using? (If you have recently shifted over, then try using Ubuntu 11.04).
The easiest way to solve your problem would be to update your ubuntu to atleast 11.04 and then to install matching versions of mysql-server and python-mysqldb.
I am using Ubuntu 11.04 and my mysql-server version is 5.1.54-1ubuntu4 and my python-mysqldb version is 1.2.2-10build2.
Hope this helps
This may not be suitable for your needs, but I've found MySQL Connector/Python to be much much easier to set up than MySQLdb. It's implemented entirely in Python, so it doesn't care about the C interface libraries.
This solution has a couple of downsides. It's supposed to be slower. And more importantly in your case, I know nothing about Dabo so I have no idea if it's possible to sub in a different MySQL interface.
It seems that each of apt-get and pip installed their own version of the library.
Try removing system mysql with sudo apt-get remove python-mysqldb, and
you should have something like this:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
python-mysqldb
0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded.
After this operation, 196 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 109333 files and directories currently installed.)
Removing python-mysqldb (1.2.3-2ubuntu1) ...
Please don't do what has been suggested above...
use these commands in your MySQLdb folder:
sudo apt-get install libmysqlclient-dev
sudo apt-get install python-dev
sudo python setup.py install
I'm trying to use MySQL with django and right now the following isn't executing properly:
python manage.py syncdb
I also downloaded the Mysql-python interpreter and ran the following lines but still an error:
python setup.py build
sudo python setup.py install
Traceback (most recent call last):
File "setup.py", line 15, in <module>
metadata, options = get_config()
File "/Users/user/Downloads/MySQL-python-1.2.3/setup_posix.py", line 49, in get_config
libs = mysql_config("libs")
File "/Users/user/Downloads/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: /usr/local/bin/mysql_config not found
I think it's having trouble finding mysql_config, is there a way that I can point the setup to the file? Right now my setup.py is in ~/Downloads and mysql is in /usr/local/mysql/bin
It seems you may not have any of the MySQL client applications installed. If you are using Linux (and this varies from distribution to distribution), the package you will need to install on Ubuntu is "mysql-client".
From the path you show, I'm guessing you are running on Mac OS X (you really need to state what platform you are using and what version of Python you are running). However, if you are on Mac OS X, your best bet by far is to use a complete solution of installing compatible versions of Python, MySQL client libraries, MySQLdb, and Django by using one of the third-party open source package managers on OS X: MacPorts, homebrew, Fink, or others.
See, for example, the answer here.
The answer was to edit the site.cfg file so that it points to the mysql_config file in the /usr/local/mysql dir