redhat-openstack / tripleo-quickstart

Ansible roles for setting up TripleO virtual environments and building images
16 stars 15 forks source link

ImportError: No module named markupsafe #29

Closed fhubik closed 8 years ago

fhubik commented 8 years ago

Clean Centos 7 and tripleo-quickstart, it seems like missing python virtualenv dependency:

$ bash quickstart.sh $VIRTHOST ...

Traceback (most recent call last): File "/root/.quickstart/bin/ansible-playbook", line 72, in mycli = getattr(import("ansible.cli.%s" % sub, fromlist=[myclass]), myclass) File "/root/.quickstart/lib/python2.7/site-packages/ansible/cli/playbook.py", line 30, in from ansible.executor.playbook_executor import PlaybookExecutor File "/root/.quickstart/lib/python2.7/site-packages/ansible/executor/playbook_executor.py", line 30, in from ansible.executor.task_queue_manager import TaskQueueManager File "/root/.quickstart/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py", line 29, in from ansible.executor.play_iterator import PlayIterator File "/root/.quickstart/lib/python2.7/site-packages/ansible/executor/play_iterator.py", line 29, in from ansible.playbook.block import Block File "/root/.quickstart/lib/python2.7/site-packages/ansible/playbook/init.py", line 25, in from ansible.playbook.play import Play File "/root/.quickstart/lib/python2.7/site-packages/ansible/playbook/play.py", line 27, in from ansible.playbook.base import Base File "/root/.quickstart/lib/python2.7/site-packages/ansible/playbook/base.py", line 32, in from jinja2.exceptions import UndefinedError File "/root/.quickstart/lib/python2.7/site-packages/jinja2/init.py", line 33, in from jinja2.environment import Environment, Template File "/root/.quickstart/lib/python2.7/site-packages/jinja2/environment.py", line 13, in from jinja2 import nodes File "/root/.quickstart/lib/python2.7/site-packages/jinja2/nodes.py", line 19, in from jinja2.utils import Markup File "/root/.quickstart/lib/python2.7/site-packages/jinja2/utils.py", line 531, in from markupsafe import Markup, escape, soft_unicode ImportError: No module named markupsafe

$ source .quickstart/bin/activate $ pip install markupsafe $ deactivate $ bash quickstart.sh $VIRTHOST # even with --system-site-packages

OK

joehakimrahme commented 8 years ago

Same issue on RHEL7.

I also managed to work around it by installing yum install python-markupsafe (make sure to delete the previous virtualenv before rerunning the script).

larsks commented 8 years ago

I'm not sure I understand this one. MarkupSafe is an explicit dependency of jinja2, so if we're pip installing things in a virtualenv we should be getting it. And the python-jinja2 package also has an explicit dependency on python-markupsafe. So both the rpm and python deps seem to be correct.

Does this reproduce when starting from a clean environment (without the system package installed)?

mrunge commented 8 years ago

@larsks yes, it occurs in a clean env as well, starting from a clean RHEL7.2

larsks commented 8 years ago

@mrunge The only way I can reproduce this behavior is by:

If the pip install step succeeds, everything works fine. The process fails if, for example, gcc isn't available locally, because this is required for building, e.g., pycrypto. I think the solution here is to remove the working directory if the pip install fails, so that subsequent invocations will start fresh.

larsks commented 8 years ago

https://review.gerrithub.io/265942

trown commented 8 years ago

This is fixed by 010abf8 and 5aca3f7