Python Virtual Environments – a Primer
realpython.com
realpython.com
Just install miniconda (without all the data science packages) and then use pip as normal
http://conda.pydata.org/docs/using/envs.html
Autoswitching when you enter a directory:
You can also set ENVIRONMENT variables for each so that could be useful for specific django projects.
You can use pip from within conda as well if you want to, and you can refer to environment-specific pips directly, such as `~/anaconda/envs/my_env_name/bin/pip install ...` to install for the environment my_env_name.
conda can work with pip-styled requirements.txt files as well, and it's easy to either upload your own packages to anaconda.org, or create the conda build metadata (metadata.yaml) with instructions for how to get the package from PyPI if you prefer to only upload to PyPI.
There is an abundance of well-written tutorials and documentation for these things.
But I agree there's a lot of opportunity for improvement around the configurability of this sort of thing.
One reason anaconda.org is better is that it's also Python agnostic. There is a main channel for R and R packages, so you can actually manage R environments the same way and R dependencies in a Python project. This could conceivably grow to include many things that pip alone can't help you with.
Having built packages both by using the necessary extra setting in a setup.py file, coupled with `python setup.py register` and the PyPI upload commands, and also via the meta.yaml and the anaconda.org upload commands, the latter seems more sensible to me.
Putting info into setup.py is a bad thing generally, especially if you do real work in setup.py, like with a complicated Cython package. Placing that info into meta.yaml offers better separation between data and code, and is remarkably easy to use in a cross-platform way with just `conda build`.
There's a lot more related to configurability and advanced options, but the above examples have been enough for me to fully use conda and to support other packaging as secondary when necessary.
Works perfectly well inside conda, and properly tracked. Packages don't have to come from anaconda/binstar.
conda installs pythons as well. like pyenv, but I lost a bunch of time trying to get that to work correctly.
everytime I used virtualenv I had to go look up things and many things still didn't work with the same ease as nvm rvm etc. There's virtualenv, virtualenvwrapper (to make it somewhat usable ? I forget); pyenv; pyenv-virtualenv (what?)
conda has always worked flawlessly for me without fussing.
[0] http://www.gnu.org/software/guix/manual/html_node/Invoking-g...
Just yesterday I added a few tasks to the ansible playbook for my workstation to automate its installation:
https://github.com/berdario/dotfiles/commit/4e92cdb00dbe135f...
Small disclaimer: I'm also the author of Pew ( https://github.com/berdario/pew ), an alternative to virtualenvwrapper... and I'm working on a small program to try to automate further what pypi2nix/guix-import do to automatically package Python stuff for Nix/Guix... Until that'll be really easy, I think that whipping up a new pew virtualenv to try something out quickly is still the easiest thing (especially for people not used to Nix... I know: otherwise you can also use mutable virtualenvs on top of Nix)
Oftentimes when you need package management (pip) and multiple environments (virtualenv) you likely also have several services necessary for your projects (Python, Postgres, Nginx, Celery, et al.) and it can be easier for your team to run `docker-compose up` and have the whole stack running in lieu of setting up services manually and then initializing a virtual environment.
I much prefer taking the time to setup Docker Compose even for a simple project. I don't have to initialize a virtual environment, install packages, make sure the DB is running, sync with the DB, run the web server, etc. All of that work becomes automatic and I can focus on development instead sysadmin stuff.
Why use Nix instead of containers or VMs?
Making it kinda useless for anything like numpy or scipy.
"Why use Nix instead of containers or VMs?"
Well, why use virtualenvs instead of containers or VMs?
Because it's lighter weight and more straightforward. And doesn't require you to swap out your whole working environment every time you want a slightly different package setup.
Containers and VMs are a bad excuse for "I don't have a hope of getting the dependencies of my setup under control so I'm just going to ball them all up into this great big binary image."
Nix packages are incredibly flexible and composable in comparison.
$ python3 -m venv myvenv $ source myvenv/bin/activate