python manage.py sql is throwing a no suitable image found exception - python

I have macbook pro running OS X 10.7 on Intel processor. I have installed Django 1.3.1, MySQL-python 1.2.3. All the packages installed fine. When I execute command "python manage.py sql poll", I'm running into the following exception.
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 67, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Library/Python/2.7/site-packages/django/core/management/commands/sql.py", line 4, in <module>
from django.core.management.sql import sql_create
File "/Library/Python/2.7/site-packages/django/core/management/sql.py", line 6, in <module>
from django.db import models
File "/Library/Python/2.7/site-packages/django/db/__init__.py", line 78, in <module>
connection = connections[DEFAULT_DB_ALIAS]
File "/Library/Python/2.7/site-packages/django/db/utils.py", line 93, in __getitem__
backend = load_backend(db['ENGINE'])
File "/Library/Python/2.7/site-packages/django/db/utils.py", line 33, in load_backend
return import_module('.base', backend_name)
File "/Library/Python/2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Library/Python/2.7/site-packages/django/db/backends/mysql/base.py", line 14, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Users/khoa/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg-tmp/_mysql.so, 2): no suitable image found. Did find:
/Users/khoa/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg-tmp/_mysql.so: mach-o, but wrong architecture

Chances are that the Python you are using (the Apple-supplied Python 2.7.1, perhaps) is running in 64-bit mode but the MySQLdb extension module that you've installed is 32-bit only. Or, possibly, the reverse. The output of this shell command should tell you what architectures the extension module was compiled for:
file /Users/khoa/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg-tmp/_mysql.so
The MySQLdb extension module and the MySQL client libraries you've installed must have a common architecture with the architecture that the Python instance you are using.

Related

Hue Installation Issue - Mac OS

I am trying to setup Hue on my Mac.
This is the GitHub link I referred to:
https://github.com/cloudera/hue#development-prerequisites
$ git clone https://github.com/cloudera/hue.git
$ cd hue
$ make apps
Getting this error:: when running build/env/bin/hue runserver
hue soundarya$ build/env/bin/hue runserver
Validating models...
Unhandled exception in thread started by <function wrapper at 0x108be1cf8>
Traceback (most recent call last):
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/utils/autoreload.py", line 93, in wrapper
fn(*args, **kwargs)
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/core/management/commands/runserver.py", line 102, in inner_run
self.validate(display_num_errors=True)
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/core/management/base.py", line 310, in validate
num_errors = get_validation_errors(s, app)
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/core/management/validation.py", line 34, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/loading.py", line 196, in get_app_errors
self._populate()
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/loading.py", line 78, in _populate
self.load_app(app_name)
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/loading.py", line 99, in load_app
models = import_module('%s.models' % app_name)
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/Users/soundarya/virtenv/hue_venv/hue/apps/jobbrowser/src/jobbrowser/models.py", line 20, in <module>
import lxml.html
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/lxml-3.3.6-py2.7-macosx-10.11-intel.egg/lxml/html/__init__.py", line 42, in <module>
from lxml import etree
ImportError: dlopen(/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/lxml-3.3.6-py2.7-macosx-10.11-intel.egg/lxml/etree.so, 2): Library not loaded: libxml2.2.dylib
Referenced from: /Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/lxml-3.3.6-py2.7-macosx-10.11-intel.egg/lxml/etree.so
Reason: Incompatible library version: etree.so requires version 12.0.0 or later, but libxml2.2.dylib provides version 10.0.0
Can anyone help me with this issue?
Prerequisites are not yet satisfied. You have to install all the requirements listed here: Development Prerequisites. To ged rid of this error, you have to install python2.7-dev package(not python2.7-devel) and also other requirements.

Django Error loading MySqlDB module

