echo_kernel icon indicating copy to clipboard operation
echo_kernel copied to clipboard

echo kernel installation

Open ikappaki opened this issue 10 months ago • 0 comments

Hi,

With the removeal of install.py in #17, I can't seem to find how to properly install the echo kernel after building the wheel and pip installing it into another venv

It seems as if the path to the python executable in the kernel spec is now fixed in stone to the build venv?

To reproduce

  1. clone rep (HEAD at the time of this writing is https://github.com/jupyter/echo_kernel/commit/6e880d796fe5c86b65b651cfff050f506a65539e), and pip install hatch
  2. Run hatch build, to build the package
(kernel-exp) PS C:\src\echo_kernel> hatch build
──────────────────────────────────────────────────────── sdist ─────────────────────────────────────────────────────────
Installing Jupyter kernel spec
Custom logo files not found. Default logos will be used.
Custom logo files not found. Default logos will be used.
dist\echo_kernel-1.1.tar.gz
──────────────────────────────────────────────────────── wheel ─────────────────────────────────────────────────────────
Installing Jupyter kernel spec
Custom logo files not found. Default logos will be used.
Custom logo files not found. Default logos will be used.
dist\echo_kernel-1.1-py3-none-any.whl
  1. Check where the build/dev env is located at (in this example, is at UYDIF_70)
(kernel-exp) PS C:\src\echo_kernel> hatch env run where python
C:\Users\ikappaki\AppData\Local\hatch\env\virtual\echo-kernel\UYDIF_70\echo-kernel\Scripts\python.exe
  1. In a clean shell, create another venv and install the echo wheel
PS C:\Users\ikappaki> python -m venv C:\src\venvs\temp-1
PS C:\Users\ikappaki> C:\src\venvs\temp-1\Scripts\Activate.ps1
(temp-1) PS C:\Users\ikappaki> pip install C:\src\echo_kernel\dist\echo_kernel-1.1-py3-none-any.whl
Processing c:\src\echo_kernel\dist\echo_kernel-1.1-py3-none-any.whl
Collecting ipykernel (from echo-kernel==1.1)
...
Successfully installed asttokens-2.4.1 colorama-0.4.6 comm-0.2.2 debugpy-1.8.1 decorator-5.1.1 echo-kernel-1.1 executing-2.0.1 ipykernel-6.29.4 ipython-8.23.0 jedi-0.19.1 jupyter-client-8.6.1 jupyter-core-5.7.2 matplotlib-inline-0.1.6 nest-asyncio-1.6.0 packaging-24.0 parso-0.8.4 platformdirs-4.2.0 prompt-toolkit-3.0.43 psutil-5.9.8 pure-eval-0.2.2 pygments-2.17.2 python-dateutil-2.9.0.post0 pywin32-306 pyzmq-25.1.2 six-1.16.0 stack-data-0.6.3 tornado-6.4 traitlets-5.14.2 typing-extensions-4.11.0 wcwidth-0.2.13
  1. List juniper kernels, and print out the spec of the echo kernel installed at the env, it will invoke the build venv (UYDIF_70) instead of this venv (temp-1)
(temp-1) PS C:\Users\ikappaki> jupyter kernelspec list
Available kernels:
  echo          C:\src\venvs\temp-1\share\jupyter\kernels\echo
  python3       C:\src\venvs\temp-1\share\jupyter\kernels\python3
(temp-1) PS C:\Users\ikappaki> cat C:\src\venvs\temp-1\share\jupyter\kernels\echo\kernel.json
{"argv": ["C:\\Users\\ikappaki\\AppData\\Local\\hatch\\env\\virtual\\echo-kernel\\UYDIF_70\\echo-kernel-build\\Scripts\\python.EXE", "-m", "echo_kernel", "-f", "{connection_file}"], "display_name": "Echo", "language": "text"}

If I use the install command, it installs the ipython kernel instead (not echo):

(temp-1) PS C:\Users\ikappaki> python -m echo_kernel install --user
Installed kernelspec python3 in C:\Users\ikappaki\AppData\Roaming\jupyter\kernels\python3
(temp-1) PS C:\Users\ikappaki> cat C:\Users\ikappaki\AppData\Roaming\jupyter\kernels\python3\kernel.json
{
 "argv": [
  "C:\\src\\venvs\\temp-1\\Scripts\\python.exe",
  "-Xfrozen_modules=off",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "Python 3 (ipykernel)",
 "language": "python",
 "metadata": {
  "debugger": true
 }
}

or perhaps I'm missing something?

Thanks

ikappaki avatar Apr 14 '24 20:04 ikappaki