简体   繁体   English

在Ubuntu上为Jupyter提供Cling Kernel

[英]Cling Kernel for Jupyter on Ubuntu

I built Cling on my laptop with Ubuntu 15.04 following the instructions given on https://github.com/root-mirror/cling#jupyter because I wanted to use the Cling kernel for Jupyter. 我按照https://github.com/root-mirror/cling#jupyter上的说明使用Ubuntu 15.04在我的笔记本电脑上构建了Cling,因为我想使用Cling内核进行Jupyter。 I installed Jupyter, I checked that Cling is in my PATH, but when I type the command 我安装了Jupyter,我检查了Cling是否在我的PATH中,但是当我输入命令时

jupyter kernelspec install cling

I get the following 我得到以下内容

OSError: [Errno 2] No such file or directory: 'cling'

Someone knows what's happening? 有人知道发生了什么事吗?

According to the source code , jupyter kernelspec install command expects the path to the directory containing kernel spec file (kernel.json) as an argument. 根据源代码jupyter kernelspec install命令需要包含内核规范文件(kernel.json)的目录的路径作为参数。 So if you cloned the cling repository in, say, ~/cling/src, this should work: 所以,如果你克隆了cling存储库,比如〜/ cling / src,这应该可行:

jupyter kernelspec install ~/cling/src/tools/cling/tools/Jupyter/kernel/cling

That's probably because in your folder 3 versions of Cling kernel are defined (C++11, C++14 and C++17). 这可能是因为在你的文件夹中定义了3个版本的Cling内核(C ++ 11,C ++ 14和C ++ 17)。
So instead of trying to add Cling try to add one of those versions or all three if you want to. 因此,如果您愿意,可以尝试添加其中一个版本或全部三个,而不是尝试添加Cling。

在此输入图像描述

I had the same problem just one minute ago, but I was able to solve it. 一分钟前我遇到了同样的问题,但我能够解决它。 I executed: 我执行了:

$ jupyter kernelspec install --user cling-cpp11

directly from /home/ubuntu_user/cling_ubuntu/share/cling/Jupyter/kernel . 直接来自/home/ubuntu_user/cling_ubuntu/share/cling/Jupyter/kernel

The installation was successful, I moved to my working directory and called a jupyter notebook; 安装成功,我移动到我的工作目录并调用了一个jupyter笔记本; it opened ok, but the kernel immediately died. 它打开确定,但内核立即死亡。

I thought the problem was that I have to install cling from where I was going to call the jupyter notebook, and I did so: 我认为问题是我必须从我要调用jupyter笔记本的地方安装cling,我这样做了:

After uninstalling the kernel (also from /home/ubuntu_user/cling_ubuntu/share/cling/Jupyter/kernel ) with: 卸载内核(也来自/home/ubuntu_user/cling_ubuntu/share/cling/Jupyter/kernel )后:

jupyter kernelspec uninstall cling-cpp11

I repeated all the installation process: 我重复了所有的安装过程:

Let's assume that you are usually going to call jupiter from /home/ubuntu_user , and you have your cling repository here 我们假设你通常会从/home/ubuntu_user调用jupiter,你在这里有你的/home/ubuntu_user存储库

/home/ubuntu_user/cling_ubuntu.

Then: 然后:

  1. Go there: $ cd /home/ubuntu_user 去那里: $ cd /home/ubuntu_user
  2. $ source activate my_env (I work with Anaconda, so I activated my environment) $ source activate my_env (我使用Anaconda,所以我激活了我的环境)
  3. $ export PATH=/home/ubuntu_user/cling_ubuntu/bin:$PATH
  4. $ cd cling_ubuntu/share/cling/Jupyter/kernel/cling-cpp11
  5. $ pip install -e.
  6. Here you have to move to your future working directory. 在这里,您必须转到您未来的工作目录。

    $ cd /home/ubuntu_user , type: $ cd /home/ubuntu_user ,输入:

    $ jupyter kernelspec install --user cling_ubuntu/share/cling/Jupyter/kernel/cling-cpp11

    .. and the kernel is still alive and works ok. ..并且内核仍然存活并正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM