ImportError due to missing dependencies

Bug #1125622 reported by Andreas Hasenack on 2013-02-14
126
This bug affects 24 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Medium
Unassigned

Bug Description

Users report seeing ImportErrors during Horizon startup. One of those is "ImportError: cannot import name base" which is a symptom of the failure to load all dependent modules.

The cause therefore would appear to be incomplete or erroneous installation documentation.

Please include the steps used to install Horizon and its dependencies in future reports or they will not be helpful, thanks!

The original bug report follows:

openstack-dashboard 2013.1~g2-0ubuntu1~cloud0

Just reload any page a few times and 50% of the time you will get an internal error, and this in the apache logs:
(...)
[Thu Feb 14 22:30:12 2013] [error] [client 192.168.64.1] File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/api/keystone.py", line 36, in <module>, referer: http://192.168.69.163/horizon
[Thu Feb 14 22:30:12 2013] [error] [client 192.168.64.1] from openstack_dashboard.api import base, referer: http://192.168.69.163/horizon
[Thu Feb 14 22:30:12 2013] [error] [client 192.168.64.1] ImportError: cannot import name base, referer: http://192.168.69.163/horizon

Full backtrace attached.

Andreas Hasenack (ahasenack) wrote :
Jerry Seutter (jseutter) wrote :

This only seems to happen from within apache and mod_wsgi. order of events:

- something imports openstack_dashboard.api
- openstack_dashboard.api.__init__ imports keystone
- openstack_dashboard.api.keystone imports openstack_dashboard.api.base
- openstack_dashboard.api.base doesn't exist yet, because __init__ isn't finished and so openstack_dashboard.api isn't finished importing.

The fix that works here is to make sure base has been imported. openstack_dashboard/api/__init__.py looks like this:
=======
import base #NEW!!
from openstack_dashboard.api.glance import *
from openstack_dashboard.api.keystone import *
from openstack_dashboard.api.nova import *
from openstack_dashboard.api.swift import *
from openstack_dashboard.api.quantum import *
from openstack_dashboard.api.cinder import *
=======
the line that is labelled NEW is, new. Note that trying "import openstack_dashboard.api.base" did not fix the issue.

Changed in horizon:
status: New → Confirmed
Gabriel Hurley (gabriel-hurley) wrote :
Changed in horizon:
importance: Undecided → Medium
milestone: none → havana-1
Andreas Hasenack (ahasenack) wrote :

I don't know, I never saw an import error other than the one exposed here ("base").

Lin Hua Cheng (lin-hua-cheng) wrote :

I also experience the same issue while running in development server (not in apache).

I change the import to base using relative path, then I got another ImportError on cinder..

After bouncing the server, the issue went away. Could not reproduce it now.

David Lyle (david-lyle) wrote :

I have seen this when lazily attempting to edit files in /usr/local/lib/python2.7/dist-packages/ but not in other cases.

Download full text (6.1 KiB)

I have modified the "from openstack_dashboard.api import base, cinder, keystone etc..." to "form openstack_dashboard.api.base import *" format I gave me the "Horizon login screen"

But then , when I login, I get this error

[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] mod_wsgi (pid=31667): Exception occurred processing WSGI script '/usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi'.
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] Traceback (most recent call last):
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] File "/usr/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 241, in __call__
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] response = self.get_response(request)
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 179, in get_response
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 228, in handle_uncaught_exception
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] return callback(request, **param_dict)
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] File "/usr/lib/python2.7/dist-packages/django/utils/decorators.py", line 91, in _wrapped_view
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] response = view_func(request, *args, **kwargs)
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] File "/usr/lib/python2.7/dist-packages/django/views/defaults.py", line 33, in server_error
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] return http.HttpResponseServerError(t.render(Context({})))
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] File "/usr/lib/python2.7/dist-packages/django/template/base.py", line 140, in render
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] return self._render(context)
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] File "/usr/lib/python2.7/dist-packages/django/template/base.py", line 134, in _render
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] return self.nodelist.render(context)
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] File "/usr/lib/python2.7/dist-packages/django/template/base.py", line 823, in render
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] bit = self.render_node(node, context)
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] File "/usr/lib/python2.7/dist-packages/django/template/base.py", line 837, in render_node
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] return node.render(context)
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] File "/usr/lib/python2.7/dist-packages/django/template/loader_tags.py", line 123, in render
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] return compiled_parent._render(context)
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] File "/usr/lib/python2.7/dist-packages/django/template/base.py", line 134, in _render
[Tue May 07 04:57:46 2013] [error] [client 10.232.90.47] ...

