[IPython-dev] test_pr for 3.x picking up 2.x paths

Fernando Perez fperez.net at gmail.com
Sun Jun 3 19:21:32 EDT 2012

On Sun, Jun 3, 2012 at 1:28 PM, Min RK <benjaminrk at gmail.com> wrote:
> Is it possible the venv hardcoded the PYTHONPATH into its site when it created the env?

Found it.  Very, very tricky debugging that required isntrumenting the
venv site.py with a custom class for sys.path that would trigger
pdb.set_trace() if anything attempted to insert a directory with '2.7'
in the name, eventually led me to finding this as the culprit:

blanca[~]> cat /home/fperez/.local/lib/python3.2/site-packages/easy-install.pth
import sys; sys.__plen = len(sys.path)
import sys; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:];
p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert =

For some completely incomprehensible reason, my distutils file in
~/.local for Python3 got built with a 2.7 path.  I'm not even going to
try to understand why that happened, I'm just sure that's what was
causing this problem, so I'll simply nuke it.

And that's why nobody else was seeing it.

Debugging the assembly of sys.path is not particularly pleasant, as
it's a global object that many codepaths jam directories into as the
interpreter spins up.

Oh well, one hour burned but one problem solved :) I can run test_pr again...



More information about the IPython-dev mailing list