🐡Venv with anaconda (use system's python instead...)

March 30, 2017

tl;dr

Use system’s python instead of anaconda’s one when using python3 -m venv to create virtual envs. (or use --without-pip option)

venvを使うときにはAnaconda環境のPythonだとコケるので、システムのPythonを使うか、--without-pip オプションをつける必要がある。

Log

macOS Sierra 10.12.4, Miniconda3

For tiny web app with flask, anaconda seemed overkill. venv is preferable…

[email protected]:flaskapp
➤ python3 -m venv --prompt web ./env
Error: Command '['/Users/tuxedocat/Codes/_sandbox/flaskapp/env/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.

noo… --without-pip worked, but manual instllation of pip is needed.

What is that ensurepip?

[email protected]:~
➤ python -m ensurepip
/Users/tuxedocat/miniconda3/bin/python: No module named ensurepip

OK, anaconda’s python cannot work in that way because of this

(deleted lines that adds conda path to $PATH)

Omake

[email protected]:~
➤ cat .config/fish/functions/use_conda.fish
function use_conda --description "Simply add conda path"
  set -x PATH ~/miniconda3/bin $PATH
  source ~/miniconda3/etc/fish/conf.d/conda.fish
end