Edgewall Software
Modify

Opened 18 years ago

Closed 16 years ago

#2533 closed defect (invalid)

"Failed to create environment. No module name log" error - fix

Reported by: anaz Owned by: Christian Boos
Priority: normal Milestone:
Component: general Version: 0.9.3
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christian Boos)

Error when initialize project and enter the default template directory.

Creating and Initializing Project
'''Failed to create environment. No module named log'''
Traceback (most recent call last):
  File "C:\Python23\lib\site-packages\trac\scripts\admin.py", line 139, in env_c
reate
    self.__env = Environment(self.envname, create=True, db_str=db_str)
  File "C:\Python23\lib\site-packages\trac\env.py", line 83, in __init__
    self.setup_log()
  File "C:\Python23\lib\site-packages\trac\env.py", line 228, in setup_log
    from trac.log import logger_factory
'''ImportError: No module named log'''
'''Failed to initialize environment. 1'''
Traceback (most recent call last):
  File "C:\Python23\lib\site-packages\trac\scripts\admin.py", line 594, in do_in
itenv
    self.env_create(db_str)
  File "C:\Python23\lib\site-packages\trac\scripts\admin.py", line 144, in env_c
reate
    sys.exit(1)
SystemExit: 1

Attachments (0)

Change History (13)

comment:1 by anonymous, 18 years ago

Version: 0.9.20.8.4

comment:2 by Matthew Good, 18 years ago

Resolution: worksforme
Status: newclosed

Based on the filenames in the traceback you're certainly using code from Trac 0.9 or higher, not 0.8.4. My guess is that you just upgraded and left some of the old code behind which is causing problems. As suggested in the [wiki:TracUpgrade#UpdatetheTracCode upgrade documentation] you may want to delete the old Trac code and reinstall the new version.

comment:3 by chis.florinel@…, 18 years ago

Resolution: worksforme
Status: closedreopened

I'm getting the same error and I just installed for the first time on this machine trac: 0.9.3. Platform: windows

Creating and Initializing Project
Failed to create environment. No module named log
Traceback (most recent call last):
  File "C:\Python23\Lib\site-packages\trac\scripts\admin.py", line 139, in env_c
reate
    self.__env = Environment(self.envname, create=True, db_str=db_str)
  File "C:\Python23\Lib\site-packages\trac\env.py", line 83, in __init__
    self.setup_log()
  File "C:\Python23\Lib\site-packages\trac\env.py", line 228, in setup_log
    from trac.log import logger_factory
ImportError: No module named log
Failed to initialize environment. 1
Traceback (most recent call last):
  File "C:\Python23\Lib\site-packages\trac\scripts\admin.py", line 594, in do_in
itenv
    self.env_create(db_str)
  File "C:\Python23\Lib\site-packages\trac\scripts\admin.py", line 144, in env_c
reate
    sys.exit(1)
SystemExit: 1

comment:4 by Christian Boos, 18 years ago

Description: modified (diff)

Does the file "C:\Python23\Lib\site-packages\trac\log.py" exist?

comment:5 by chis.florinel@…, 18 years ago

Summary: "Failed to create environment. No module name log" error"Failed to create environment. No module name log" error - fix
Version: 0.8.40.9.3

The file C:\Python23\Lib\site-packages\trac\Log.py exists. Changed the name to log.py and now works…

I had a similar problem (case sensitivity) using MySQLDb. I'm not used with case sensitivity issues on windows.

Testing it: (Log.py)

>>> from trac.log import logger_factory
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in ?
    from trac.log import logger_factory
ImportError: No module named log

renamed to log.py

>>> from trac.log import logger_factory
>>>

works fine.

I should have checked the code earlier.

Best regards. Chis Florinel.

comment:6 by Christian Boos, 18 years ago

Now the question is how did you end up with a file named Log.py

comment:7 by chis.florinel@…, 18 years ago

I used the installer: trac-0.9.3.win32.exe, date (downloaded): 29 january 2006.

comment:8 by Christian Boos, 18 years ago

Owner: changed from Jonas Borgström to Christian Boos
Status: reopenednew

I justed tested it… works for me.

But I was nevertheless able to reproduce the problem: the file trac/log.py will be named trac/Log.py if there's already a file named like that before the installation.

That can indeed be the case if you had an old Trac 0.8.x version installed and you didn't uninstall it before installing the 0.9.3 version.

Not sure if we can do something about it, as it seems to be a generic distutils bug. The distutils used was 1.0.4, from 2.3.5 but apparently this behavior is still there with the distutils 2.4.1 that comes with python 2.4.2.

comment:9 by Christopher Lenz, 18 years ago

Resolution: invalid
Status: newclosed

There's nothing we can do about this as long as we want to have the freedom to make changes to module names in Trac 0.x. That's why TracUpgrade says:

“In any case, if you're doing a major version upgrade (such as from 0.8 to 0.9), it is highly recommended that you first remove the existing Trac code. To do this, you need to delete the trac directory from the Python lib/site-packages directory. You may also want to remove the Trac cgi-bin, htdocs, templates and wiki-default directories that are commonly found in a directory called share/trac (the exact location depends on your platform).”

comment:10 by Christian Boos, 18 years ago

I was actually thinking about a pre-install-script that would remove the offending file.

comment:11 by thijs, 17 years ago

I tried installing trac 0.10.3 on ubuntu 6.0.6 and recieved the same error. apt-get install python-mysqldb solved the problem.

comment:12 by anonymous, 16 years ago

Resolution: invalid
Status: closedreopened
Summary: "Failed to create environment. No module name log" error - fixFailed to create environment. No module named MySQLdb
Version: 0.9.30.10-stable

I am getting this error using trac version 0.10 and mysql database:

Creating and Initializing Project Failed to create environment. No module named MySQLdb Traceback (most recent call last):

File "/usr/lib/python2.4/site-packages/trac/scripts/admin.py", line 613, in do_initenv

options=options)

File "/usr/lib/python2.4/site-packages/trac/env.py", line 145, in init

self.create(options)

File "/usr/lib/python2.4/site-packages/trac/env.py", line 250, in create

DatabaseManager(self).init_db()

File "/usr/lib/python2.4/site-packages/trac/db/api.py", line 70, in init_db

connector.init_db(args)

File "/usr/lib/python2.4/site-packages/trac/db/mysql_backend.py", line 44, in init_db

cnx = self.get_connection(path, user, password, host, port, params)

File "/usr/lib/python2.4/site-packages/trac/db/mysql_backend.py", line 40, in get_connection

return MySQLConnection(path, user, password, host, port, params)

File "/usr/lib/python2.4/site-packages/trac/db/mysql_backend.py", line 132, in init

import MySQLdb

ImportError: No module named MySQLdb Failed to initialize environment. 1 Traceback (most recent call last):

File "/usr/lib/python2.4/site-packages/trac/scripts/admin.py", line 617, in do_initenv

sys.exit(1)

SystemExit: 1

Is there anyone with feedback on how to solve this problem? Thanks. —Willie

comment:13 by Emmanuel Blot, 16 years ago

Resolution: invalid
Status: reopenedclosed
Summary: Failed to create environment. No module named MySQLdb"Failed to create environment. No module name log" error - fix
Version: 0.10-stable0.9.3

Issues are not related

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.