Silvio Arcangeli
Silvio Arcangeli

Reputation: 43

How to fix corrupted Python search path in Debian 7.5?

I'm configuring a Debian 7.5 server, and up to yesterday the mail server and the policyd-spf Python plugin were running fine.

I added some more Python-related libraries in order to configure Plone (python-setuptools, python-dev, python-imaging), and now the Python setup seems corrupted for some reason.

If I now run policyd-spf manually, I get an ImportError on the spf module. Opening a Python interpreter and checking the sys.path, I get the following:

['', '/usr/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg', '/usr/lib/python2.7/site-packages/virtualenv-1.11.6-py2.7.egg', '/usr/lib/python27.zip', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/lib/python2.7/site-packages']

I noticed that /usr/lib/python2.7/site-packages is there, but /usr/lib/python2.7/dist-packages is missing, and that's the reason for the import error.

I already tried re-installing the python and python-all packages, hoping that a reinstall would have fixed it, but I still have the same problem.

Does anyone know where exactly Debian configured dist-packages to be included in the search path, and how can I recover it?

thanks!

Upvotes: 0

Views: 186

Answers (1)

Silvio Arcangeli
Silvio Arcangeli

Reputation: 43

I fixed it with the following re-install:

apt-get install python2.7-minimal --reinstall

Reinstalling python and python-dev wasn't solving, but python2.7-minimal made the job.

Upvotes: 0

Related Questions