I see ceilometer on centos 6.5 won't start, giving: 2014-04-15 08:03:00.128 20382 CRITICAL ceilometer [-] No module named jinja2 2014-04-15 08:03:00.128 20382 TRACE ceilometer Traceback (most recent call last): 2014-04-15 08:03:00.128 20382 TRACE ceilometer File "/usr/bin/ceilometer-api", line 10, in <module> 2014-04-15 08:03:00.128 20382 TRACE ceilometer sys.exit(start()) 2014-04-15 08:03:00.128 20382 TRACE ceilometer File "/usr/lib/python2.6/site-packages/ceilometer/api/app.py", line 113, in start 2014-04-15 08:03:00.128 20382 TRACE ceilometer root = VersionSelectorApplication() 2014-04-15 08:03:00.128 20382 TRACE ceilometer File "/usr/lib/python2.6/site-packages/ceilometer/api/app.py", line 94, in __init__ 2014-04-15 08:03:00.128 20382 TRACE ceilometer from ceilometer.api.v1 import app as v1app 2014-04-15 08:03:00.128 20382 TRACE ceilometer File "/usr/lib/python2.6/site-packages/ceilometer/api/v1/app.py", line 20, in <module> 2014-04-15 08:03:00.128 20382 TRACE ceilometer import flask 2014-04-15 08:03:00.128 20382 TRACE ceilometer File "/usr/lib/python2.6/site-packages/flask/__init__.py", line 19, in <module> 2014-04-15 08:03:00.128 20382 TRACE ceilometer from jinja2 import Markup, escape 2014-04-15 08:03:00.128 20382 TRACE ceilometer ImportError: No module named jinja2 The python-jinja2-26 package is parallel installed, but it seems that the flask package isn't appropriately adjusted to reference it
Created attachment 886492 [details] reference jinja2-26 at runtime
See also: #867105 This patch does it slightly differently though, I think. CCing Toshio for thoughts on this. Does this fall into the same issues pointed out in this comment: https://bugzilla.redhat.com/show_bug.cgi?id=867105#c9 or is this more reasonable?
pbrady's patch has the advantage of working to some extent even in pkg_resources has already been imported (the corner case is if the module in question has already been imported.) However, it is more complex and more tied to the internal workings of setuptools. I wouldn't object to this usage but we definitely should open a bug upstream (and maybe ping jason coombes directly) if we want to start recommending this approach.
I talked to Jason here at pycon. He thinks the best thing to do is to propose adding that function to pkg_resources because: (1) it seems like the functionality really belongs inside of pkg_resources rather than in each individual application and (2) it lets pje comment on the code in case there's any problem with the implementation. if it is accepted, then it would go into a version of setuptools-3.x. We'd then be able to try importing the function from pkg_resources. If it wasn't available (as would be the case in centos/rhel5,6,7) we could fallback on our own implementation.
This sounds good to me. Pádraig, can you try taking this to upstream setuptools and see what they think, then we can go from there?
And thanks for looking into this, Toshio!
I've patched flask with this and am running a version in the RDO repos which allows ceilometer to work. So you're saying that the existing flask works if one doesn't first import pkg_resources. If that's the case then I could work around this in the ceilometer package I suppose. It would be good to have this in setuptools but I've neither the time of the inclination to follow that up. We'd have to patch our el systems for eternity anyway.
I'm going to close this for now to get it out of my queue. I am more than happy to work with someone/follow up, if someone decides to take this upstream to setuptools.