Python virtualenv: quick reference

Sun 21 July 2019
Virtual environement (Photo credit: wikipedia)

To isolate python developments, I use virtualenv. This allow me to forget about the specific python version used for each project, avoid interferences with the default python installation and between my projects, is relatively light, and may have other advantages I cannot imagine with my current understanding.

Installation

I won't go into details, it is documented, and I recommend using the default distribution packages.

Creation

The quick reference gives all necessary commands:

  • mkvirtualenv
  • workon
  • deactivate

I recommend using the --always-copy option when creating a virtualenv. It avoid breaking the virtualenv when system upgrades may break symlink to old python version.

One tool I usually need is the add2virtualenv to update PYTHONPATH.

Upgrades

One big advantage of virtualenv is the use of pip without side effects. Inside the virtualenv use it without precaution.

Category: programming Tagged: python tools code


R mclapply cores option

Mon 11 August 2014

This morning, I found the default behavior of the mclapply() function not quite different from the one of the lapply().  After quick investigation, I found is was due to an option not correctly set: the number of core to use.

> getOption("cores")
NULL

I must then overwrite the default mc …

Category: programming Tagged: R programming useless

Read More
Page 1 of 1