Skip to content

Instantly share code, notes, and snippets.

@AlexandraKapp
Last active July 11, 2020 09:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexandraKapp/f2f04604730e79ed93c8dec0563e7a93 to your computer and use it in GitHub Desktop.
Save AlexandraKapp/f2f04604730e79ed93c8dec0563e7a93 to your computer and use it in GitHub Desktop.

Setting up the conda env for a python project with jupyter lab

1. Setup new python project

1. create new environment

conda create --name myenv

with specific python version:

conda create -n myenv python=3.6

2. add ipykernel

activate your env

conda activate myenv

install ipykernel into your env and create a kernel

conda install ipykernel
ipython kernel install --user --name=<any_name_for_kernel>

now, if you start jupyter lab (type jupyter lab into your command line) and choose the respective kernel, your env is available.

3. create environment.yml file

conda env export --from-history > environment.yml

delete the "prefix" line when sharing (??)

2. Load env from existing environment.yml file

1.create env

conda env create -f environment.yml

2.add kernel

ipython kernel install --user --name=<any_name_for_kernel>

now, if you start jupyter lab (type jupyter lab into your command line) and choose the respective kernel, your env is available.

3. Update env from environment.yml file

conda env update -f environment.yml --prune

useful links:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment