Difference between revisions of "Using virtualenv"
From mn/bio/cees-bioinf
(Created page with "virtualenv is a tool to create isolated Python environments. See [https://virtualenv.pypa.io/en/latest/index.html https://virtualenv.pypa.io/en/latest/index.html] === Setting...") |
|||
Line 2: | Line 2: | ||
=== Setting up virtualenv on the cod-nodes/abel === | === Setting up virtualenv on the cod-nodes/abel === | ||
− | + | <pre>module load python2 | |
− | module load python2 virtualenv my_python_dir | + | virtualenv my_python_dir</pre> |
− | |||
will create locally a python tree. | will create locally a python tree. | ||
Then you can run | Then you can run | ||
− | + | <pre>cd my_python_dir | |
− | cd my_python_dir ./bin/activate | + | ./bin/activate</pre> |
− | + | And you're ready to go.<br/>This will help to set paths properly: | |
− | And you're ready to go. | + | <pre>export PYTHONPATH=$PYTHONPATH:$PWD/lib/python2.7/site-packages/</pre> |
− | |||
− | export PYTHONPATH=$PYTHONPATH:$PWD/lib/python2.7/site-packages/ | ||
− | |||
==== When using setup.py scripts ==== | ==== When using setup.py scripts ==== | ||
− | + | <pre>python setup.py install --prefix=/path/to/my_python_dir</pre> | |
− | python setup.py install --prefix=/path/to/my_python_dir | + | Then to install a package not already in the python2 module do: |
− | + | <pre>pip install package_name</pre> | |
− | < | + | This package (if found by pip) will be installed locally and reachable via the paths previously set up. |
− | |||
− | pip install package_name | ||
− | |||
− |
Revision as of 12:00, 26 January 2015
virtualenv is a tool to create isolated Python environments. See https://virtualenv.pypa.io/en/latest/index.html
Setting up virtualenv on the cod-nodes/abel
module load python2 virtualenv my_python_dir
will create locally a python tree.
Then you can run
cd my_python_dir ./bin/activate
And you're ready to go.
This will help to set paths properly:
export PYTHONPATH=$PYTHONPATH:$PWD/lib/python2.7/site-packages/
When using setup.py scripts
python setup.py install --prefix=/path/to/my_python_dir
Then to install a package not already in the python2 module do:
pip install package_name
This package (if found by pip) will be installed locally and reachable via the paths previously set up.