davidbrochart / nbterm

Jupyter Notebooks in the terminal.
MIT License
745 stars 37 forks source link

nbterm 0.0.10 w/ ipykernel -> [NO KERNEL] #40

Closed ddkn closed 3 years ago

ddkn commented 3 years ago

Hello, I was trying to install and use nbterm. Just like in #14, I can edit a notebook but when trying to run a cell as @vmedea was I have NO KERNEL in the status bar. However, I do have ipykernel installed.

$ pip install nbterm ipykernel
$ pip freeze | egrep nbterm\|ipykernel
ipykernel==5.3.4
nbterm==0.0.10
$
$ nbterm Test.ipynb # Generated from jupyter-notebook with python3

image

Test.ipynb contents,

{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Test"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "\n",
    "x = np.linspace(0, 1)\n",
    "x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.10"
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}

Any ideas why this is the case?

davidbrochart commented 3 years ago

I tried locally with your notebook and installing in a fresh environment with pip install nbterm ipykernel, and it works fine. Can you check you have a kernelspec in PREFIX/share/jupyter/kernels/python3/kernel.json (where PREFIX is your environment prefix, e.g. $CONDA_PREFIX for a conda environment)?

ddkn commented 3 years ago

Interesting rabbit hole to go down. I was using macports, and even though I am using pip3.7 from macports it actually didn't generate a kernel.json file (searched from /). I had to install port install py37-ipykernel, and now I see /opt//local/Library/Frameworks/Python.framework/Versions/3.7/share/jupyter/kernels/python3/kernel.json. I find it strange that pip didn't work.

image

Thanks!