Installing oslo.rootwrap from pypi hides oslo.* installed as editable

Bug #1273581 reported by Maru Newby
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
oslo-incubator
Invalid
High
Thierry Carrez

Bug Description

Running devstack clean on ubuntu 12.04-3 results in the following glance-registry failure when trying to upload the demo image:

DBError: (ProgrammingError) (1146, "Table 'glance.images' doesn't exist")

Further inspection reveals the glance database to be empty, and attempting to run 'glance-manage db_sync' results in the following error:

Traceback (most recent call last):
  File "/usr/local/bin/glance-manage", line 6, in <module>
    from glance.cmd.manage import main
  File "/opt/stack/glance/glance/cmd/manage.py", line 41, in <module>
    from oslo.config import cfg
ImportError: No module named config

Looking at the dist packages installation target (/usr/local/lib/python2.7/dist-packages/), the following oslo* paths are present:

oslo
oslo.rootwrap-1.0.0.egg-info
oslo.config.egg-link
oslo.rootwrap-1.0.0-nspkg.pth
oslo.messaging.egg-link

It appears that nova was recently changed to install oslo.rootwrap from pypi [1] and that oslo.rootwrap installation in this manner prevents other oslo.* packages from sharing the namespace.

Attempting to use the --egg option to install oslo.{config|messaging} from source [2] did not resolve the problem. A workaround is to install oslo.rootwrap from source instead of from pypi.

1: https://review.openstack.org/#/c/67422/
2: http://stackoverflow.com/questions/13400291/namespace-packages-and-pip-install-e

Tags: rootwrap
Maru Newby (maru)
description: updated
Maru Newby (maru)
description: updated
Revision history for this message
Thierry Carrez (ttx) wrote :

This is fixed in:
http://git.openstack.org/cgit/openstack/oslo.rootwrap/commit/?id=4c499d366429f68ff29c7a2f93553b06f3697405

I just need to cut a new release so that Pypi looks good too. Will do once https://review.openstack.org/#/c/69033 merges.

Changed in oslo:
assignee: nobody → Thierry Carrez (ttx)
importance: Undecided → High
status: New → Fix Committed
tags: added: rootwrap
Changed in oslo:
milestone: none → icehouse-3
Revision history for this message
Maru Newby (maru) wrote :

Given that the failure is 100% reproduceable in devstack, how did the gate check pass for the nova commit in question?

Revision history for this message
Thierry Carrez (ttx) wrote :

Because the gate runs from the master branch.

Revision history for this message
gordon chung (chungg) wrote :

so in my environment i have the following in my /usr/local/lib/python2.7/dist-packages space:
oslo/
oslo.config-1.2.0a3-py2.7-nspkg.pth
oslo.messaging.egg-link
oslo.config-1.2.0a3-py2.7.egg-info/
oslo.config.egg-link
oslo.rootwrap.egg-link

i have the above patch but i still get the rootwrap.cmd importerror shown here: https://answers.launchpad.net/devstack/+question/242879

do i need to clean something before this should work for me? i'm not using pypi package (or at least i don't think i am)

Revision history for this message
Thierry Carrez (ttx) wrote :

1.1.0 is on Pypi now, it should fix the issue. please report here if it doesn't.

Changed in oslo:
status: Fix Committed → Fix Released
Revision history for this message
gordon chung (chungg) wrote :

master works for me. for reference, in case anyone runs into same issue i had, i had to remove stray oslo.config-1.2.0a3-py2.7.egg-info package for it to work.

Revision history for this message
Rabi Mishra (rabi) wrote :

How to make this work on f20? It does not work .. tried to install oslo-rootwrap as suggested but encountering the same issue...

FORCE=yes ./stack.sh throws this error...

2014-01-29 11:22:41 + /usr/bin/glance-manage db sync
2014-01-29 11:22:41 Traceback (most recent call last):
2014-01-29 11:22:41 File "/usr/bin/glance-manage", line 6, in <module>
2014-01-29 11:22:41 from glance.cmd.manage import main
2014-01-29 11:22:41 File "/opt/stack/glance/glance/cmd/manage.py", line 41, in <module>
2014-01-29 11:22:41 from oslo.config import cfg
2014-01-29 11:22:41 ImportError: No module named config
2014-01-29 11:22:41 + create_glance_cache_dir
2014-01-29 11:22:41 + sudo mkdir -p /var/cache/glance/api

Revision history for this message
Maru Newby (maru) wrote :

Let's try that again:

I'm afraid the 1.1.0 release of oslo.rootwrap on pypi has not solved the problem. As before, oslo/__init__.py does not get deployed, despite appearing in the distribution file. If you manually install it in a venv on a devstack-provisioned host, can you reproduce this behaviour?

Revision history for this message
Doug Hellmann (doug-hellmann) wrote :

The __init__.py file for a namespace package isn't supposed to be installed.

I can't reproduce this problem. Can you post your localrc and any other configuration for devstack that you're using?

Revision history for this message
Maru Newby (maru) wrote :

Hmm, I see now that the installation deliberately skips installation of the namespace package's init module. I was confused by the fact that manually touching that file seems to fix the problem I'm seeing. As per the bug description, it appears that installing one namespace package as non-editable precludes installing other packages in the same namespace as editable. Can you reproduce the problem with the script that follows?

#/bin/bash -eux
sudo apt-get install -y git python-pip python-virtualenv
virtualenv /tmp/foo_env
cd /tmp/foo_env
git clone https://github.com/openstack/oslo.config.git
. bin/activate
pip install --editable oslo.config
pip install oslo.rootwrap
python -c 'import oslo.config'

Revision history for this message
Maru Newby (maru) wrote :

It turns out my problem was environment-specific. I use a local mirror for git repos and oslo.rootwrap was missing. Devstack doesn't stop when a git checkout fails, so oslo.rootwrap wasn't installed from source and was subsequently installed by nova from pypi.

Changed in oslo:
status: Fix Released → Invalid
Thierry Carrez (ttx)
Changed in oslo:
milestone: icehouse-3 → none
Revision history for this message
Josep Subirats (jscupc) wrote :

The oslo.config version that came with my Ubuntu was 1.2.1, which had this same error. Check it with:

root@controller:~# pip search oslo.config
oslo.config - Oslo Configuration API
  INSTALLED: 1.2.1
  LATEST: 1.4.0.0a5

So, what I did was to update it with:

pip --upgrade oslo.config

Then, check:

root@controller:~# pip search oslo.config
oslo.config - Oslo Configuration API
  INSTALLED: 1.3.0
  LATEST: 1.4.0.0a5

And with this, the command finally succeeded in its execution. Hope this helps!

Revision history for this message
Josep Subirats (jscupc) wrote :

UPDATE-WARNING: although what I posted helps executing the glance-manage db_sync command, from then on I haven't been able to anything with glance, as I always get the same error:

root@controller:~# glance image-list
'Discover' object has no attribute 'url_for'

Revision history for this message
Arun prasath S (bingoarunprasath) wrote :

Tried installing openstack and it led me to this bug.

Can't start nova-api.

Removed all /usr/local/lib/python2.7/dist-packages/oslo*

Copied /usr/local/lib/python2.7/dist-packages/novaclient from my earlier installations.

Then restarted nova-api. It worked.

Revision history for this message
asif (asif-h-j) wrote :

Running below command fixed with updated patch.

pip install oslo.rootwrap --upgrade

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

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.