Edgewall Software

Ticket #2533 (closed defect: invalid)

Opened 2 years ago

Last modified 4 months ago

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

Reported by: anaz Owned by: cboos
Priority: normal Milestone:
Component: general Version: 0.9.3
Severity: normal Keywords:
Cc:

Description (last modified by cboos) (diff)

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

Change History

Changed 2 years ago by anonymous

  • version changed from 0.9.2 to 0.8.4

Changed 2 years ago by mgood

  • status changed from new to closed
  • resolution set to worksforme

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.

Changed 2 years ago by chis.florinel@…

  • status changed from closed to reopened
  • resolution deleted

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

Changed 2 years ago by cboos

  • description modified (diff)

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

Changed 2 years ago by chis.florinel@…

  • version changed from 0.8.4 to 0.9.3
  • summary changed from "Failed to create environment. No module name log" error to "Failed to create environment. No module name log" error - fix

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.

Changed 2 years ago by cboos

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

Changed 2 years ago by chis.florinel@…

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

Changed 2 years ago by cboos

  • owner changed from jonas to cboos
  • status changed from reopened to new

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.

Changed 2 years ago by cmlenz

  • status changed from new to closed
  • resolution set to invalid

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).”

Changed 2 years ago by cboos

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

Changed 15 months ago by thijs

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.

Changed 4 months ago by anonymous

  • status changed from closed to reopened
  • version changed from 0.9.3 to 0.10-stable
  • resolution deleted
  • summary changed from "Failed to create environment. No module name log" error - fix to Failed to create environment. No module named MySQLdb

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

Changed 4 months ago by eblot

  • status changed from reopened to closed
  • version changed from 0.10-stable to 0.9.3
  • resolution set to invalid
  • summary changed from Failed to create environment. No module named MySQLdb to "Failed to create environment. No module name log" error - fix

Issues are not related

Add/Change #2533 ("Failed to create environment. No module name log" error - fix)

Author



Change Properties
<Author field>
Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.