Read more...

Gabriel Hurley (gabriel-hurley) wrote :

What's the status of this bug? Is it still reproducible?

Changed in horizon:
milestone: havana-1 → havana-2
status: Confirmed → Triaged
Lin Hua Cheng (lin-hua-cheng) wrote :

I still hit issue from my development environemtn, getting more often.

Ladislav Smola (lsmola) wrote :

http://paste.openstack.org/show/37663/

reverting 8 commits back make this work for me

last working commit:

commit 9be678c189d6515df58cad15cf6fdb2c3380dfde
Merge: 7ab166c decee66
Author: Jenkins <email address hidden>
Date: Wed May 22 07:58:14 2013 +0000

    Merge "Always return a list from VolumeTableMixIn._get*"

Ladislav Smola (lsmola) wrote :

fixed by updating to django 1.5

this bug emerged after though

https://bugs.launchpad.net/horizon/+bug/1183230

Jacob Godin (jacobgodin) wrote :

I'm running into this as well. Running 12.04 with latest from github. python-django 1.4.5, APIs from the Ubuntu Cloud Archive.

Jacob Godin (jacobgodin) wrote :
Download full text (3.4 KiB)

Also, every few refreshes, this error pops up instead of the import base error:

File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  111. response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/share/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py" in dec
  38. return view_func(request, *args, **kwargs)
File "/usr/local/share/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py" in dec
  86. return view_func(request, *args, **kwargs)
File "/usr/local/share/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py" in dec
  54. return view_func(request, *args, **kwargs)
File "/usr/local/share/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py" in dec
  38. return view_func(request, *args, **kwargs)
