Newbie: install issues
sevenreeds opened this issue · comments
Hi,
I am new to python and MySQLdb1 but i am not new to linux or programming. My eventual goal is to use Django and MySQL for a RESTful app. I am on a "managed" RedHat CloudLinux Server release 6.5. I DO NOT have root or sudo access on this machine. Python 2.6.6 is native on the machine. I have downloaded and installed "pip" into my login account. I installed the current Django using pip as well as mysql-python.
Django seems to have installed correctly. I'm not sure about mysql-python though for two reasons: 1) when I tried the Django tutorial that would initialize the databases it fails saying that "django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb".
The pip install of mysql-python looked like:
$ pip install mysql-python
Downloading/unpacking mysql-python
Downloading MySQL-python-1.2.5.zip (108kB): 108kB downloaded
Running setup.py (path:/tmp/pip_build_MYUSER/mysql-python/setup.py) egg_info for package mysql-python
Installing collected packages: mysql-python
Running setup.py install for mysql-python
building '_mysql' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/include/python2.6 -c _mysql.c -o build/temp.linux-x86_64-2.6/_mysql.o -g -DUNIV_LINUX -DUNIV_LINUX
In file included from _mysql.c:44:
/usr/include/mysql/my_config.h:1088:1: warning: "HAVE_WCSCOLL" redefined
In file included from /usr/include/python2.6/pyconfig.h:6,
from /usr/include/python2.6/Python.h:8,
from _mysql.c:29:
/usr/include/python2.6/pyconfig-64.h:808:1: warning: this is the location of the previous definition
gcc -pthread -shared build/temp.linux-x86_64-2.6/_mysql.o -L/usr/lib64/mysql -L/usr/lib64 -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -lm -lpthread -lmygcc -lpython2.6 -o build/lib.linux-x86_64-2.6/_mysql.so
Successfully installed mysql-python
Cleaning up...
The Django error trace is:
$ python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/MYHOMEDIR/.local/lib/python2.6/site-packages/django/core/management/init.py", line 399, in execute_from_command_line
utility.execute()
File "/MYHOMEDIR/.local/lib/python2.6/site-packages/django/core/management/init.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/MYHOMEDIR/.local/lib/python2.6/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(_args, *_options.dict)
File "/MYHOMEDIR/.local/lib/python2.6/site-packages/django/core/management/base.py", line 280, in execute
translation.activate('en-us')
File "/MYHOMEDIR/.local/lib/python2.6/site-packages/django/utils/translation/init.py", line 130, in activate
return _trans.activate(language)
File "/MYHOMEDIR/.local/lib/python2.6/site-packages/django/utils/translation/trans_real.py", line 188, in activate
_active.value = translation(language)
File "/MYHOMEDIR/.local/lib/python2.6/site-packages/django/utils/translation/trans_real.py", line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/MYHOMEDIR/.local/lib/python2.6/site-packages/django/utils/translation/trans_real.py", line 159, in _fetch
app = import_module(appname)
File "/MYHOMEDIR/.local/lib/python2.6/site-packages/django/utils/importlib.py", line 40, in import_module
import(name)
File "/MYHOMEDIR/.local/lib/python2.6/site-packages/django/contrib/admin/init.py", line 6, in
from django.contrib.admin.sites import AdminSite, site
File "/MYHOMEDIR/.local/lib/python2.6/site-packages/django/contrib/admin/sites.py", line 4, in
from django.contrib.admin.forms import AdminAuthenticationForm
File "/MYHOMEDIR/.local/lib/python2.6/site-packages/django/contrib/admin/forms.py", line 6, in
from django.contrib.auth.forms import AuthenticationForm
File "/MYHOMEDIR/.local/lib/python2.6/site-packages/django/contrib/auth/forms.py", line 17, in
from django.contrib.auth.models import User
File "/MYHOMEDIR/.local/lib/python2.6/site-packages/django/contrib/auth/models.py", line 48, in
class Permission(models.Model):
File "/MYHOMEDIR/.local/lib/python2.6/site-packages/django/db/models/base.py", line 96, in new
new_class.add_to_class('_meta', Options(meta, **kwargs))
File "/MYHOMEDIR/.local/lib/python2.6/site-packages/django/db/models/base.py", line 264, in add_to_class
value.contribute_to_class(cls, name)
File "/MYHOMEDIR/.local/lib/python2.6/site-packages/django/db/models/options.py", line 124, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "/MYHOMEDIR/.local/lib/python2.6/site-packages/django/db/init.py", line 34, in getattr
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "/MYHOMEDIR/.local/lib/python2.6/site-packages/django/db/utils.py", line 198, in getitem
backend = load_backend(db['ENGINE'])
File "/MYHOMEDIR/.local/lib/python2.6/site-packages/django/db/utils.py", line 113, in load_backend
return import_module('%s.base' % backend_name)
File "/MYHOMEDIR/.local/lib/python2.6/site-packages/django/utils/importlib.py", line 40, in import_module
import(name)
File "/MYHOMEDIR/.local/lib/python2.6/site-packages/django/db/backends/mysql/base.py", line 17, in
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
ideas?
Doh! this always happens. I write the request then find the answer.
I scrubbed my "local" python install and reinstalled everything. This time I found that you can user the "--user" clause when installing
pip install --user mysql-python
and something similar for django and that looks like it worked