Ubuntu中安装Jupyter Notebook的Cling内核遇OSError错误求助
Hey there! Let's work through this frustrating error you're hitting while setting up Cling. That OSError: [Errno 2] from subprocess almost always means the script is trying to run a command that doesn't exist on your system, or it can't locate a required file/directory. Here are the most likely fixes to try:
1. Install all core system build dependencies
Even though you ran --check-requirements, sometimes that check might miss basic Ubuntu packages needed for compiling software. Let's install the essential tools and libraries Cling relies on:
sudo apt update && sudo apt install build-essential git cmake libncurses5-dev libtinfo-dev
These packages include compilers, version control, and supporting libraries. After installing, re-run your original command to see if the error clears up.
2. Fix PATH conflicts with Anaconda
Since you're using Anaconda2 (Python 2.7), there's a chance the Anaconda environment is overriding your system's PATH, making subprocess unable to find standard system commands. Try temporarily prepending the system bin directory to your PATH before running the script:
PATH=/usr/bin:$PATH ./cpt.py --check-requirements && ./cpt.py --create-dev-env Debug --with-workdir=./cling-build/
This tells the script to look for system commands first before checking Anaconda's paths.
3. Manually create the working directory
The --with-workdir=./cling-build/ flag tells the script to use that directory, but if it doesn't exist yet, subprocess might fail when trying to write to it. Let's create it upfront:
mkdir -p ./cling-build
The -p flag ensures the directory is created even if parent directories are missing. Then re-run your original installation command.
4. Switch to Python 3 (highly recommended)
Python 2.7 has been end-of-life for years, and many modern scripts (including Cling's cpt.py) have better support for Python 3. If you don't strictly need Python 2.7 for other projects, try using Python 3 instead:
# Install Python 3 and pip if you don't have them sudo apt install python3 python3-pip # Run the script with Python 3 python3 cpt.py --check-requirements && python3 cpt.py --create-dev-env Debug --with-workdir=./cling-build/
This avoids any outdated Python 2.7 compatibility issues that could be causing the subprocess error.
If none of these work, sharing the full output of the --check-requirements command might help spot missing dependencies we haven't covered!
内容的提问来源于stack exchange,提问作者Subeet

