Pyenv kernel tutorial
Created tutorial for creation of Jupyter kernel using pyenv.
Merge request reports
Activity
- 001-Jupyter/Create_JupyterKernel_pyenv.ipynb 0 → 100644
34 "cell_type": "markdown", 35 "metadata": {}, 36 "source": [ 37 "## Building your own Jupyter pyenv-kernel is a four-step process\n", 38 "\n", 39 "1. **[Download/Install pyenv](#install)**: To start from scratch, and run the full installation.\n", 40 "2. **[Create and setup environment](#environment)**: To create an(other) environment in an existing pyenv setup.\n", 41 "3. **[Create/Edit launch script for the Jupyter kernel](#kernel)**: To setup an environment to be run via Jupyter.\n", 42 "4. **[Create/Edit Jupyter kernel configuration](#json)**: To attach your user to an existing environment via Jupyter. " 43 ] 44 }, 45 { 46 "cell_type": "markdown", 47 "metadata": {}, 48 "source": [ 49 "If `pyenv` is already installed, start at 2.\n", Wouldn't it be better to install it at $PROJECT_/$USER/.pyenv?
If two different users from the same project try to build their own pyenv the first will succeed and the second will fail.Edited by Jens Henrik Goebbertchanged this line in version 2 of the diff
- 001-Jupyter/Create_JupyterKernel_pyenv.ipynb 0 → 100644
84 ] 85 }, 86 { 87 "cell_type": "markdown", 88 "metadata": {}, 89 "source": [ 90 "Also the environment name can be set in an environment variable **PYENV_ENV** to simplify the process:" 91 ] 92 }, 93 { 94 "cell_type": "code", 95 "execution_count": null, 96 "metadata": {}, 97 "outputs": [], 98 "source": [ 99 "export PYENV_ENV=my_env" .bash_profile
is executed for login shells. Do you think it is a good idea to recommend a user to always initialize pyenv when they ssh to a login-shell.
I could create a script like$HOME/pyenv_init.sh
which has to be sourced when the user wants to use pyenv. This ensures that they can use our modules always after login by default.Indeed, this is the part I mentioned to you that it was not clear to me. I actually use that only for the process, but I deleted those lines later on (since I added them to the
kernel.sh
). I will test if they are needed at this step at all (at some point, I didn't put it - but I had ran them - and I couldn't activate the environment).changed this line in version 2 of the diff
- 001-Jupyter/Create_JupyterKernel_pyenv.ipynb 0 → 100644
251 { 252 "cell_type": "code", 253 "execution_count": null, 254 "metadata": {}, 255 "outputs": [], 256 "source": [ 257 "pyenv activate $PYENV_ENV" 258 ] 259 }, 260 { 261 "cell_type": "markdown", 262 "metadata": {}, 263 "source": [ 264 "When the environment is successfully activated, the name of the environment is shown between parenthesis in the command line, e.g. `(my_env)`. (To deactivate the environment, use `pyenv deactivate $PYENV_ENV`.)" 265 ] 266 }, $PYENV_ENV
is not set in kernel.sh. This means that the correct functionality ofkernel.sh
depends on something else (.bashrc
? .. oh, no :) ).
What if a user wants to have multiple pyenv-environments for different Python versions or some other fancy reason.
I would recommend to set PYENV_ENV in kernel.sh, too.Edited by Jens Henrik Goebbert
added 1 commit
- 8d2555eb - pyenv kernel tutorial: Removed any mention to changes in .bash_profile;...
mentioned in commit 8c6f35d5