Edgewall Software
Modify

Opened 17 years ago

Closed 16 years ago

#5699 closed defect (duplicate)

Python 2.5.1 and _md5

Reported by: mavr1k@… Owned by: Christopher Lenz
Priority: normal Milestone:
Component: admin/console Version:
Severity: minor Keywords: python25 python26
Cc: miwinter@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

I recently just upgraded to python 2.5.1 (from source), and now when running trac-admin receive the following error:

Traceback (most recent call last):
  File "/usr/bin/trac-admin", line 21, in <module>
    from trac.scripts.admin import run
  File "/usr/lib/python2.5/site-packages/trac/scripts/admin.py", line 27, in <module>
    from trac import perm, util, db_default
  File "/usr/lib/python2.5/site-packages/trac/perm.py", line 21, in <module>
    from trac.config import ExtensionOption
  File "/usr/lib/python2.5/site-packages/trac/config.py", line 26, in <module>
    from trac.util import sorted
  File "/usr/lib/python2.5/site-packages/trac/util/__init__.py", line 21, in <module>
    import md5
  File "/usr/lib/python2.5/md5.py", line 6, in <module>
    from hashlib import md5
  File "/usr/lib/python2.5/hashlib.py", line 133, in <module>
    md5 = __get_builtin_constructor('md5')
  File "/usr/lib/python2.5/hashlib.py", line 60, in __get_builtin_constructor
    import _md5
ImportError: No module named _md5

Attachments (0)

Change History (12)

comment:1 by anonymous, 17 years ago

More info:

"Python 2.5 has deprecated the use of the sha1 and md5 modules in favor of the hashlib module. A patch will be following that implements django.contrib.auth.models methods using hashlib."

http://code.djangoproject.com/ticket/3604

comment:2 by Christian Boos, 17 years ago

Keywords: python25 python26 added
Milestone: 1.0
Severity: normalminor

Well, deprecated the use doesn't mean the code won't work anymore. As you can see from the backtrace, doing import md5 actually triggers a from hashlib import md5. The failure you actually have is that it can't load the (binary) module _md5. As you said you've built 2.5.1 from source, I suspect that module was simply not built or installed.

That being said, we can be a bit more future proof, the way suggested in the patch above.

comment:3 by mavr1k@…, 17 years ago

How would I resolve this for my installation of trac? The traceback seems to be pointing to different files then the patch linked. I guess i could just apply the patch to said file anyway.

comment:4 by Christian Boos, 17 years ago

This has nothing to do with Trac, it's your Python build which is broken. In the Python interactive interpreter, try:

$ python
>>> from hashlib import md5

I'm quite sure you'll get the same error.

comment:5 by mavr1k@…, 17 years ago

Any suggestions then? (Other then backing python down to 2.4.x, I have another important app that requires 2.5)

comment:6 by mavr1k@…, 17 years ago

This also makes the FastCGI module bomb out, any ideas?

comment:7 by baeuml@…, 17 years ago

Do you see a difference when you run

$ env python
>>> from hashlib import md5

vs(notice the '-')

$ env - python
>>> from hashlib import md5

I had the strange case, that the first one worked, the second one didn't. It turned out, that the my shell script (a svn post-commit script actually) somehow lost the environment variables, and therefore also lost the value in LD_LIBRARY_PATH, which contained the search path where python would normally find the md5 module (like in the first case).

I fixed it by setting LD_LIBRARY_PATH in the (shell) script directly so that it could find the needed library.

comment:8 by vladimir ivanov, 17 years ago

I fixed the problem by recompiling both apache and mod_python. That is on gentoo box.

comment:9 by Leos1977@…, 17 years ago

Hi, can you help me out about how to use the models.py. Beacuase I don´t know which files I have to modify or recompile or where I have to put this file to solve the problem of md5.

Thanks in advance.

in reply to:  2 comment:10 by Christian Boos, 16 years ago

Milestone: 1.0
Resolution: duplicate
Status: newclosed

Replying to cboos:

Well, deprecated the use doesn't mean the code won't work anymore. As you can see from the backtrace, doing import md5 actually triggers a from hashlib import md5. The failure you actually have is that it can't load the (binary) module _md5. As you said you've built 2.5.1 from source, I suspect that module was simply not built or installed.

