[openstack-dev] [diskimage-builder] disk-image-create from virtualenv not working

Alec Hothan (ahothan) ahothan at cisco.com
Thu Jul 2 17:58:26 UTC 2015

I wonder if anybody else ran into the same issue as it looks like PyYAML
is required on the native python in order for disk-image-crate to succeed.
Installing PyYAML in a virtual environment and running disk-iage-create
from that venv won't work as one of the script fails to import yaml:

dib-run-parts Thu Jul 2 09:27:50 PDT 2015 Running

['/tmp/image.ewtpa5DW/hooks/bin', '/usr/lib/python2.7',
'/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload',

Traceback (most recent call last):
line 26, in <module>
    import yaml
ImportError: No module named yaml

I added a trace to print sys.path in that script and sure enough, it is
bypassing completely my venv path, it looks like the PATH is not picking
up the existing PATH from the calling shell.

from the same shell that ran disk-iage-create above:
$ pip list | grep YAML
PyYAML (3.11)

$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.path
['', '/home/localadmin/kb/lib/python2.7',
'/home/localadmin/kb/lib/python2.7/lib-dynload', '/usr/lib/python2.7',
'/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk',

Is that a known issue/requirement or is there a workaround (other than
installing pyYAML on the native python?



More information about the OpenStack-dev mailing list