A short link to this page is https://wiki.list.org/x/4030710

Clear message

4.50. I just did a portupgrade on FreeBSD, but now I get the error "ImportError: No module named os" - what can I do?

Question: I just did a portupgrade on FreeBSD, so that I could get the latest version of all the port definitions. However, after I did so, the mailman web interface broke and I got the following errors in my mail log:

 Command output: Could not find platform independent libraries <prefix>
 Could not find platform dependent libraries <exec_prefix>
 Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
 Traceback (most recent call last):
 File "/usr/local/mailman/scripts/post", line 31, in ?     import paths
 File "/usr/local/mailman/scripts/paths.py", line 27, in ?     import os
 ImportError: No module named os

Answer: This problem appears to happen occasionally when you do a portupgrade on a system where one port (such as mailman) depends on another port (such as python), and may be exacerbated when the system is upgraded while they are running.

If this happens to you, the first thing you need to do is to shut off the mail system and to turn off mailman, so as to minimize the damage while you try to fix the system.

Searching the archives of the FreeBSD mailing lists, the typical solution appears to be to go to the directory of the depending port (e.g., /usr/ports/lang/python), and do the following (as root):

 make deinstall; make clean; make install

Then, stop and start mailman. This has worked for us.

Converted from the Mailman FAQ Wizard

This is one of many Frequently Asked Questions.