Opened 14 years ago
Last modified 9 years ago
#7659 new defect
Problem with tracmetrix upgrading 0.11 to 0.12
Reported by: | anonymous | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | TracMetrixPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 1.0 |
Description
I started with trac 0.11 and a working tracmetrix plugin running on ubuntu with apache and postgresSQL.
I have successfully upgraded trac to 0.12 and started installing the tracmetrix plugin.
Installation of pythin-matlablib
and python-numpy
and version 0.12 of the plugin went ok without reporting errors.
I then enabled the plugin and restarted apache, but trac-admin <project> upgrade
reported the database was already up to date, but the plugin was not active.
Trac is running normally but without the dashboard menu item and on the admin page, I only have a setting for TracMetrixSetupParticipant.
I have also created a clean install of trac 0.12 and this plugin installed without error and with a working dashboard. The admin page here has all settings available.
Attachments (0)
Change History (17)
comment:1 Changed 14 years ago by
comment:2 Changed 14 years ago by
I've got the same problem. Did you find an answer/workaround for this?
comment:4 follow-ups: 5 16 Changed 14 years ago by
Try this, it works for me.
mkdir /var/www/.matplotlib chown apache.apache /var/www/.matplotlib
comment:5 follow-up: 6 Changed 14 years ago by
Replying to anonymous:
Try this, it works for me.
mkdir /var/www/.matplotlib chown apache.apache /var/www/.matplotlib
Any update? I have the same problem as the original reporter.
comment:6 follow-up: 12 Changed 14 years ago by
I reported the same problem on 10/28/10.
With further investigation I have found a code fix and a work-around for this problem. I noticed on my install that I was getting errors like the following:
2010-11-02 13:39:23,557 Trac[loader] ERROR: Skipping "tracmetrixplugin.mdashboard = tracmetrixplugin.mdashboard": Traceback (most recent call last): File "build/bdist.linux-i686/egg/trac/loader.py", line 70, in _load_eggs entry.load(require=True) File "/usr/local/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 1954, in load entry = __import__(self.module_name, globals(),globals(), ['__name__']) File "build/bdist.linux-i686/egg/tracmetrixplugin/mdashboard.py", line 25, in <module> File "/usr/lib/python2.6/site-packages/pylab.py", line 1, in <module> from matplotlib.pylab import * File "/usr/lib/python2.6/site-packages/matplotlib/pylab.py", line 247, in <module> from matplotlib.pyplot import * File "/usr/lib/python2.6/site-packages/matplotlib/pyplot.py", line 78, in <module> new_figure_manager, draw_if_interactive, show = pylab_setup() File "/usr/lib/python2.6/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup globals(),locals(),[backend_name]) File "/usr/lib/python2.6/site-packages/matplotlib/backends/backend_gtkagg.py", line 10, in <module> from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\ File "/usr/lib/python2.6/site-packages/matplotlib/backends/backend_gtk.py", line 44, in <module> cursors.MOVE : gdk.Cursor(gdk.FLEUR), RuntimeError: could not create GdkCursor object) 2010-11-02 13:39:23,557 Trac[loader] DEBUG: Loading tracmetrixplugin.model from /usr/local/lib/python2.6/site-packages/TracMetrixPlugin-0.1.8-py2.6.egg 2010-11-02 13:39:23,568 Trac[loader] ERROR: Skipping "tracmetrixplugin.model = tracmetrixplugin.model": Traceback (most recent call last): File "build/bdist.linux-i686/egg/trac/loader.py", line 70, in _load_eggs entry.load(require=True) File "/usr/local/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 1954, in load entry = __import__(self.module_name, globals(),globals(), ['__name__']) File "build/bdist.linux-i686/egg/tracmetrixplugin/model.py", line 31, in <module> File "/usr/lib/python2.6/site-packages/pylab.py", line 1, in <module> from matplotlib.pylab import * File "/usr/lib/python2.6/site-packages/matplotlib/pylab.py", line 247, in <module> from matplotlib.pyplot import * File "/usr/lib/python2.6/site-packages/matplotlib/pyplot.py", line 78, in <module> new_figure_manager, draw_if_interactive, show = pylab_setup() File "/usr/lib/python2.6/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup globals(),locals(),[backend_name]) File "/usr/lib/python2.6/site-packages/matplotlib/backends/backend_gtkagg.py", line 10, in <module> from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\ File "/usr/lib/python2.6/site-packages/matplotlib/backends/backend_gtk.py", line 44, in <module> cursors.MOVE : gdk.Cursor(gdk.FLEUR), RuntimeError: could not create GdkCursor object) 2010-11-02 13:39:23,569 Trac[loader] DEBUG: Loading tracmetrixplugin.web_ui from /usr/local/lib/python2.6/site-packages/TracMetrixPlugin-0.1.8-py2.6.egg 2010-11-02 13:39:23,580 Trac[loader] ERROR: Skipping "tracmetrixplugin.web_ui = tracmetrixplugin.web_ui": Traceback (most recent call last): File "build/bdist.linux-i686/egg/trac/loader.py", line 70, in _load_eggs entry.load(require=True) File "/usr/local/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg/pkg_resources.py", line 1954, in load entry = __import__(self.module_name, globals(),globals(), ['__name__']) File "build/bdist.linux-i686/egg/tracmetrixplugin/web_ui.py", line 33, in <module> File "build/bdist.linux-i686/egg/tracmetrixplugin/model.py", line 31, in <module> File "/usr/lib/python2.6/site-packages/pylab.py", line 1, in <module> from matplotlib.pylab import * File "/usr/lib/python2.6/site-packages/matplotlib/pylab.py", line 247, in <module> from matplotlib.pyplot import * File "/usr/lib/python2.6/site-packages/matplotlib/pyplot.py", line 78, in <module> new_figure_manager, draw_if_interactive, show = pylab_setup() File "/usr/lib/python2.6/site-packages/matplotlib/backends/__init__.py", line 25, in pylab_setup globals(),locals(),[backend_name]) File "/usr/lib/python2.6/site-packages/matplotlib/backends/backend_gtkagg.py", line 10, in <module> from matplotlib.backends.backend_gtk import gtk, FigureManagerGTK, FigureCanvasGTK,\ File "/usr/lib/python2.6/site-packages/matplotlib/backends/backend_gtk.py", line 44, in <module> cursors.MOVE : gdk.Cursor(gdk.FLEUR), RuntimeError: could not create GdkCursor object)
Investigating into matplotlib I found a suggestion that this error is related to running a matplotlib backend that depends on X11 and GDK running. This problem can be fixed in the code for tracmetrix by explicitly setting the matplotlib backend to the "Agg" backend. This change should probably be made in the tracmetrix codebase.
To immediately solve my problem without changing the tracmetrix code I found that I could use the matplotlibrc file stored in PYTHON_SITE_PACKAGES/matplotlib/mpl-data to set the default matplotlib backend on my system. My server runs headless so defaulting to a non-GUI backend works for my use cases.
comment:7 Changed 14 years ago by
It doesn't look like any of these things help.
Looking into the file it has a problem with:
configdir = os.environ.get('MPLCONFIGDIR') if configdir is not None: if not _is_writable_dir(configdir): raise RuntimeError('Could not write to MPLCONFIGDIR="%s"'%configdir) return configdir h = get_home() p = os.path.join(get_home(), '.matplotlib') if os.path.exists(p): if not _is_writable_dir(p): raise RuntimeError("'%s' is not a writable dir; you must set %s/.matplotlib to be a writable dir. You can also set environment variable MPLCONFIGDIR to any writable directory where you want matplotlib data stored "% (h, h)) else: if not _is_writable_dir(h): raise RuntimeError("Failed to create %s/.matplotlib; consider setting MPLCONFIGDIR to a writable directory for matplotlib configuration data"%h) os.mkdir(p) return p
It seems that it is running but not picking up things from the environment -
When I open up python and run:
>>> os.environ.get('MPLCONFIGDIR') '/var/lib/matlab'
But the error I get is "Failed to create /root/.matplotlib;"
Failed to create /root/.matplotlib;
So it has skipped over that bit of code because it doesn't reckon that it has any permissions to that directory. However if I actually look at those permissions:
# ls /var/lib/matlab/ -la total 36 drwxrwxrwx 4 apache apache 4096 Nov 3 09:15 . drwxr-xr-x 24 root root 4096 Sep 23 17:11 .. drwxrwxrwx 2 apache apache 4096 Nov 3 09:15 .matplotlib -rwxrwxrwx 1 apache apache 19611 Sep 24 10:16 fontList.cache drwxrwxrwx 2 apache apache 4096 Sep 24 10:16 tex.cache
How does that make any sense?
So I fixed it just by hard coding the configdir = /var/lib/matlab and it seems to work now. It seems like it isn't picking up my environment variables.
comment:8 Changed 14 years ago by
I've Trac 0.12.1 running on Ubuntu 10.04.
The environment variable probably needs to be set in the trac CGI script or similar, like this:
# mkdir /var/cache/apache2/matplotlib # chown www-data: /var/cache/apache2/matplotlib # rcsdiff -u -r1.2 /var/lib/trac/cgi-bin/trac.wsgi =================================================================== RCS file: /var/lib/trac/cgi-bin/RCS/trac.wsgi,v retrieving revision 1.2 diff -u -r1.2 /var/lib/trac/cgi-bin/trac.wsgi --- /var/lib/trac/cgi-bin/trac.wsgi 2010/11/02 10:04:14 1.2 +++ /var/lib/trac/cgi-bin/trac.wsgi 2010/11/23 16:03:03 @@ -19,6 +19,7 @@ def application(environ, start_request): os.environ['TRAC_ENV_PARENT_DIR'] = '/usr/local/lib/trac' os.environ['PYTHON_EGG_CACHE'] = '/var/cache/apache2/python_egg_cache' + os.environ['MPLCONFIGDIR'] = '/var/cache/apache2/matplotlib'
Also I needed to change the matplotlib backend as described in comment:6
# rcsdiff -u -r1.1 /etc/matplotlibrc =================================================================== RCS file: /etc/RCS/matplotlibrc,v retrieving revision 1.1 diff -u -r1.1 /etc/matplotlibrc --- /etc/matplotlibrc 2010/02/06 18:06:05 1.1 +++ /etc/matplotlibrc 2010/11/23 15:43:20 @@ -28,7 +28,7 @@ # You can also deploy your own backend outside of matplotlib by # referring to the module name (which must be in the PYTHONPATH) as # 'module://my_backend' -backend : TkAgg +backend : Agg # if you are runing pyplot inside a GUI and your backend choice # conflicts, we will automatically try and find a compatible one for
Finally the tracmetrix plugin loaded and the pdashboard can be selected, but still no graphic is visible.
comment:9 Changed 14 years ago by
Using YUI 2.8.2r1 (locally installed to avoid problems/warnings with the https server), I needed to add the inclusion of swf-min.js
; same for pdashboard.html
--- ~/mikkorantalainen-tracmetrixplugin-e668c5e/0.12/tracmetrixplugin/templates/mdashboard.html 2010-11-11 07:10:36.000000000 +0100 +++ ./mdashboard.html 2010-11-23 18:27:51.400818584 +0100 @@ -16,6 +16,7 @@ <!-- OPTIONAL: Connection (enables XHR) --> <script type="text/javascript" src="${yui_base_url}/build/connection/connection-min.js"></script> <!-- Source files --> + <script type="text/javascript" src="${yui_base_url}/build/swf/swf-min.js"></script> <script type="text/javascript" src="${yui_base_url}/build/charts/charts-min.js"></script> <script type="text/javascript">YAHOO.widget.Chart.SWFURL = "${yui_base_url}/build/charts/assets/charts.swf"; </script> <script type="text/javascript">
comment:11 Changed 14 years ago by
Could someone that was experiencing these problems try again with the latest 0.12 branch and see if the issue has been fixed? I have some reason to believe it may have been.
comment:12 Changed 14 years ago by
I was spinning my wheels and this comment was my solution, changing my backend to Agg.
comment:13 follow-up: 14 Changed 12 years ago by
Trac Release: | 0.11 → 1.0 |
---|
trac 1.0 and inspecting the growing log file:
2012-10-23 15:13:15,233 Trac[loader] ERROR: Skipping "tracmetrixplugin.web_ui = tracmetrixplugin.web_ui": Traceback (most recent call last): File "/usr/lib64/python2.7/site-packages/trac/loader.py", line 68, in _load_eggs entry.load(require=True) File "/usr/lib64/python2.7/site-packages/pkg_resources.py", line 2018, in load entry = __import__(self.module_name, globals(),globals(), ['__name__']) File "/usr/lib64/python2.7/site-packages/TracMetrixPlugin-0.1.8dev_r12198-py2.7.egg/tracmetrixplugin/web_ui.py", line 32, in <module> from tracmetrixplugin.model import ChangesetsStats, TicketGroupMetrics File "/usr/lib64/python2.7/site-packages/TracMetrixPlugin-0.1.8dev_r12198-py2.7.egg/tracmetrixplugin/model.py", line 21, in <module> from pylab import date2num, drange, num2date File "/usr/lib64/python2.7/site-packages/pylab.py", line 1, in <module> from matplotlib.pylab import * File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line 772, in <module> rcParams = rc_params() File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line 690, in rc_params fname = matplotlib_fname() File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line 602, in matplotlib_fname fname = os.path.join(get_configdir(), 'matplotlibrc') File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line 253, in wrapper ret = func(*args, **kwargs) File "/usr/lib64/python2.7/site-packages/matplotlib/__init__.py", line 475, in _get_configdir raise RuntimeError("'%s' is not a writable dir; you must set %s/.matplotlib to be a writable dir. You can also set environment variable MPLCONFIGDIR to any writable directory where you want matplotlib data stored "% (h, h)) RuntimeError: '/' is not a writable dir; you must set //.matplotlib to be a writable dir. You can also set environment variable MPLCONFIGDIR to any writable directory where you want matplotlib data stored
comment:14 Changed 12 years ago by
Replying to PetaMem:
trac 1.0 and inspecting the growing log file:
I'll make some quick code changes that might help with debugging the issue. I appreciate if you can help me work through this, and maybe we can finally solve the issue once and for all.
comment:15 Changed 12 years ago by
I made some recent changes to address #8414, as well as investigated this issue. I think the solution is to get rid of the matplotlib dependency (#4845). I expect to get that accomplished within the next several weeks. In the meantime, there are lots of hints in this ticket to try. Please report back if any of them work for you.
comment:16 Changed 11 years ago by
Replying to anonymous:
Try this, it works for me.
mkdir /var/www/.matplotlib chown apache.apache /var/www/.matplotlib
I was having the same problem and found this solution to work for me as well.
comment:17 Changed 9 years ago by
Owner: | Ryan J Ollos deleted |
---|
Trac.log file contains the following entries:-