Saturday, July 17, 2010

Setting Up The Pylons Virtual Environment

The standard way to install Pylons is via the virtual environment. From the Pylons book:
The virtual Python environment is an isolated Python installation set up in such a way that the libraries it contains do not affect programs outside it, making it a good choice for experimenting with new packages or deploying different programs with conflicting library requirements. You can also create a virtual Python environment and install software to it without requiring root or administrator privileges, making it a very useful technique for installing Pylons in a shared environment. It is highly recommended you install Pylons this way if it’s your first time using it.
Here are the steps to setting up a virtual environment:

1) Download the virtualenv.py script.

2) Run the command 'python virtualenv.py --no-site-packages [ENV_NAME]'.

3) cd into [ENV_NAME]/bin and execute easy_install pylons

4) cd ../

5) paster create -t pylons MyFirstProject

if this command produces an error like the following:

pkg_resources.DistributionNotFound: nose>=0.10.4

then you need to use easy_install to install the nose module as follows

python ./bin/easy_install nose

6) finally activate your virtual environment:

source ./bin/activate

Now, lets see if we can stand up the paste server

7) cd MyFirstProject

8) setup your development environment via 'python setup.py develop'

9) paster serve --reload development.ini

Done ...

2 comments:

  1. Thanks for sharing this blog.This article gives lot of information.
    Python Training in Hyderabad

    Python Training

    ReplyDelete
  2. This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post. sales training

    ReplyDelete