using_virtualenv - 0victor0/pyping2 GitHub Wiki

pyping2 with virtualenv

If you'd like to use pyping2 on your local machine without changing your machine's default python installation, read on!

Contents

1. VirtualEnv intro 2. Using VirtualEnv 3. Deactivate VirtualEnv

1. Virtualenv intro

VirtualEnv is a Python package that allows you to keep project dependencies separated from your default Python installation; your default python installation location can be shown by the command which python. To install virtualenv, follow the instructions on virtualenv's homepage.

Note that virtualenv and the Anaconda distro do not work well together.

2. Using Virtualenv with pyping2

First download or clone pyping2 from github:

    git clone https://github.com/0victor0/pyping2.git

Enter the pyping2 directory:

    cd pyping2

Now create a new virtual environment. It can be anywhere you like, but for simplicity, we will keep it in pyping2 for this demo:

    virtualenv $(which python2) venv_pyping2

The argument $(which python2) ensures the virtual environment uses your installation of python2, which works best with pyping2.

Next, use the virtual environment:

    source venv_pyping2/bin/active

After you run this command, you will see your command line prompt now has (venv_pying2) at the front, indicating your are now in the virtual environment. Prove this to yourself by verifying the python installation in use:

    which python

You should a print out of the virtual environment you just installed.

Next, install the requirements for pyping2:

    pip install -r requirements.txt

Now verify that requirements have been installed:

    python
    >>>> import pandas
    >>>>

If you receive an ImportError you either A) are not using the virtual environment you created or B) did not install the requirements into the virtual environment.

If you receive no errors, you can now use pyping2!

3. Deactivate VirtualEnv

When you are done with using a virtual environment, leave the virtual environment by deactivating it:

    deactivate

You will see the virtual environment no longer appears at the beginning of your command prompt. You are no longer connected to the virtual environment. Any changes will now affect your machine's default installation until you activate another virtual environment.