Bug 1087885 - invalid runtime reference of jinja2
Summary: invalid runtime reference of jinja2
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: python-flask
Version: el6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Rick Elrod
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-04-15 14:01 UTC by Pádraig Brady
Modified: 2016-01-04 14:47 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-08-21 20:56:22 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
reference jinja2-26 at runtime (3.23 KB, patch)
2014-04-15 14:06 UTC, Pádraig Brady
no flags Details | Diff

Description Pádraig Brady 2014-04-15 14:01:30 UTC
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

Comment 1 Pádraig Brady 2014-04-15 14:06:28 UTC
Created attachment 886492 [details]
reference jinja2-26 at runtime

Comment 2 Rick Elrod 2014-04-15 17:24:49 UTC
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?

Comment 3 Toshio Ernie Kuratomi 2014-04-16 13:09:23 UTC
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.

Comment 4 Toshio Ernie Kuratomi 2014-04-16 14:17:23 UTC
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.

Comment 5 Rick Elrod 2014-04-16 16:00:59 UTC
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?

Comment 6 Rick Elrod 2014-04-16 16:01:17 UTC
And thanks for looking into this, Toshio!

Comment 7 Pádraig Brady 2014-04-16 23:19:04 UTC
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.

Comment 8 Rick Elrod 2014-08-21 20:56:22 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.