#5345 closed defect (fixed)
[Patch] TracError: The Trac Environment needs to be upgraded
Reported by: | fruffell | Owned by: | Steffen Hoffmann |
---|---|---|---|
Priority: | normal | Component: | TagsPlugin |
Severity: | normal | Keywords: | cursor upgrade error |
Cc: | lkraav | Trac Release: | 0.11 |
Description (last modified by )
Setup:
Windows Server 2003 Apache 2.2 Python 2.5 Trac 0.11 TracTags 0.6
After installing and enabling TracTags in trac.ini, I get the following message:
TracError: The Trac Environment needs to be upgraded. Run "trac-admin c:\projects\trac\unitronrdsoftwaregroupwiki upgrade"
Upgrade goes fine, restart Apache, same error.
Attachments (0)
Change History (24)
comment:1 follow-up: 4 Changed 15 years ago by
comment:2 Changed 15 years ago by
Same issue with:
- Trac 0.11.4
- Apache2 running on Debian
- Python2.4
- TimingAndEstimationPlugin
Output of trac-admin <project> upgrade is:
Worklog needs an upgrade Upgrading Database Creating work_log table Updating work_log table (v2) Done upgrading Worklog Upgrade done.
The output of the second run of trac-admin <project> upgrade is the same.
comment:4 Changed 15 years ago by
Replying to ambling@msn.com:
same error for
- Windows 2003 Server
- Apache 2.0.63
- Trac 0.11rc2
- TagsPlugin 0.6
after disable TagModelProvider, it works.
comment:5 Changed 15 years ago by
I ran into the same problem and tracked it down to a new version of pysqlite. The problem is that the cursor is created before calling self._need_migration
in model.py and then that method creates another cursor itself. The old cursor is thus closed by pysqlite. When the migration-method returns no operation can be done on the old cursor anymore so an exception is thrown that the plugin interprets as that there is no table tags.
By the way, 0.4.1 is also affected (there it's api.py) which some people still use for Trac 0.10.
The following patch for 0.6 fixes it:
-
model.py
old new 20 20 self._upgrade_db(self.env.get_db_cnx()) 21 21 22 22 def environment_needs_upgrade(self, db): 23 cursor = db.cursor()24 23 if self._need_migration(db): 25 24 return True 26 25 try: 26 cursor = db.cursor() 27 27 cursor.execute("select count(*) from tags") 28 28 cursor.fetchone() 29 29 return False
comment:7 Changed 15 years ago by
same error after installing TagsPlugin and Environment upgrade:
- Windows XP SP2
- Apache 2.2.11
- Trac 0.11.5
- Python 2.6
- pysqlite-2.5.5.win32-py2.6.exe
- TagsPlugin 0.6
File "C:\Python26\lib\site-packages\trac\db\sqlite_backend.py", line 50, in _r return function(self, *args, **kwargs) pysqlite2._sqlite.OperationalError: table tags already exists
The patch helped me too. Thanks!
comment:8 Changed 15 years ago by
I ran into the same problem as it seems, when upgrading from Ubuntu Jaunty to Karmic.
Traceback (most recent call last): File "/usr/local/bin/trac-admin", line 8, in <module> load_entry_point('Trac==0.11.5', 'console_scripts', 'trac-admin')() File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.5-py2.6.egg/trac/admin/console.py", line 1314, in run return admin.onecmd(command) File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.5-py2.6.egg/trac/admin/console.py", line 133, in onecmd rv = cmd.Cmd.onecmd(self, line) or 0 File "/usr/lib/python2.6/cmd.py", line 219, in onecmd return func(arg) File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.5-py2.6.egg/trac/admin/console.py", line 1154, in do_upgrade self.__env.upgrade(backup=do_backup) File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.5-py2.6.egg/trac/env.py", line 457, in upgrade participant.upgrade_environment(db) File "build/bdist.linux-i686/egg/tractags/model.py", line 35, in upgrade_environment File "build/bdist.linux-i686/egg/tractags/model.py", line 60, in _upgrade_db File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.5-py2.6.egg/trac/db/util.py", line 60, in execute return self.cursor.execute(sql) File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.5-py2.6.egg/trac/db/sqlite_backend.py", line 58, in execute args or []) File "/usr/local/lib/python2.6/dist-packages/Trac-0.11.5-py2.6.egg/trac/db/sqlite_backend.py", line 50, in _rollback_on_error return function(self, *args, **kwargs) pysqlite2.dbapi2.OperationalError: table tags already exists
As there seems to be some solution for this problem mentioned above, could anyone point me to what I have to do now? Where do I find that file for applying the changes in this patch above (I don't see a patch-file)? What do I have to do next?
I really need my trac-environment up and running, so your help is really appreciated.
comment:9 Changed 15 years ago by
OK, replying myself. I figured it out and I now provide the solution for others having this problem:
Upgrading Ubuntu Jaunty to Karmic and fixing TracTags afterwards
- Deinstall and delete existing TracTags-plugin
sudo easy_install -m TracTags sudo rm /usr/lib/python2.6/dist-packages/TracTags*
- Check out the source from trac-hacks and build an egg
svn co http://trac-hacks.org/svn/tagsplugin/tags/0.6 TracTags cd TracTags python setup.py bdist_egg
- Install the egg
cd dist sudo easy_install TracTags-0.6-py2.6.egg
Here you go, everything fine again.
comment:10 Changed 15 years ago by
Cc: | lkraav added; anonymous removed |
---|
comment:11 Changed 15 years ago by
Summary: | TracError: The Trac Environment needs to be upgraded. → [Patch] TracError: The Trac Environment needs to be upgraded |
---|
comment:12 Changed 15 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Seems like for some of us it's a PYTHONPATH issue: trac-admin doesn't upgrade because it can't find the python modules of the participants who needs the upgrade. Just run trac-admin with the porper PYTHONPATH set. Worked for me.
comment:13 Changed 14 years ago by
comment:14 Changed 14 years ago by
Another variant of this: my trac worked fine under tracd, but complained about needing an upgrade when run under mod_wsgi. Updating TagsPlugin to r7383 fixed it.
comment:15 Changed 14 years ago by
comment:16 Changed 14 years ago by
This is also discussed in #7504, so it seems the issue is not fixed, but at least there is still an open ticket for it.
comment:17 Changed 14 years ago by
Description: | modified (diff) |
---|
comment:18 Changed 13 years ago by
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
Problem still happening under Linux/Ubuntu 10.04, Trac 0.11.5, Python 2.6, TracTags 0.6.
comment:19 Changed 13 years ago by
comment:20 Changed 13 years ago by
sorry, the above message should be read "TracTags 0.6"
I've just installed the latest source from trunk and as I see the problem disappeared!
:)
comment:21 Changed 13 years ago by
Keywords: | cursor error added |
---|---|
Owner: | changed from Alec Thomas to Steffen Hoffmann |
Status: | reopened → new |
#7504 has been closed as a duplicate, but contains a better, very valuable description compared to this one.
comment:22 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
(In [10382]) TagsPlugin: Obtain db cursor close to it's use, closed #5345.
This avoids issues of false positive checks here, but his is another issue.
Just correct it now for both 0.6
and trunk
.
comment:23 Changed 13 years ago by
(In [10384]) TagsPlugin: Don't catch all exceptions silently, refs #5345.
Errors from db operations throw not selectively catchable OperationalError
,
but don't swallow each and every exception without notice - at least log them.
comment:24 Changed 13 years ago by
#8043 might be a duplicate. Requesting feedback in that ticket on possible resolution of issue with latest trunk.
same error for