File "/usr/local/share/horizon/openstack_dashboard/wsgi/../../horizon/decorators.py" in dec
  86. return view_func(request, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/django/views/generic/base.py" in view
  48. return self.dispatch(request, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/django/views/generic/base.py" in dispatch
  69. return handler(request, *args, **kwargs)
File "/usr/local/share/horizon/openstack_dashboard/wsgi/../../horizon/tables/views.py" in get
  155. handled = self.construct_tables()
File "/usr/local/share/horizon/openstack_dashboard/wsgi/../../horizon/tables/views.py" in construct_tables
  146. handled = self.handle_table(table)
File "/usr/local/share/horizon/openstack_dashboard/wsgi/../../horizon/tables/views.py" in handle_table
  118. data = self._get_data_dict()
File "/usr/local/share/horizon/openstack_dashboard/wsgi/../../horizon/tables/views.py" in _get_data_dict
  182. self._data = {self.table_class._meta.name: self.get_data()}
File "/usr/local/share/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/dashboards/admin/overview/views.py" in get_data
  41. data = super(GlobalOverview, self).get_data()
File "/usr/local/share/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/usage/views.py" in get_data
  34. self.usage.get_quotas()
File "/usr/local/share/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/usage/base.py" in get_quotas
  115. _("Unable to retrieve quota information."))
File "/usr/local/share/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/usage/base.py" in get_quotas
  112. self.quotas = quotas.tenant_quota_usages(self.request)
File "/usr/local/share/horizon/openstack_dashboard/wsgi/../../horizon/utils/memoized.py" in __call__
  33. value = self.func(*args)
File "/usr/local/share/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/usage/quotas.py" in tenant_quota_usages
  121. floating_ips = network.tenant_floating_ip_list(request)
File "/usr/local/share/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/api/network.py" in tenant_floating_ip_list
  141. return NetworkClient(request).floating_ips.list()
File "/usr/local/share/hori...

Read more...

We too got the same error with the devstack:
ImportError: cannot import name base

Django Version: 1.5.1
Exception Type: ImportError
Exception Value: cannot import name base
Exception Location: /opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/api/__init__.py in <module>, line 36

When we debugged the issue and found the root cause for our problem is syntax error at import line due to accidental deletion "from" in that line.

Found the problem by putting the debug trace statement (import pdb;pdb.set_trace()) at the location of
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/base.py" in url_patterns
  715. return self._urls()[0]
Then we printed the self._urls()[0] in the debug prompt
It showed the following messge:
*** IndentationError: unexpected indent (nova.py, line 22)

The line at nova.py, line 22 is as follows:
 __future__ import absolute_import

We found that there is accidental deletion of from in that line. So, corrected it like as follows:
from __future__ import absolute_import

Then it worked.

Changed in horizon:
milestone: havana-2 → havana-3
Julie Pichon (jpichon) wrote :

Another "I see this from time to time, and doing the following solves this for me": I sometimes see this when I've updated devstack a few times. I found getting rid of the (possibly stale) .pyc files in /opt/stack/horizon and restarting Apache is enough for the problem to go away.

Changed in horizon:
milestone: havana-3 → none
Edward (zhang-hare) wrote :

According to my investigation, it is caused by __init__.py under /opt/stack/horizon/openstack_dashboard/api
directory. It can be resolved by removing 'from openstack_dashboard.api' for all the api import statement since these modules all in the same directory.

/opt/stack/horizon/openstack_dashboard/api/__init__.py

import base
import ceilometer
import cinder
import fwaas
import glance
import heat
import keystone
import lbaas
import network
import neutron
import nova
import swift
import trove
import vpn

assert base
assert cinder
assert fwaas
assert glance
assert heat
assert keystone
assert lbaas
assert network
assert neutron
assert nova
assert swift
assert ceilometer
assert trove
assert vpn

Fix proposed to branch: master
Review: https://review.openstack.org/47963

Changed in horizon:
assignee: nobody → Edward (zhang-hare)
status: Triaged → In Progress
Matthias Runge (mrunge) on 2014-01-24
Changed in horizon:
assignee: Edward (zhang-hare) → nobody
status: In Progress → Confirmed

I'm trying to install IceHouse-2 with Ubuntu 14.04 and I'm hitting this...

First, I was hitting the error related to "import defaults"

--
vi /usr/share/pyshared/openstack_auth/tests/urls.py
 vi /usr/share/pyshared/openstack_auth/urls.py
---

So, I removed ".defaults" from django.conf.urls.defaults, I'm using django.conf.urls instead.

But, now, I'm hitting this error:

---
[Sun Feb 02 16:25:29.259446 2014] [:error] [pid 2535:tid 139944620787456] [remote 2001:1291:2bf:ffff:bd5b:bd0e:86b4:d54b:2925] from openstack_dashboard.api import base
[Sun Feb 02 16:25:29.259470 2014] [:error] [pid 2535:tid 139944620787456] [remote 2001:1291:2bf:ffff:bd5b:bd0e:86b4:d54b:2925] ImportError: cannot import name base
---

Any tips?! I would to start testing IceHouse as fast as possible...

Thanks!
Thiago

Maximiliano Osorio (mosorio-0) wrote :

Confirm in Ubuntu 14.04 with openstack havana

Solution:

import base
import ceilometer
import cinder
import fwaas
import glance
import heat
import keystone
import lbaas
import network
import neutron
import nova
import swift
import trove
import vpn

Éric Araujo (merwok) wrote :

Can you try with explicit relative imports (e.g. ``from . import base``)? Implicit relative imports (``import base``) are messy and won’t work on Python 3.

Julie Pichon (jpichon) wrote :

Another debugging tip, mostly for the developers who see this issue: when working on one of the files under openstack_dashboard/api, I have also seen this, hiding a real problem in one of the API files being imported (e.g. syntax or import error). Temporarily changing the way the files are imported in __init__.py (cf. examples in this comment thread) usually helps to surface the real error.

Matthias Runge (mrunge) wrote :

for the ones seeing this issue: which python-six version are you using? That may be related...

dubi (dubi-il) wrote :

3/7/2014

While running Packstack --allinone (for havana)

I am getting this error :
"...
 from openstack_dashboard.api import base
ImportError: cannot import name base "

and Openstack-status show error 500 for openstak-dashboard

   . This error have NOT been there last week

The installation is using Python 2.7.5

ANY IDEA WHAT TO DO ?

Here is the whole trace from /var/log/horizon/horizon.log
---------------------------------------------------------------------------------------

2014-03-07 20:08:48,212 16768 ERROR django.request Internal Server Error: /dashboard/
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 92, in get_response
    response = middleware_method(request)
  File "/usr/lib/python2.7/site-packages/django/middleware/locale.py", line 21, in process_request
    check_path = self.is_language_prefix_patterns_used()
  File "/usr/lib/python2.7/site-packages/django/middleware/locale.py", line 56, in is_language_prefix_patterns_used
    for url_pattern in get_resolver(None).url_patterns:
  File "/usr/lib/python2.7/site-packages/django/core/urlresolvers.py", line 347, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/usr/lib/python2.7/site-packages/django/core/urlresolvers.py", line 342, in urlconf_module
    self._urlconf_module = import_module(self.urlconf_name)
  File "/usr/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/urls.py", line 38, in <module>
    url(r'', include(horizon.urls))
  File "/usr/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 26, in include
    patterns = getattr(urlconf_module, 'urlpatterns', urlconf_module)
  File "/usr/lib/python2.7/site-packages/django/utils/functional.py", line 204, in inner
    self._setup()
  File "/usr/lib/python2.7/site-packages/django/utils/functional.py", line 270, in _setup
    self._wrapped = self._setupfunc()
  File "/usr/lib/python2.7/site-packages/horizon/base.py", line 730, in url_patterns
    return self._urls()[0]
  File "/usr/lib/python2.7/site-packages/horizon/base.py", line 737, in _urls
    self._autodiscover()
  File "/usr/lib/python2.7/site-packages/horizon/base.py", line 782, in _autodiscover
    import_module('%s.%s' % (app, mod_name))
  File "/usr/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/dashboards/router/dashboard.py", line 19, in <module>
    from openstack_dashboard.api import neutron
  File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/api/__init__.py", line 36, in <module>
    from openstack_dashboard.api import base
ImportError: cannot import name base

Noorul Islam K M (noorul) wrote :

I see this issue while testing icehouse-2

Shouldn't this be of importance High ?

I also encounter this issue today, after did some test based on Edward (zhang-hare) 's comments, got another error

[Wed Mar 12 15:20:07 2014] [error] return self._urls()[0]
[Wed Mar 12 15:20:07 2014] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/base.py", line 741, in _urls
[Wed Mar 12 15:20:07 2014] [error] dash._autodiscover()
[Wed Mar 12 15:20:07 2014] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/base.py", line 514, in _autodiscover
[Wed Mar 12 15:20:07 2014] [error] import_module('.%s.panel' % panel, package)
[Wed Mar 12 15:20:07 2014] [error] File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
[Wed Mar 12 15:20:07 2014] [error] __import__(name)
[Wed Mar 12 15:20:07 2014] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/dashboards/settings/password/panel.py", line 21, in <module>
[Wed Mar 12 15:20:07 2014] [error] from openstack_dashboard.api import keystone
[Wed Mar 12 15:20:07 2014] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/api/__init__.py", line 55, in <module>
[Wed Mar 12 15:20:07 2014] [error] import ceilometer
[Wed Mar 12 15:20:07 2014] [error] File "/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/api/ceilometer.py", line 18, in <module>
[Wed Mar 12 15:20:07 2014] [error] from ceilometerclient import client as ceilometer_client
[Wed Mar 12 15:20:07 2014] [error] ImportError: No module named ceilometerclient

I think that this issue should be marked as HIGH as it is a block case for all developers who want to use horizon

Kieran Spear (kspear) wrote :

If you're on a test machine with Ubuntu packages, try running this:

sudo find /usr/share/openstack-dashboard -name \*.pyc -delete
sudo service apache2 reload

Or for DevStack:

sudo find /opt/stack/horizon -name \*.pyc -delete
sudo service apache2 reload

RaulSanchez (raul-8) wrote :
Download full text (4.4 KiB)

I also have the problem. This is my log
ubuntu 12.04 server and icehouse

raul

[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] mod_wsgi (pid=9692): Exception occurred processing WSGI script '/usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi'.
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] Traceback (most recent call last):
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] File "/usr/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 187, in __call__
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] self.load_middleware()
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 49, in load_middleware
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] mw_instance = mw_class()
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] File "/usr/lib/python2.7/dist-packages/django/middleware/locale.py", line 24, in __init__
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] for url_pattern in get_resolver(None).url_patterns:
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 346, in url_patterns
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] File "/usr/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 341, in urlconf_module
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] self._urlconf_module = import_module(self.urlconf_name)
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py", line 40, in import_module
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] __import__(name)
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] File "/usr/share/openstack-dashboard/openstack_dashboard/wsgi/../../openstack_dashboard/urls.py", line 39, in <module>
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] url(r'', include(horizon.urls))
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] File "/usr/lib/python2.7/dist-packages/django/conf/urls/__init__.py", line 27, in include
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] patterns = getattr(urlconf_module, 'urlpatterns', urlconf_module)
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] File "/usr/lib/python2.7/dist-packages/django/utils/functional.py", line 213, in inner
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] self._setup()
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] File "/usr/lib/python2.7/dist-packages/django/utils/functional.py", line 298, in _setup
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] self._wrapped = self._setupfunc()
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] File "/usr/lib/python2.7/dist-packages/horizon/base.py", line 730, in url_patterns
[Thu Mar 13 09:54:36 2014] [error] [client 192.168.100.1] return self._urls()[0]
[Thu Mar 13 09:54:36 2014] [error] [client...

Read more...

RaulSanchez (raul-8) wrote :

Hi!

sudo find /usr/share/openstack-dashboard -name \*.pyc -delete
sudo service apache2 reload

This doesn't work for me :(

Also not works for me ;-(

Matthias Runge (mrunge) wrote :

To whom this does not work: What python-six version are you using?

Matthias Runge (mrunge) wrote :

[Wed Mar 12 15:20:07 2014] [error] ImportError: No module named ceilometerclient

Jay Lau: Yo don't have ceilometerclient installed, as the log says.

Dimitri Mazmanov (sorantis) wrote :
Download full text (3.4 KiB)

Same here. Just did a clean install using devstack.

Here's my log:

Environment:

Request Method: GET
Request URL: http://localhost:8080/

Django Version: 1.5.5
Python Version: 2.7.3
Installed Applications:
['openstack_dashboard.dashboards.project',
 'openstack_dashboard.dashboards.admin',
 'openstack_dashboard.dashboards.settings',
 'openstack_dashboard',
 'django.contrib.contenttypes',
 'django.contrib.auth',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'compressor',
 'horizon',
 'openstack_auth']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'horizon.middleware.HorizonMiddleware',
 'django.middleware.doc.XViewMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware')

Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  92. response = middleware_method(request)
File "/usr/local/lib/python2.7/dist-packages/django/middleware/locale.py" in process_request
  21. check_path = self.is_language_prefix_patterns_used()
File "/usr/local/lib/python2.7/dist-packages/django/middleware/locale.py" in is_language_prefix_patterns_used
  56. for url_pattern in get_resolver(None).url_patterns:
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in url_patterns
  347. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py" in urlconf_module
  342. self._urlconf_module = import_module(self.urlconf_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in import_module
  35. __import__(name)
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/urls.py" in <module>
  38. url(r'', include(horizon.urls))
File "/usr/local/lib/python2.7/dist-packages/django/conf/urls/__init__.py" in include
  26. patterns = getattr(urlconf_module, 'urlpatterns', urlconf_module)
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py" in inner
  204. self._setup()
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py" in _setup
  270. self._wrapped = self._setupfunc()
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/base.py" in url_patterns
  733. return self._urls()[0]
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/base.py" in _urls
  744. dash._autodiscover()
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../horizon/base.py" in _autodiscover
  517. import_module('.%s.panel' % panel, package)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py" in import_module
  35. __import__(name)
File "/opt/stack/horizon/openstack_dashboard/wsgi/../../openstack_dashboard/dashboards/admin/domains/pan...

Read more...

Hi,

I'm still encountering this issue after upgrade from havana to icehouse
Did anyone fixed it?

thanks

Ale

tamtrieu (tamtrieutri) wrote :

Hi,

I've same issue and overcome this by following step:

- Uninstall six: pip uninstall six
- Reinstall version 1.4.1 of six: pip install six==1.4.1
- Make sure python load correct six by using python shell:
              + import six
              + six.__version__ => this should print 1.4.1

Thanks,
Tam

sh.huang (sh-huang) wrote :

I'am still have this issue:

 File "/root/horizon/.venv/lib/python2.6/site-packages/django/conf/urls/__init__.py", line 27, in include
    patterns = getattr(urlconf_module, 'urlpatterns', urlconf_module)
  File "/root/horizon/.venv/lib/python2.6/site-packages/django/utils/functional.py", line 213, in inner
    self._setup()
  File "/root/horizon/.venv/lib/python2.6/site-packages/django/utils/functional.py", line 298, in _setup
    self._wrapped = self._setupfunc()
  File "/root/horizon/horizon/base.py", line 733, in url_patterns
    return self._urls()[0]
  File "/root/horizon/horizon/base.py", line 744, in _urls
    dash._autodiscover()
  File "/root/horizon/horizon/base.py", line 517, in _autodiscover
    import_module('.%s.panel' % panel, package)
  File "/root/horizon/.venv/lib/python2.6/site-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
  File "/root/horizon/openstack_dashboard/dashboards/admin/domains/panel.py", line 21, in <module>
    from openstack_dashboard.api import keystone
  File "/root/horizon/openstack_dashboard/api/__init__.py", line 36, in <module>
    from openstack_dashboard.api import base
ImportError: cannot import name base

Richard Jones (r1chardj0n3s) wrote :

Could anyone who is still encountering this issue please detail the environment they're using and steps they followed to reproduce the problem? There's mentions here of devstack under Ubuntu 14.04 resulting in the error, but that's the environment I'm using and I've not encountered the error.

Lawrance (jing) wrote :

i've encountered the error in the latest icehouse, i use RDO for openstack deployment.
emmm.. the error always shows up when another exception raised and the real exception will show up when
we use relative import.

Thiago Paiva Brito (thiagop) wrote :

Using the imports in the way mosorio-0 suggested helped to surface the true error (cannot import 'adapter' from keystoneclient). Since these modules are in the same package and importing it this way helps to identify the true problem, isn't it the best approach to leave the imports that way since, quoting the Zen of Python, "Errors should never pass silently" and "Explicit is better than implicit"?

Daniel Park (daniepar) wrote :

I ran across this issue recently while developing for Havana. It turns out the root cause was due to oslo.i18n not being installed.

Just run and restart your dev server:

    pip install oslo.i18n

Matthias Runge (mrunge) wrote :

Daniel Park: Did you search for a oslo.i18n reference in horizon havana? It's not there.

Phil Bedard (philxor) wrote :

I ran into the same issue on Ubuntu and the Icehouse release and installing oslo.il8n did fix the issue.

Ekaterina Chernova (efedorova) wrote :

Also reproduced in Juno if old version of any client installed

LIU Yulong (dragon889) wrote :

2014-12-29 - In my environment upstream this commit https://review.openstack.org/#/c/141798/
will reproduce this bug. If I comment these code:
        if is_service_enabled(self.request,
                              config_name='enable_lb',
                              ext_name='lbaas'):
            # Also get the loadbalancer VIPs
            vip_dict = {v['port_id']: v['name']
                        for v in self.client.list_vips().get('vips', [])}
        else:
            vip_dict = {}
everything works fine.

LIU Yulong (dragon889) wrote :

Seems this is a python2.7+ syntax:
vip_dict = {v['port_id']: v['name']
                        for v in self.client.list_vips().get('vips', [])}

My envrionment is python 2.6.
I changed the code to
            vip_dict = dict(
                [(obj.port_id, obj.name)
                    for obj in self.client.list_vips().get('vips', [])])
Then the exception was gone.

Sam Betts (sambetts) wrote :

Is this still an issue for anyone? there has been no activity here since 2014-12-29. I have not encountered this bug at all during Juno and Kilo development cycles.

Ashish (ashish-jain14) wrote :

I have seen similar message today while setting up heat auto scaling policy

2015-04-12 05:36:47.912 15139 TRACE heat.engine.resource done = super(InstanceGroup, self).check_create_complete(task)
2015-04-12 05:36:47.912 15139 TRACE heat.engine.resource File "/usr/lib/python2.7/dist-packages/heat/engine/stack_resource.py", line 223, in check_create_complete
2015-04-12 05:36:47.912 15139 TRACE heat.engine.resource raise exception.Error(self._nested.status_reason)
2015-04-12 05:36:47.912 15139 TRACE heat.engine.resource Error: Resource CREATE failed: Error: Resource CREATE failed: ResourceInError: Went to status ERROR due to "Message: cannot import name adapter
2015-04-12 05:36:47.912 15139 TRACE heat.engine.resource Traceback (most recent call last):
2015-04-12 05:36:47.912 15139 TRACE heat.engine.resource
2015-04-12 05:36:47.912 15139 TRACE heat.engine.resource File "/usr/lib/python2.7/dist-packages/oslo/messaging/rpc/dispatcher.py", line 134, in _dispatch_and_reply
2015-04-12 05:36:47.912 15139 TRACE heat.engine.resource incoming.message))
2015-04-12 05:36:47.912 15139 TRACE heat.engine.resource
2015-04-12 05:36:47.912 15139 TRACE heat.engine.resource File "/usr/lib/python2.7/dist-packages/oslo/messaging/rpc, Code: 500"
2015-04-12 05:36:47.912 15139 TRACE heat.engine.resource
2015-04-12 05:36:48.940 15139 INFO heat.engine.stack [-] Stack CREATE FAILED (simple5): Resource CREATE failed: Error: Resource CREATE failed: Error: Resource CREATE failed: ResourceInError: Went to status ERROR due to "Message: cannot import name adapter
Traceback (most recent call last):

  File "/usr/lib/python2.7/dist-packages/oslo/messaging/rpc/dispatcher.py", line 134, in _dispatch_and_reply
    incoming.message))

  File "/usr/lib/python2.7/dist-packages/oslo/messaging/rpc, Code: 500"
