Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8785861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:27:57+00:00 2026-06-13T21:27:57+00:00

I am under the impression that using the –system-site-packages flag with virtualenv will allow

  • 0

I am under the impression that using the –system-site-packages flag with virtualenv will allow the virtual environment to use the already installed system packages. However I am finding that this is not the case. I am using a custom compiled version of python. You can see the problem in the steps below.

[user@machine django]$ which python
/app/python/bin/python
[user@machine django]$ which pip
/app/python/bin/pip
[user@machine django]$ which virtualenv
/app/python/bin/virtualenv
[user@machine django]$ python
Python 2.7.3 (default, Jul 27 2012, 11:30:41)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> exit()
[user@machine django]$ pip freeze
Django==1.4.2
distribute==0.6.30
mercurial==2.3.2
python-ldap==2.4.10
virtualenv==1.8.2
wsgiref==0.1.2
[user@machine django]$ pip --version
pip 1.2.1 from /app/python/lib/python2.7/site-packages (python 2.7)
[user@machine django]$ env
<snip>
LD_LIBRARY_PATH=/app/python/lib:/app/openldap/lib:/app/instantclient_11_2
PATH=/app/python/bin:/app/openldap/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/bin/cfdelivered:/home/user/bin:/app/oracle/product/java/jdk1.6.0_30/bin
PYTHONPATH=/app/python/lib/python2.7
[user@machine django]$ virtualenv --system-site-packages --distribute --python /app/python/bin/python2.7 foo
Running virtualenv with interpreter /app/python/bin/python2.7
New python executable in foo/bin/python2.7
Also creating executable in foo/bin/python
Installing distribute...<snip>...done.
Installing pip................done.
[user@machine django]$ . foo/bin/activate
(foo)[user@machine django]$ which python
/app/xxx/django/foo/bin/python
(foo)[user@machine django]$ which pip
/app/xxx/django/foo/bin/pip
(foo)[user@machine django]$ env
<snip>
LD_LIBRARY_PATH=/app/python/lib:/app/openldap/lib:/app/instantclient_11_2
VIRTUAL_ENV=/app/xxx/django/foo
PATH=/app/xxx/django/foo/bin:/app/python/bin:/app/openldap/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/bin/cfdelivered:/home/user/bin:/app/oracle/product/java/jdk1.6.0_30/bin
PYTHONPATH=/app/python/lib/python2.7
(foo)[user@machine django]$ python
Python 2.7.3 (default, Jul 27 2012, 11:30:41)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named django
>>>

Results of python2.7 -c “import sys;print(sys.path)”

Normal:

[user@machine django]$ python2.7 -c "import sys;print(sys.path)" ['', '/app/python/lib/python2.7/site-packages/cx_Oracle-5.1.2-py2.7-linux-x86_64.egg'‌​, '/app/python/lib/python2.7/site-packages/python_ldap-2.4.10-py2.7-linux-x86_64.e‌​gg', '/app/python/lib/python2.7', '/app/python/lib/python27.zip', '/app/python/lib/python2.7/plat-linux2', '/app/python/lib/python2.7/lib-tk', '/app/python/lib/python2.7/lib-old', '/app/python/lib/python2.7/lib-dynload', '/app/python/lib/python2.7/site-packages']

Inside venv:

(foo)[user@machine django]$ python2.7 -c "import sys;print(sys.path)" ['', '/app/xxx/django/foo/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg', '/app/xxx/django/foo/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg', '/app/python/lib/python2.7', '/app/xxx/django/foo/lib/python27.zip', '/app/xxx/django/foo/lib/python2.7', '/app/xxx/django/foo/lib/python2.7/plat-linux2', '/app/xxx/django/foo/lib/python2.7/lib-tk', '/app/xxx/django/foo/lib/python2.7/lib-old', '/app/xxx/django/foo/lib/python2.7/lib-dynload', '/app/xxx/django/foo/lib/python2.7/site-packages']
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:27:58+00:00Added an answer on June 13, 2026 at 9:27 pm

    I’m not sure what went wrong when you created the virtualenv but clearly it does not have the expected values in its sys.path. If you use virtualenv x --system-site-packages to create virtual environment x, you should see the parent Python’s site-packages directory on sys.path. In your listing above, the last item for the inside venv case should be the same as the normal case: /app/python/lib/python2.7/site-packages. You might try experimenting creating two simple virtualenv, with and without --system-site-packages, to see if that is the case. If not, you might try simplifying your configuration and trying again, like removing environment variables like PYTHONPATH which you should not need to set.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was under the impression that using the Resolve method returned a new instance
I've always been under the impression that using the ThreadPool for (let's say non-critical)
I was under the impression that if I deployed my application (using Ant) then
I'm under the impression that a control in a nested UpdatePanel will cause the
I was under the impression that using an annotation like this: <Required()> <DisplayName(Choose a
I was under the impression that using setjmp() and longjmp() in C++ was almost
I'm using PDO and was under the impression that prepare escaped apostrophes but I
Until today I was living under the impression that RSA encryption using RSA is
I was under the impression that using Task's ContinueWith method with a UI context
I was under the impression that since I'm using the current version of jQuery,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.