#9595 closed defect (fixed)
Check the Python version on install
Reported by: | hm2k | Owned by: | Remy Blank |
---|---|---|---|
Priority: | high | Milestone: | 0.12.2 |
Component: | admin/console | Version: | 0.13dev |
Severity: | critical | Keywords: | python3 |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
[root@vps112 ~]# trac-admin Traceback (most recent call last): File "/usr/bin/trac-admin", line 7, in ? sys.exit( File "/usr/lib/python2.3/site-packages/setuptools-0.6c11-py2.3.egg/pkg_resources.py", line 318, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/usr/lib/python2.3/site-packages/setuptools-0.6c11-py2.3.egg/pkg_resources.py", line 2221, in load_entry_point return ep.load() File "/usr/lib/python2.3/site-packages/setuptools-0.6c11-py2.3.egg/pkg_resources.py", line 1954, in load entry = __import__(self.module_name, globals(),globals(), ['__name__']) File "build/bdist.linux-i686/egg/trac/admin/__init__.py", line 14, in ? File "/usr/lib/python2.3/site-packages/Trac-0.13dev_r10030-py2.3.egg/trac/admin/api.py", line 140 return list(set(a for a in self if a.startswith(text))) ^ SyntaxError: invalid syntax
Attachments (0)
Change History (14)
comment:1 by , 14 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
follow-up: 3 comment:2 by , 14 years ago
You mean there's no testing to check for the required version?
That seems silly to me.
comment:3 by , 14 years ago
Replying to hm2k:
You mean there's no testing to check for the required version?
You have a point there. We should probably add a check to setup.py
.
comment:4 by , 14 years ago
Yes, a check would be useful. I'd hope this has been implemented by now.
With regards to this, I decided the only thing to do was to upgrade the system from CentOS 4 to CentOS 5, only to find that Python is only 2.4:
[root@vps112 ~]# rpm -q python python-2.4.3-27.el5_5.3
The reason for this is probably due to backporting: http://tinyurl.com/r77l2
It's official: I'm unable to setup/install Trac on CentOS. Am I overlooking something here?
Can anyone advise further?
comment:5 by , 14 years ago
Milestone: | → 0.12.2 |
---|---|
Resolution: | invalid |
Status: | closed → reopened |
Summary: | SyntaxError: invalid syntax → Check the Python version on install |
Install 0.12.1 or from the 0.12-stable branch, which support Python 2.4.
I'll add the version check.
comment:6 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Version check added in [10364].
comment:7 by , 14 years ago
Owner: | set to |
---|
comment:8 by , 11 years ago
Apparently this still raises a syntax error in Python 3:
File "c:... \setuptools-0.9.8-py3.3.egg\setuptools\sandbox.py", line 71 in <lambda> File "c:... \setuptools-0.9.8-py3.3.egg\setuptoools\compat.p", line 92 in execfile File "setup.py", line 21 print "Trac requires Python %d.%d or later" % min_python SyntaxError: invalid syntax
Adding parentheses to all three print
statements in that file might make the file "Python 3 compatible enough" to print the nicer error message. (I have not yet confirmed this though.)
comment:9 by , 11 years ago
I tested out your suggestion, and Trac doesn't support Python 3 (yet)
is printed after adding parenthesis to all 3 print
statements in setup.py
. Tested with Python 3.3.1, 1.0-stable on Ubuntu 13.04.
-
setup.py
diff --git a/setup.py b/setup.py index fac56c1..3cb508b 100755
a b from setuptools import setup, find_packages 18 18 19 19 min_python = (2, 5) 20 20 if sys.version_info < min_python: 21 print "Trac requires Python %d.%d or later" % min_python21 print("Trac requires Python %d.%d or later" % min_python) 22 22 sys.exit(1) 23 23 if sys.version_info >= (3,): 24 print "Trac doesn't support Python 3 (yet)"24 print("Trac doesn't support Python 3 (yet)") 25 25 sys.exit(1) 26 26 27 27 extra = {} … … except ImportError: 49 49 try: 50 50 import genshi 51 51 except ImportError: 52 print "Genshi is needed by Trac setup, pre-installing"52 print("Genshi is needed by Trac setup, pre-installing") 53 53 # give some context to the warnings we might get when installing Genshi
Let me know if that looks good to you and I'm happy to push the change.
comment:12 by , 11 years ago
Cc: | removed |
---|---|
Keywords: | python3 added |
Assuming you meant to add this to Keywords, and I find myself putting keywords in the Cc field fairly often. I see other people on my dev team do it as well, so it might be something we want to address eventually.
comment:13 by , 11 years ago
Oops, yes. Thanks for fixing. (Apparently I'm more used to a different number and distribution of fields.)
You're using Python 2.3, which is not supported anymore starting with Trac 0.12.
And with Trac 0.13dev, you'll even need Python 2.5.
See TracInstall and 0.13/TracInstall.