worksforme for that part, as said in comment:8

That being said, we can be a bit more future proof, the way suggested in the patch above.

See #7458 which has a patch (many actually ;-) ).

comment:11 by miwinter@…, 16 years ago

Cc: miwinter@… added
Component: admin/consolegeneral
Keywords: _md5 openssl added; python26 removed
Priority: normalhigh
Resolution: duplicate
Severity: minorcritical
Status: closedreopened

Well somehow a few weeks ago I got buildbot to install, apparently with bandaids and bailing wire and some trick Ive forgotten. I could use some help. Either with memory or how to disable ssl or include the correct header i think this requires an override for value from uname -p, since openssl-64 header is missing, so I want to revert to using the headers for i386. Im looking for the flag to configure to execute this override to pass to configure, so far w/o success Then with recent makefile cleanup (buildbot installs fine on xe-sawwing) and reinstall attempt I think I hit a python version /openssl version mismatch. So for now, buildbot master and checkout client is broken. http://www.nabble.com/-Bug-36016--python,-ASSIGNED:-python-hash-libraries-missing,-can-not-resolve-md5-_md5-for-example-(after-2.5.1-hashlib-reorg)-td18048988.html compilation issue expresses in python build w/ syntax issues in ssl headers. adb-bldsrv-04: rpm -qf /usr/include/openssl/bn.h

openssl-devel-0.9.7a-43.14 adb-bldsrv-04: uname -a Linux adbu-bldsrv-04 2.6.9-42.7.ELsmp #1 SMP Tue Sep 5 18:25:41 EDT 2006 x86_64 x86_64 x86_64 GNU/Linux

adb-bldsrv-04: rpm -qa|grep opens

openssl-devel-0.9.7a-43.14 openssh-askpass-gnome-3.9p1-8.RHEL4.15 openssh-clients-3.9p1-8.RHEL4.15 openssh-server-3.9p1-8.RHEL4.15 openssh-3.9p1-8.RHEL4.15 xmlsec1-openssl-1.2.6-3 openssl-0.9.7a-43.14 openssh-askpass-3.9p1-8.RHEL4.15 openssl-0.9.7a-43.14

Whereas on a 32bit box build with same makefile is fine: xe-sawwing: rpm -qf /usr/include/openssl/bn.h

openssl-devel-0.9.7a-33.21.Reactivity.2

xe-sawwing: uname -a

Linux sawwing.reactivity.com 2.4.21-47.ELsmp #1 SMP Wed Jul 5 20:38:41 EDT 2006 i686 i686 i386 GNU/Linux

xe-sawwing: rpm -qa|grep opens

openssh-server-3.6.1p2-33.30.12.Reactivity.1 openssh-clients-3.6.1p2-33.30.12.Reactivity.1 openssl-0.9.7a-33.21.Reactivity.2 openssl-devel-0.9.7a-33.21.Reactivity.2 openssh-3.6.1p2-33.30.12.Reactivity.1

xe-sawwing: rpm -qf /usr/include/openssl/bn.h

openssl-devel-0.9.7a-33.21.Reactivity.2

on adbu-bldsrv, first exception is seen here….

from /work/miwinter/sandbox/waas/test/Python-2.5.2/Modules/_ssl.c:36:

/usr/include/openssl/opensslconf.h:25:32: opensslconf-x86_64.h: No such file or directory In file included from /usr/include/openssl/asn1.h:67,

from /usr/include/openssl/rsa.h:62, from

/work/miwinter/sandbox/waas/test/Python-2.5.2/Modules/_ssl.c:36: /usr/include/openssl/bn.h:245: error: syntax error before "BN_ULONG"

then after 'successfully' completing and requesting install of setuptools cant find module _md5 workaround? consider forcing compilaton for i686 or different combo of openssl version?

comment:12 by Remy Blank, 16 years ago

Component: generaladmin/console
Keywords: python26 added; _md5 openssl removed
Priority: highnormal
Resolution: duplicate
Severity: criticalminor
Status: reopenedclosed

WrongTrac or spam?

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christopher Lenz.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christopher Lenz 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.