[openstack-dev] [Oslo] Dumb question on tarball

Salvatore Orlando sorlando at nicira.com
Mon Feb 18 16:48:00 UTC 2013


Indeed. This what was looking weird to me, and the reason for which I
think I'm doing something dumb.
Basically there are many quantum imports that do

from oslo.config import cfg

and this import fails (on all my 3 dev machines)

I am providing more details below so you can tell me what I'm not doing right.
This is what happens (and my default sys.path which includes oslo's directory):


>>> import sys
>>> sys.path
['', '/usr/local/lib/python2.7/dist-packages/alembic-0.4.2-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/tox-1.4.2-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/py-1.4.12-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/virtualenv-1.8.4-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/WebOb-1.2.3-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/unittest2-0.5.1-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/pep8-1.4.2-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/netaddr-0.7.10-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/mock-1.0.1-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/cliff-1.3-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/prettytable-0.6.1-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/fixtures-0.3.12-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/testtools-0.9.29-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/extras-0.0.3-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/openstack.common-2013.1.a172.g8ce5947-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.7.9-py2.7-linux-x86_64.egg',
'/usr/local/lib/python2.7/dist-packages/stevedore-0.8-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/kombu-1.0.4-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/anyjson-0.2.4-py2.7.egg',
'/usr/local/lib/python2.7/dist-packages/greenlet-0.4.0-py2.7-linux-x86_64.egg',
'/usr/local/lib/python2.7/dist-packages/oslo_config-2013.1b3-py2.7.egg',
'/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2',
'/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages/PIL',
'/usr/lib/python2.7/dist-packages/gst-0.10',
'/usr/lib/python2.7/dist-packages/gtk-2.0',
'/usr/lib/pymodules/python2.7',
'/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
'/usr/lib/python2.7/dist-packages/ubuntuone-client',
'/usr/lib/python2.7/dist-packages/ubuntuone-control-panel',
'/usr/lib/python2.7/dist-packages/ubuntuone-couch',
'/usr/lib/python2.7/dist-packages/ubuntuone-installer',
'/usr/lib/python2.7/dist-packages/ubuntuone-storage-protocol']
>>> from oslo.config import cfg as config
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named oslo.config
>>> quit()


Then I do the following, probably horrible thing:

salvatore at ubuntu:~$ sudo touch
/usr/local/lib/python2.7/dist-packages/oslo_config-2013.1b3-py2.7.egg/oslo/__init__.py

And the import works

salvatore at ubuntu:~$ python
Python 2.7.3 (default, Aug  1 2012, 05:14:39)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from oslo.config import cfg as config
>>> type(config.CONF)
<class 'oslo.config.cfg.ConfigOpts'>
>>>




On 18 February 2013 16:19, Doug Hellmann <doug.hellmann at dreamhost.com> wrote:
> On Mon, Feb 18, 2013 at 8:58 AM, Salvatore Orlando <sorlando at nicira.com>
> wrote:
>>
>> Hi,
>>
>> After updating my Quantum code with the one which uses oslo as a
>> dependency, making the source tree incredibly slimmer, I saw Quantum
>> was still failing in importing oslo, even if it was correctly in the
>> pip-requires (and I did re-install the package).
>>
>> Oslo also showed up correctly in
>> /usr/local/lib/python2.7/dist-packages/oslo_config-2013.1b3-py2.7.egg
>> I wondered why the import was failing and I found no __init__.py in
>> the oslo folder. This was easily fixed, but I am still not able to
>> understand what I did wrong (I just did sudo easy_install
>> <tarball_url>), since everything looks fine in the tarball.
>
>
> Oslo is a namespace package, so it shouldn't be imported directly and
> doesn't need an __init__.py.
>
> What import was failing and what was the traceback?
>
> Doug
>
>>
>>
>> Regards, and thanks in advance,
>> Salvatore
>>
>> _______________________________________________
>> OpenStack-dev mailing list
>> OpenStack-dev at lists.openstack.org
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>



More information about the OpenStack-dev mailing list