Ask HN: Proper way to set up Python dev environment on Ubuntu?

7 points by young_unixer ↗ HN
Do you use venv, virtualenv, virtualenvwrapper, or pipenv?

Do you install pip from the Ubuntu repos or from "https://bootstrap.pypa.io/get-pip.py" ?

Every time I try to set up a Python environment I end up installing pip in 4 different ways and I don't know which version to use and it's a whole mess.

11 comments

[ 6.3 ms ] story [ 35.3 ms ] thread
It depends on how sophisticated your needs are. I mostly run python programs of my own on a single computer. I tell the distribution-provided pip to install an upgraded pip separately (pip3 install --user -U). I install everything using pip3 install --user and under no circumstances run any pip commands as root. So far, I have not needed foo-env or docker.
This is my python setup for ubunut:

    sudo apt remove python3
    sudo apt install python2
    curl https://sh.rustup.rs -sSf | sh # Just in case you want to switch to rust later
Ah yes, Rust - that easy-to-learn world-renowned language for data science, machine learning and web dev.
anyenv + pyenv + pyenv-virtaulenv + poetry
Python3.8 , then use virtual envs with “python -m venv ...”
Can I take in from the answers here that no one uses anaconda?

I'm only a beginner and that is what I was told to use. It has environments too. Should I be using something else?

I think anaconda is mostly used in the data science community, so if that's the kind of work you'll be doing it's great for that (notebooks and such).

For everything else I think virtualenv is fine, bit unintuitive but fit for purpose (more or less).