Am 13.11.2017 um 14:09 schrieb Jun Omae:
On Sun, Nov 12, 2017 at 11:41 PM, Torge Riedel <torgerie...@gmx.de> wrote:
Ok, this switched to a general issue. I followed documentation on
https://trac.edgewall.org/wiki/TracInstall and then the following call to
initialize a new environment:

trac-admin /var/www/trac/env2 initenv

Creating a new Trac environment at /var/www/trac/env2

Trac will first ask a few questions about your environment
in order to initialize and prepare the project database.

  Please enter the name of your project.
  This name will be used in page titles and descriptions.

Project Name [My Project]> Test

  Please specify the connection string for the database to use.
  By default, a local SQLite database is created in the environment
  directory. It is also possible to use an existing MySQL or
  PostgreSQL database (check the Trac documentation for the exact
  connection string syntax).

Database connection string [sqlite:db/trac.db]>
mysql://tracuser:MyPwd@localhost:3306/trac

Creating and Initializing Project
Initenv for '/var/www/trac/env2' failed.
Failed to create environment.
Unsupported database type "mysql"
Traceback (most recent call last):
   File "build/bdist.linux-x86_64/egg/trac/admin/console.py", line 500, in
do_initenv
     options=options)
   File "build/bdist.linux-x86_64/egg/trac/core.py", line 136, in __call__
     self.__init__(*args, **kwargs)
   File "build/bdist.linux-x86_64/egg/trac/env.py", line 300, in __init__
     self.create(options)
   File "build/bdist.linux-x86_64/egg/trac/env.py", line 592, in create
     DatabaseManager(self).init_db()
   File "build/bdist.linux-x86_64/egg/trac/db/api.py", line 337, in init_db
     connector, args = self.get_connector()
   File "build/bdist.linux-x86_64/egg/trac/db/api.py", line 615, in
get_connector
     scheme=scheme))
TracError: Unsupported database type "mysql"
Could you please try initenv with logging using --inherit option?

$ cat /path/to/inherit.ini
[logging]
log_type = stderr
log_level = DEBUG
$ trac-admin /path/to/env initenv --inherit=/path/to/inherit.ini
my-project 'mysql://u:p@localhost/t'


In Ubuntu 16.04 on docker, I get the following 2 errors:

Error 1
=======
12:55:21 Trac[loader] DEBUG: Loading plugin "trac.db.mysql" from
"/tmp/venv/lib/python2.7/site-packages"
12:55:21 Trac[loader] ERROR: Skipping "trac.db.mysql =
trac.db.mysql_backend [mysql]":
Traceback (most recent call last):
   File "/tmp/venv/local/lib/python2.7/site-packages/trac/loader.py",
line 68, in _load_eggs
     entry.load(require=True)
   File "/tmp/venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py",
line 2228, in load
     self.require(*args, **kwargs)
   File "/tmp/venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py",
line 2245, in require
     items = working_set.resolve(reqs, env, installer)
   File "/tmp/venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py",
line 808, in resolve
     if not req_extras.markers_pass(req):
   File "/tmp/venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py",
line 993, in markers_pass
     return not req.marker or any(extra_evals) or req.marker.evaluate()
   File 
"/tmp/venv/local/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/markers.py",
line 278, in evaluate
     return _evaluate_markers(self._markers, current_environment)
   File 
"/tmp/venv/local/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/markers.py",
line 203, in _evaluate_markers
     lhs_value = _get_env(environment, lhs.value)
   File 
"/tmp/venv/local/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/markers.py",
line 185, in _get_env
     "{0!r} does not exist in evaluation environment.".format(name)
UndefinedEnvironmentName: 'extra' does not exist in evaluation environment.
12:55:21 Trac[loader] DEBUG: Loading plugin "trac.db.postgres" from
"/tmp/venv/lib/python2.7/site-packages"
12:55:21 Trac[loader] ERROR: Skipping "trac.db.postgres =
trac.db.postgres_backend [postgresql]":
Traceback (most recent call last):
   File "/tmp/venv/local/lib/python2.7/site-packages/trac/loader.py",
line 68, in _load_eggs
     entry.load(require=True)
   File "/tmp/venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py",
line 2228, in load
     self.require(*args, **kwargs)
   File "/tmp/venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py",
line 2245, in require
     items = working_set.resolve(reqs, env, installer)
   File "/tmp/venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py",
line 808, in resolve
     if not req_extras.markers_pass(req):
   File "/tmp/venv/local/lib/python2.7/site-packages/pkg_resources/__init__.py",
line 993, in markers_pass
     return not req.marker or any(extra_evals) or req.marker.evaluate()
   File 
"/tmp/venv/local/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/markers.py",
line 278, in evaluate
     return _evaluate_markers(self._markers, current_environment)
   File 
"/tmp/venv/local/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/markers.py",
line 203, in _evaluate_markers
     lhs_value = _get_env(environment, lhs.value)
   File 
"/tmp/venv/local/lib/python2.7/site-packages/pkg_resources/_vendor/packaging/markers.py",
line 185, in _get_env
     "{0!r} does not exist in evaluation environment.".format(name)
UndefinedEnvironmentName: 'extra' does not exist in evaluation environment.


Error 2 after setuptools is reinstalled
=======
12:57:49 Trac[loader] DEBUG: Loading plugin "trac.db.mysql" from
"/tmp/venv/lib/python2.7/site-packages"
12:57:49 Trac[loader] DEBUG: Skipping "trac.db.mysql =
trac.db.mysql_backend [mysql]": DistributionNotFound: The
'MySQL-python>=1.2.2; extra == "mysql"' distribution was not found and
is required by the application
12:57:49 Trac[loader] DEBUG: Loading plugin "trac.db.postgres" from
"/tmp/venv/lib/python2.7/site-packages"
12:57:49 Trac[loader] DEBUG: Skipping "trac.db.postgres =
trac.db.postgres_backend [postgresql]": DistributionNotFound: The
'psycopg2>=2.0; extra == "postgresql"' distribution was not found and
is required by the application


Hi Jun,

I did the test Ryan suggest:

# python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from trac.db.mysql_backend import has_mysqldb
>>> has_mysqldb
True
>>> from trac.db.mysql_backend import mysqldb_version
>>> mysqldb_version
'1.3.7'
>>> quit()

So, to me it looks like trac can detect the MySQLdb package in this newer 
version. Running your test with debug output it prints like on your d-container:

07:36:16 Trac[loader] DEBUG: Skipping "trac.db.mysql = trac.db.mysql_backend 
[mysql]": DistributionNotFound: The 'MySQL-python>=1.2.2' distribution was not found 
and is required by the application

So somewhere in trac there is an additional check? I will look in the code 
(although I am not a python dev) and try to find the cause of this failing 
check. If you have any hints, it will be very helpful.

Thanks

Torge

--
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To post to this group, send email to trac-users@googlegroups.com.
Visit this group at https://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to