2015-04-12 05:36:48.941 15139 INFO heat.engine.service [-] Stack create failed, status FAILED

Matthias Runge (mrunge) wrote :

IMHO, this is a bug for several, and very different import issues. A fix would be to improve error messages to reveal the underlying issue rather than masking it.

We've sometimes seen some issues here with distro packages due to distro dependencies.

For those who have the issue, please try the following:
http://dev.cloudwatt.com/en/blog/deploy-horizon-from-source-with-apache-and-ssl.html
But instead of running from the master branch, just after the "git clone git://git.openstack.org/openstack/horizon.git" command add a "git checkout 2014.2.2"(Juno) or "git checkout 2014.1.4"(Icehouse) to pull the stable branch corresponding to the version you where using with the packaged version.

If the issue disappears it means that one of the requirements installed by distro packaging is not correct (or missing).

This would help clarify if it's an horizon or distro-packaging issue.

Thanks.

Nitin Madhok (nmadhok) wrote :

Seeing this issue on Oracle Linux 6.6 after following instructions from http://docs.openstack.org/icehouse/install-guide/install/yum/content/install_dashboard.html

Garth (garth-booth) wrote :

Any progress on a resolution for this issue? I'm seeing this error in both my devstack (/opt/stack/Horizon) and a local version (I just cloned this morning) of Horizon on the same system (running on port 8080). Here is a pointer to the paste file with details:

