News for hackers. Stuff that matters.
Re:Creating Python Virtual Environments with Conda: Why and How by bransonf on Tuesday December 10, 2019 @01:24PM (#21755201)
This tells me why a virtual environment is good, but not why a Conda venv is good. Am I missing something?

Why not just use pip?

Re:Creating Python Virtual Environments with Conda: Why and How by jhrmnn on Tuesday December 10, 2019 @02:34PM (#21756009)
Conda virtual environments and Pip are orthogonal. Pip can be used to install into venvs. But as to why use conda rather than just the standard library venv module (python3 -m venv venv): conda can easily manage multiple python versions. In my experience, it's the most hassle-free option compared to something like pyenv. I personally use conda just for managing venvs, and don't use its package manager functionality at all.
Re:Creating Python Virtual Environments with Conda: Why and How by dfsegoat on Tuesday December 10, 2019 @03:02PM (#21756274)
FWIW our use case is the same:

- Conda to manage multiple python versions on 1 box:

  $ conda create -n env27 python=2.7
  $ conda create -n env37 python=3.7

- Pip to manage packages in the environment:

  $ source activate env27
  $ pip install -r requirements_27.txt
Re:Creating Python Virtual Environments with Conda: Why and How by qwerty456127 on Wednesday December 11, 2019 @06:48PM (#21768013)
But why would anybody need a Python version other than the latest? Aren't they backward-compatible within a major version? Won't everything written for Python 3.7 work on 3.8 and everything written for 2.6 work on 2.7?
Re:Creating Python Virtual Environments with Conda: Why and How by meritt on Tuesday December 10, 2019 @02:37PM (#21756045)
I'm by no means a Python expert but I recently had a small project where I needed to convert the output of an SQL query to a parquet file, and I settled on using fastparquet to do so.

I first tried using pip under a venv to install it, and I ran into dependency hell. I needed various dev libs and build-essential on my ubuntu box and I ultimately couldn't get it to compile llvmlite correctly (linker issuers and way too many LLVM versions).

I finally gave up and tried miniconda on a fresh box per some advice here on HN. I simply installed it, ran "conda create -n myenv fastparquet" and it just worked first try. No extra effort involved.

Re:Creating Python Virtual Environments with Conda: Why and How by tel on Tuesday December 10, 2019 @01:34PM (#21755343)
Conda can manage a few things beyond just Pip. Things like binaries, system libs, R installs.

I'm not entirely convinced that's a good thing, but it's an easy path to managing those sorts of libraries alongside your Python libs.

Re:Creating Python Virtual Environments with Conda: Why and How by RobinL on Tuesday December 10, 2019 @01:55PM (#21755623)
One reason it can be very useful is that a conda environment gives data scientists a super easy way to Dockerise their code.

Binder (https://mybinder.org/) is a good example of how well this can work - anyone can reproduce your work using e.g. Jupyter hosted on a binder, build from a conda env.

Re:Creating Python Virtual Environments with Conda: Why and How by Gimpei on Tuesday December 10, 2019 @02:08PM (#21755763)
Conda takes care of a lot of other useful things. For example, it will install cuda and cudnn for you. It will also install mkl. So much easier than pip + many other steps.