Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#45819 closed defect (wontfix)

virtualenv python is missing module search paths that are available when running bare python27.

Reported by: justinjereza@… Owned by: larryv (Lawrence Velázquez)
Priority: Normal Milestone:
Component: ports Version: 2.3.2
Keywords: Cc: petrrr
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 (5)

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

comment:4 in reply to:  description Changed 10 years ago by larryv (Lawrence Velázquez)

Resolution: wontfix
Status: assignedclosed

Replying to justinjereza@…:

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.

This is how virtualenv is supposed to work; using globally-installed modules inside your virtual environments defeats the purpose. If you want to do so anyway, create your environments using virtualenv --system-site-packages.

comment:5 Changed 10 years ago by justinjereza@…

Whoops.. Thanks. I should have taken more time reading the manual.

Note: See TracTickets for help on using tickets.