http://paste.openstack.org/show/372287/

Paul Karikh (pkarikh) wrote :

Looks like I faced this issue when with pip install -r requirements.txt I've installed some oslo.* libs with version 2.1.
Manual downgrading oslo.libs to older version worked for me.

Kindjal (kindjal) wrote :

I currently have this issue on Ubuntu 14.04 with Kilo.

openstack-dashboard 1:2014.1.5-0ubuntu2

Hello kindjal

Yesterday , i faced the same issue, i did the changes in the __init__.py, it is resolved and restart your apache2 services. It will work.

Richard Jones (r1chardj0n3s) wrote :

From the responses here it seems that the root issue with those encountering this "bug" is that their Horizon installation is missing some dependency, and installing that dependency fixes the issue.

The error reported "ImportError: cannot import name base" is a symptom of the failure to load all dependent modules.

The cause therefore would appear to be incomplete or erroneous installation documentation.

Please include the steps used to install Horizon and its dependencies in future reports or they will not be helpful, thanks!

summary: - ImportError: cannot import name base
+ ImportError due to missing dependencies
description: updated
Changed in horizon:
status: Confirmed → Incomplete
Launchpad Janitor (janitor) wrote :

[Expired for OpenStack Dashboard (Horizon) because there has been no activity for 60 days.]

Changed in horizon:
status: Incomplete → Expired
wangjun (wang.jun) wrote :

it happened agen in my environment, I try install ironic-ui which is newest, then when I restart httpd, error appeared

Rajat Sharma (tajar29) wrote :

I have encounter the same issue on openstack pike

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Bug attachments