Opened 10 years ago

Last modified 10 years ago

#45819 closed defect

virtualenv python is missing module search paths that are available when running bare python27. — at Version 3

Reported by: justinjereza@… Owned by: larryv@…
Priority: Normal Milestone:
Component: ports Version: 2.3.2
Keywords: Cc: petr@…
Port: py27-virtualenv

Description (last modified by larryv (Lawrence Velázquez))

I used the following script to print a list of module search paths:

#!/usr/bin/env python

import sys

for i in sys.path:
    if not i.startswith('/Users'):
        print i

The result from the py27-virtualenv version of python is as follows:

/private/tmp
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages

The result from the python27 is as follows:

/private/tmp
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages

As you can see, there are a lot of paths missing in the virtualenv version resulting in preventing the use of python modules installed via macports in conjunction with virtualenv.

Change History (3)

comment:1 Changed 10 years ago by justinjereza@…

After checking the port file, it looks like the problem is with virtualenv itself and not the port. It may not be handling this particular case where you have different versions of python installed in different directories on a single system.

comment:2 Changed 10 years ago by petrrr

Cc: petr@… added

Cc Me!

comment:3 Changed 10 years ago by larryv (Lawrence Velázquez)

Description: modified (diff)
Owner: changed from macports-tickets@… to larryv@…
Status: newassigned
Note: See TracTickets for help on using tickets.