List all virtualenv created by virtualenvwrapper

You can use the lsvirtualenv, in which you have two options “long” or “brief”: “long” option is the default one, it searches for any hook you may have around this command and executes it, which takes more time. “brief” just take the virtualenvs names and prints it. brief usage: $ lsvirtualenv -b long usage: $ … Read more

Ansible command from inside virtualenv?

The better way is to use the full path to installed script – it will run in its virtualenv automatically: tasks: – name: install python packages pip: name={{ item }} virtualenv={{ venv }} with_items: [ buildbot ] – name: create buildbot master command: “{{ venv }}/bin/buildbot create-master ~/buildbot creates=~/buildbot/buildbot.tac”

How to make sphinx look for modules in virtualenv while building html?

The problem is correctly spotted by Mathijs. $ which sphinx-build /usr/local/bin/sphinx-build I solved this issue installing sphinx itself in the virtual environment. With the environment activated: $ source /home/migonzalvar/envs/myenvironment/bin/activate $ pip install sphinx $ which sphinx-build /home/migonzalvar/envs/myenvironment/bin/sphinx-build It seems neat enough.

How to automatically activate virtualenvs when cd’ing into a directory

Add following in your .bashrc or .zshrc function cd() { builtin cd “$@” if [[ -z “$VIRTUAL_ENV” ]] ; then ## If env folder is found then activate the vitualenv if [[ -d ./.env ]] ; then source ./.env/bin/activate fi else ## check the current folder belong to earlier VIRTUAL_ENV folder # if yes then … Read more

Does virtualenv serve a purpose (in production) when using docker?

Virtualenv was created long before docker. Today, I lean towards docker instead of virtualenv for these reasons: Virtualenv still means people consuming your product need to download eggs. With docker, they get something which is “known to work”. No strings attached. Docker can do much more than virtualenv (like create a clean environment when you … Read more

How to get virtualenv to work with fish shell?

You don’t need to activate to use virtualenv it is a convenience. You can just use the virtualenv directly: virtualenv venv ./venv/bin/pip install foo Have you tried from fish using: . venv/bin/activate.fish It probably isn’t as widely used as bash so may have issues – looking at the commit history shows a recent fix: https://github.com/pypa/virtualenv/blob/master/virtualenv_embedded/activate.fish