Published on

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

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...

tuxedocat@katzenwelt: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?

tuxedocat@katzenwelt:~
➤ 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

tuxedocat@katzenwelt:~
➤ 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