I'm new with Django and I follow a tuto. The problem is that the tuto uses Sqlite but I want to use MySql server instead. I changed the parameters following documentation but I have the following error when I try to run the server. I already found some resolve but it didn't work...
For your information, I installed MySql-Python and reinstall Django with PIP. Without any success. I hope you will be able to help me.
Traceback :
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\adescamp>cd C:\Users\adescamp\agregmail
C:\Users\adescamp\agregmail>python manage.py runserver 8000
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 399, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 280, in execute
translation.activate('en-us')
File "C:\Python27\lib\site-packages\django\utils\translation\__init__.py", line 130, in activate
return _trans.activate(language)
File "C:\Python27\lib\site-packages\django\utils\translation\trans_real.py", line 188, in activate
_active.value = translation(language)
File "C:\Python27\lib\site-packages\django\utils\translation\trans_real.py", line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "C:\Python27\lib\site-packages\django\utils\translation\trans_real.py", line 159, in _fetch
app = import_module(appname)
File "C:\Python27\lib\site-packages\django\utils\importlib.py", line 40, in import_module
__import__(name)
File "C:\Python27\lib\site-packages\django\contrib\admin\__init__.py", line 6, in <module>
from django.contrib.admin.sites import AdminSite, site
File "C:\Python27\lib\site-packages\django\contrib\admin\sites.py", line 4, in <module>
from django.contrib.admin.forms import AdminAuthenticationForm
File "C:\Python27\lib\site-packages\django\contrib\admin\forms.py", line 6, in <module>
from django.contrib.auth.forms import AuthenticationForm
File "C:\Python27\lib\site-packages\django\contrib\auth\forms.py", line 17, in <module>
from django.contrib.auth.models import User
File "C:\Python27\lib\site-packages\django\contrib\auth\models.py", line 48, in <module>
class Permission(models.Model):
File "C:\Python27\lib\site-packages\django\db\models\base.py", line 96, in __new__
new_class.add_to_class('_meta', Options(meta, **kwargs))
File "C:\Python27\lib\site-packages\django\db\models\base.py", line 264, in add_to_class
value.contribute_to_class(cls, name)
File "C:\Python27\lib\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 "C:\Python27\lib\site-packages\django\db\__init__.py", line 34, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "C:\Python27\lib\site-packages\django\db\utils.py", line 198, in __getitem__
backend = load_backend(db['ENGINE'])
File "C:\Python27\lib\site-packages\django\db\utils.py", line 113, in load_backend
return import_module('%s.base' % backend_name)
File "C:\Python27\lib\site-packages\django\utils\importlib.py", line 40, in import_module
__import__(name)
File "C:\Python27\lib\site-packages\django\db\backends\mysql\base.py", line 17, in <module>
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e) django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
Thank you!
I found the solution!
I had to install mysql-python. Easy but: don't do that with PIP because it won't work. You have to install mysql-p
as you are running python on windows. Pip install mysql-python won't work. Try using python-mysql from here http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python

How can I create a project on Django using Elementary os?

I'm having troubles when I try to create my project on Django.
Error message:
django-admin.py startproject car
Traceback (most recent call last):
File "/usr/local/bin/django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 272, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 77, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/local/lib/python2.7/site-packages/django/core/management/commands/startproject.py", line 2, in <module>
from django.core.management.templates import TemplateCommand
File "/usr/local/lib/python2.7/site-packages/django/core/management/templates.py", line 20, in <module>
from django.template import Template, Context
File "/usr/local/lib/python2.7/site-packages/django/template/__init__.py", line 53, in <module>
from django.template.base import (ALLOWED_VARIABLE_CHARS, BLOCK_TAG_END,
File "/usr/local/lib/python2.7/site-packages/django/template/base.py", line 12, in <module>
from django.utils.text import (smart_split, unescape_string_literal,
File "/usr/local/lib/python2.7/site-packages/django/utils/text.py", line 6, in <module>
from gzip import GzipFile
File "/usr/local/lib/python2.7/gzip.py", line 9, in <module>
import zlib
ImportError: No module named zlib
(I already have Python 2.7 and Django 1.5.1 installed)
You should read your errors more carefuly.
ImportError: No module named zlib

Running Django development server

I'm trying to create and run a project.
I used the following article:
https://docs.djangoproject.com/en/dev/intro/tutorial01/?from=olddocs
When I'm running the following command
C:\django\mysite>python manage.py runserver
This error shows up:
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 438, in execute_manager
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 67, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "C:\Python27\lib\site-packages\django\utils\importlib.py", line 35, in import_module
__import__(name)
File "C:\Python27\lib\site-packages\django\contrib\staticfiles\management\commands\runserver.py", line 4, in <module>
from django.core.management.commands.runserver import BaseRunserverCommand
File "C:\Python27\lib\site-packages\django\core\management\commands\runserver.py", line 8, in <module>
from django.core.handlers.wsgi import WSGIHandler
File "C:\Python27\lib\site-packages\django\core\handlers\wsgi.py", line 10, in <module>
from django import http
File "C:\Python27\lib\site-packages\django\http\__init__.py", line 117, in <module>
from django.core import signing
ImportError: cannot import name signing
Here is what I would do.
Try to use virtualenv.
there might be some old python modules that mess up your django for some reason.
So use virtualenv to create a fresh python.
and install django with pip install.
if it solves the problem its definetely your system python that is messing things up a little bit.

Problem of setting up a python app

Hey guys
I'm new to Python, I want to install this python app called mirosubs on my VPS, and I followed the installation guide in this github pages, when I got to the step 8:
python manage.py syncdb
I got the following error:
root#makserver:/usr/local/src/mirosubs# python manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 35, in <module>
execute_manager(settings)
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/core/management/__init__.py", line 438, in execute_manager
utility.execute()
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/core/management/__init__.py", line 379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/core/management/__init__.py", line 67, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/local/lib/python2.6/dist-packages/South-0.7.3-py2.6.egg/south/management/commands/__init__.py", line 10, in <module>
import django.template.loaders.app_directories
File "/usr/local/lib/python2.6/dist-packages/Django-1.2.5-py2.6.egg/django/template/loaders/app_directories.py", line 23, in <module>
raise ImproperlyConfigured('ImportError %s: %s' % (app, e.args[0]))
django.core.exceptions.ImproperlyConfigured: ImportError haystack: cannot import name Thumbnail
Anybody can tell me how to solve this problem?
The module haystack is trying to import a type called Thumbnail but can't find it. Do a search through the source for Thumbnail and try to determine what's happening.

Categories