Problems running VirtualEnv under Windows.

Discussion in 'Python' started by ashconnor, Jul 12, 2010.

  1. ashconnor

    ashconnor Guest

    Hello,

    After reading 'Practical Django Projects' I decided that I want to
    implement the VirtualEnv tip suggested in order to properly segregate
    code/modules in different projects. I am however having problems with
    my django installations not using site-packages within the virtualenv
    but rather attempting to use site-packages in the default python
    installation directory.

    Recreating the problem:

    1) Install Python 2.7 via the Windows installer. Add C:/Python27;C:/
    Python27/Scripts to Windows PATH.
    2) Install setuptools-0.6c11-py2.7.egg via the Windows installer.
    3) Install VirtualEnv through `pip install virtualenv`
    4) Create an VirtualEnv via `virtualenv --no-site-packages MyEnvName`
    5) Activate VirtualEnv via `../MyEnvName/Scripts/activate.bat`
    6) Install django via `pip install django`
    7) Run django-admin.py startproject ProjectName
    8) Error results stating django.core module does not exist.

    NB: This error will not occur if django is installed in your root
    directory.
    NB2: Running the Python interpreter in active VirtualEnv to print the
    sys.path shows the correct paths. Which has just futher added to my
    confusion.

    I'd appreciate any insight or troubleshooting assistance.

    Thanks

    Ash
     
    ashconnor, Jul 12, 2010
    #1
    1. Advertising

  2. ashconnor

    ashconnor Guest

    I've resolved this issue by deleting the *.py file association in
    Windows.

    You can do this either by associating *.py with something like
    textpad, using a utility such as http://defaultprogramseditor.com/ or
    doing so in the registry.

    Note that when using the command like you need to issue commands with
    a preceding `python` keyword.

    For example in a normal installation enviroment the following is
    possible `django-admin.py startproject MyProject`, however in a
    VirtualEnv with *.py associations removed one must do `python django-
    admin.py startproject MyProject` otherwise Windows will attempt to
    open the file in the default application even if there isn't one.

    Thanks,

    Ash

    On Jul 12, 1:55 am, ashconnor <> wrote:
    > Hello,
    >
    > After reading 'Practical Django Projects' I decided that I want to
    > implement the VirtualEnv tip suggested in order to properly segregate
    > code/modules in different projects. I am however having problems with
    > my django installations not using site-packages within the virtualenv
    > but rather attempting to use site-packages in the default python
    > installation directory.
    >
    > Recreating the problem:
    >
    > 1) Install Python 2.7 via the Windows installer. Add C:/Python27;C:/
    > Python27/Scripts to Windows PATH.
    > 2) Install setuptools-0.6c11-py2.7.egg via the Windows installer.
    > 3) Install VirtualEnv through `pip install virtualenv`
    > 4) Create an VirtualEnv via `virtualenv --no-site-packages MyEnvName`
    > 5) Activate VirtualEnv via `../MyEnvName/Scripts/activate.bat`
    > 6) Install django via `pip install django`
    > 7) Run django-admin.py startproject ProjectName
    > 8) Error results stating django.core module does not exist.
    >
    > NB: This error will not occur if django is installed in your root
    > directory.
    > NB2: Running the Python interpreter in active VirtualEnv to print the
    > sys.path shows the correct paths. Which has just futher added to my
    > confusion.
    >
    > I'd appreciate any insight or troubleshooting assistance.
    >
    > Thanks
    >
    > Ash
     
    ashconnor, Jul 12, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. hshdude
    Replies:
    12
    Views:
    1,096
    Dimitri Maziuk
    Nov 4, 2004
  2. Guillermo
    Replies:
    1
    Views:
    341
    Michel Claveau - MVP
    Oct 26, 2009
  3. Diez B. Roggisch

    Re: PyChecker under python's virtualenv

    Diez B. Roggisch, Feb 3, 2010, in forum: Python
    Replies:
    2
    Views:
    662
    Diez B. Roggisch
    Feb 4, 2010
  4. Gelonida N
    Replies:
    4
    Views:
    1,006
    Gelonida N
    Aug 11, 2011
  5. Andrea Crotti

    running in a virtualenv

    Andrea Crotti, Jan 26, 2012, in forum: Python
    Replies:
    0
    Views:
    131
    Andrea Crotti
    Jan 26, 2012
Loading...

Share This Page