update the below, things have changed with 2020.02 release
There seems to be two main ways to handle python packaging, pip with pipenv and conda. I’ve gone with conda, though it turns out I often have to use pip inside conda. Anyways, there is a cheatsheet, but here’s all I use:
- download and install anaconda from here.
- restart terminal and check anaconda is in the path by
If its not in the path then:
- on mac, add
export PATH="/anaconda3/bin:$PATH"at the top of
.zshrcif using zsh, on bash it should have automatically added that to
.bash_profile, add if not present.
And python + jupyter lab + a bunch of other packages should be up and running!
Protip: install pip inside a conda enviroment if planning to ever use pip install. Otherwise pip installs inside an environment use the main pip and that is NOT GOOD. though I think this has been fixed with the 2020.02 release?
So here we create a new environment which will use Python 3.8 and pip.
conda create -n awesomeproject python=3.8 pip
Protip: Anaconda as of Feb 2020 still uses python 3.7, so to setup anaconda with 3.8 or later:
conda create -n py38 anaconda=2020.02 python=3.8
This installs the entire anaconda metapackage using python 3.8. Currently I’m using this env as my base one.
Use this environment:
conda activate py38
And a few basic commands:
conda list- shows all packages installed in the active env
Shows all conda envs:
conda env list
Delete an environment:
conda env remove -n py38 --all
Write the packages in use to disk:
This will include both the conda and pip installed packeges in an environment, long as pip was installed inside the environment.
conda list --explicit > py38.txt
Now if I git clone this repo somewhere else, I can recreate the environment by:
conda env create --file py38.txt
Jupyter lab is the new hotness and is ready to rock out of the box with anaconda. to make it easy to select from all the environments installed, in the main anaconda env you will be running it from, install:
conda install nb_conda
This magically makes all the other environments appear in jupyter.