Edgewall Software

Ticket #5699 (reopened defect)

Opened 14 months ago

Last modified 7 days ago

Python 2.5.1 and _md5

Reported by: mavr1k@… Owned by: cmlenz
Priority: high Milestone:
Component: general Version:
Severity: critical Keywords: python25 _md5 openssl
Cc: miwinter@…

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

Change History

  Changed 14 months ago by anonymous

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

follow-up: ↓ 10   Changed 14 months ago by cboos

  • keywords python25 python26 added
  • severity changed from normal to minor
  • milestone set to 1.0

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.

  Changed 14 months ago by mavr1k@…

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.

  Changed 14 months ago by cboos

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.

  Changed 14 months ago by mavr1k@…

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

  Changed 14 months ago by mavr1k@…

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

  Changed 13 months ago by baeuml@…

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.

  Changed 12 months ago by vladimir ivanov

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

  Changed 9 months ago by Leos1977@…

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   Changed 5 weeks ago by cboos

  • status changed from new to closed
  • resolution set to duplicate
  • milestone 1.0 deleted

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

  Changed 7 days ago by miwinter@…

  • status changed from closed to reopened
  • severity changed from minor to critical
  • cc miwinter@… added
  • component changed from admin/console to general
  • priority changed from normal to high
  • keywords _md5 openssl added; python26 removed
  • resolution duplicate deleted

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?

Add/Change #5699 (Python 2.5.1 and _md5)

Author



Change Properties
<Author field>
Action
as reopened
as The resolution will be set. Next status will be 'closed'
to The owner will change. Next status will be 'new'
 
Note: See TracTickets for help on using tickets.