Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

1 votes
1 answers
760 views
Unable to detect Python kernels in VS Code Jupyter notebooks after migrating from Windows 11 to Arch Linux
### Environment Details - **Previous OS**: Windows 11 - **Current OS**: Arch Linux - **Desktop Environment**: KDE Plasma - **IDE**: Visual Studio Code (**OSS CODE**) - **Required Feature**: Jupyter Notebook support ## Issue Description After migrating from Windows 11 to Arch Linux, I'm unable to get...
### Environment Details - **Previous OS**: Windows 11 - **Current OS**: Arch Linux - **Desktop Environment**: KDE Plasma - **IDE**: Visual Studio Code (**OSS CODE**) - **Required Feature**: Jupyter Notebook support ## Issue Description After migrating from Windows 11 to Arch Linux, I'm unable to get Jupyter notebooks working in VS Code. Specifically, VS Code cannot detect any Python kernels for the notebooks, preventing me from running any code. ## What I've Tried ### Attempt 1: Direct Installation First, I attempted to install Jupyter directly using pip:
pip install jupyter --break-system-packages
This resulted in an error about externally managed environment, which is expected behavior in Arch Linux. ### Attempt 2: Virtual Environment Setup Then I tried setting up a virtual environment:
python -m venv .venv
source .venv/bin/activate
pip install jupyter
This is the result I got:
[harshal@quanta ~]$ python -m venv .venv
[harshal@quanta ~]$ source .venv/bin/ativate
bash: .venv/bin/ativate: No such file or directory
[harshal@quanta ~]$ ls
Desktop  Documents  Downloads  Music  Pictures  Public  sof-bin  Templates  Videos  yay
[harshal@quanta ~]$ source .venv/bin/activate
(.venv) [harshal@quanta ~]$ code .
(.venv) [harshal@quanta ~]$
**Code** : enter image description here ### Attempt 3: System Package Installation I also attempted to install through pacman:
sudo pacman -S python-jupyter
This failed with "target not found: python-jupyter" error. ### Output of ls -al .venv
drwxr-xr-x  7 harshal harshal 4096 Dec 20 18:57 .
drwx------ 22 harshal harshal 4096 Dec 21 08:03 ..
drwxr-xr-x  2 harshal harshal 4096 Dec 20 18:57 bin
drwxr-xr-x  3 harshal harshal 4096 Dec 20 18:57 etc
drwxr-xr-x  3 harshal harshal 4096 Dec 20 17:33 include
drwxr-xr-x  3 harshal harshal 4096 Dec 20 17:33 lib
lrwxrwxrwx  1 harshal harshal    3 Dec 20 17:33 lib64 -> lib
-rw-r--r--  1 harshal harshal  157 Dec 20 18:54 pyvenv.cfg
drwxr-xr-x  6 harshal harshal 4096 Dec 20 18:57 share
[harshal@quanta ~]$
## Current State Even after these attempts, VS Code still cannot detect any Python kernels for Jupyter notebooks, as shown in the screenshot below: VS Code showing no kernels available ## System Configuration - VS Code has the Python extension installed - Python is installed and accessible from terminal - Virtual environment is created but not being detected by VS Code ## Expected Behavior VS Code should be able to: 1. Detect the Python interpreter in the virtual environment 2. List it as an available kernel for Jupyter notebooks 3. Allow running notebook cells using the selected kernel ## Actual Behavior - No kernels are being detected - Cannot run any notebook cells - Kernel picker shows no available kernels ## Question How can I properly configure VS Code to detect and use Python kernels for Jupyter notebooks on a fresh Arch Linux installation, considering the system package management restrictions?
Harshal Malani (11 rep)
Dec 20, 2024, 12:51 PM • Last activity: Jul 30, 2025, 01:45 PM
0 votes
1 answers
39 views
Uninstall Jupyter
I am running Debian Bookworm OS and installed Juypter using the following command sudo pip3 install --break-system-packages jupyter and would like to uninstall the program, I have tried the following options but none of them seem to work: 1) sudo apt get remove 2) pip uninstall juypter 3) sudo -H py...

I am running Debian Bookworm OS and installed Juypter using the following command
sudo pip3 install --break-system-packages jupyter
and would like to uninstall the program, I have tried the following options but none of them seem to work:
1) sudo apt get remove
2) pip uninstall juypter
3) sudo -H python3 -m pip uninstall jupyter_core jupyter_qtconsole nbformat
4) pip uninstall $(pip freeze | grep jupyter )
Could someone help me uninstall the program?
Thanks Daniel
Daniel (9 rep)
Jul 11, 2025, 07:59 AM • Last activity: Jul 11, 2025, 09:38 AM
0 votes
0 answers
25 views
Jupyter QtConsole GUI window ignores configured width and height
Below, two `qtconsole` instances, the first uses a font size of 14 pts, the second a font size of 12 pt — both use a width of 81 characters, [![two instances of qtconsole][1]][1] As you can see, the actual widths in characters is quite different, and however it is not 81, while the width in pixels i...
Below, two qtconsole instances, the first uses a font size of 14 pts, the second a font size of 12 pt — both use a width of 81 characters, ![two instances of qtconsole ][1] As you can see, the actual widths in characters is quite different, and however it is not 81, while the width in pixels is approximately the same (the 12pt one is slightly narrower). Also (no picture for this…) the pixel height of the windows is exactly the same, so at least one of the instances has a height that differs from the 25 lines I have requested in the config file. Is this behaviour what is intended, is it a bug or have I misundertood everything? Is it possible to force a specific width/height in characters/lines for this QT application? --- Here is my ~/.jupyter/jupyter_qtconsole_config.py c = get_config() c.JupyterWidget.font_size = 12; # it was 14 when I started the 1st instance c.JupyterWidget.console_width = 81; c.JupyterWidget.console_height = 25; c.JupyterWidget.font_family = "Cascadia Code"; c.JupyterWidget.syntax_style = "fruity";
gboffi (1376 rep)
Apr 29, 2025, 11:16 AM • Last activity: Apr 29, 2025, 07:02 PM
0 votes
0 answers
15 views
Jupyter server cant access file 404
I have a notebook that creates videos and then it supposed to show it in the cell output. But there is just gray box [![enter image description here][1]][1] in the server console I can see 404s to a path that is good - I checked the permissions and the file demo.mp4 exists and i can open it in a pla...
I have a notebook that creates videos and then it supposed to show it in the cell output. But there is just gray box enter image description here in the server console I can see 404s to a path that is good - I checked the permissions and the file demo.mp4 exists and i can open it in a player app. I run jupyter server in a venv environment as myself, not root. How do I solve it? enter image description here
Boppity Bop (169 rep)
Dec 26, 2024, 06:38 PM
1 votes
1 answers
295 views
Look for multiple line string from bash
I am currently working with Jupyter notebooks. With an IDE I used to be able to look for parts of my code that could be elsewhere, and thus refactor as needed. Suppose I have the following code: class.function('--parameter','-p', type = lambda x: operation(x,"%Y-%m-%d").date(), default=unicode(previ...
I am currently working with Jupyter notebooks. With an IDE I used to be able to look for parts of my code that could be elsewhere, and thus refactor as needed. Suppose I have the following code: class.function('--parameter','-p', type = lambda x: operation(x,"%Y-%m-%d").date(), default=unicode(previousTime-actualTime), help='Send help' ) The code is edited and is not meant to work or anything, I just want to exemplify the possibilty of there being multiple lines, multiple "strange" characters, quotes, and so on. I now want to look where in my codebase that exact string exists. I have been looking around and reading the manual and I have something like grep -rxno . -e "string starts more text here %% 'parameters inside quotes' string ends" But I feel like since it is a regular expression is matching me with substrings that are similar, not necessarily the same. Also, and more confusing, it's giving results line per line: ./DMP3K/DMP_3K.py:30:class.function( ./DMP3K/DMP_3K.py:31: ./DICC/diccionario.py:34: operation(x,"%Y-%m-%d").date() I feel like there should be an easier way to do this operation that I am missing.
monkey intern (119 rep)
Jan 2, 2019, 11:52 AM • Last activity: Oct 22, 2024, 08:22 AM
0 votes
2 answers
811 views
vscode with jupyter with archlinux
I am trying to install and use vscode with jupyter extension for coding with python on my archlinux OS. but it does not found any kernel interpreter I installed both jupyter and python extension in vscode and tried many staff suggested on the internet, as ""enable-proposed-api": ["ms-toolsai.jupyter...

I am trying to install and use vscode with jupyter extension for coding with python on my archlinux OS. but it does not found any kernel interpreter
I installed both jupyter and python extension in vscode and tried many staff suggested on the internet, as
""enable-proposed-api": ["ms-toolsai.jupyter"]" in the argv.json
and "create environment"
the result is always the same, jupyter file is corrected opened but when i tried to select kernel, vscode keep searching.
can someone sugggest me something?
Thanks in advances, cheers!
eugenio b (41 rep)
Jul 1, 2023, 10:19 PM • Last activity: Sep 30, 2024, 08:18 AM
0 votes
0 answers
84 views
Local port forwarding using SSH only works from some machines
I am setting up an SSH server on Ubuntu 18.04.6 LTS. I am trying to use the server for remotely accessing Jupyter Notebook. For that purpose, I have downloaded an opens-server package. I set up Uncomplicated Firewall (UFW) to allow for SSH connection on desired port. From any machine, a **simple con...
I am setting up an SSH server on Ubuntu 18.04.6 LTS. I am trying to use the server for remotely accessing Jupyter Notebook. For that purpose, I have downloaded an opens-server package. I set up Uncomplicated Firewall (UFW) to allow for SSH connection on desired port. From any machine, a **simple connection request works perfectly fine**:
ssh -v -p [PORT] [USER]@[IP_ADDRESS]
However, when **running an SSH command with a request to forward** jupyter's interface to the local machine **works on one Mac computer but not others I have tried**:
ssh -v -Nfg -L 8888:localhost:9999 -p [PORT] [USER]@[IP-ADDRESS]
Which produces the following error, even though I enter the same password as previously:
debug1: Authentications that can continue: password
Permission denied, please try again.
I have tried playing around with ***sshd_config*** but to no avail. What could be the reason for the fact that ssh with port forwarding request works from certain machines but not others?
altair08 (1 rep)
Jan 29, 2024, 05:48 PM
5 votes
0 answers
1500 views
How can I show the resource usage of a Jupyter notebook in VSCode
Understand that there is a `jupyter-resource-usage` Jupyter extension which allows us to monitor the resource usage (e.g. CPU, memory) of a running Notebook (server and its children (kernels, terminals, etc)). Is there a similar feature available in VSCode? (Alternatively, can we install such extens...
Understand that there is a jupyter-resource-usage Jupyter extension which allows us to monitor the resource usage (e.g. CPU, memory) of a running Notebook (server and its children (kernels, terminals, etc)). Is there a similar feature available in VSCode? (Alternatively, can we install such extensions in VSCode Jupyter?)
Shern (151 rep)
Sep 5, 2023, 06:51 AM
0 votes
1 answers
1100 views
python uses the entire RAM when running code
I guess the issue is not with the python specifically but with overall RAM management in Linux. So here's the code: !pip install numpy opencv-python pandas matplotlib tensorflow scikit-learn import numpy as np import cv2 as cv import pandas as pd import matplotlib.pyplot as plt import os import gc g...
I guess the issue is not with the python specifically but with overall RAM management in Linux. So here's the code: !pip install numpy opencv-python pandas matplotlib tensorflow scikit-learn import numpy as np import cv2 as cv import pandas as pd import matplotlib.pyplot as plt import os import gc gc.enable() train_dir = 'fruits-360/Training' classes = os.listdir(train_dir) classes = classes[:30] all_arrays=[] img_size=100 for i in classes: path=os.path.join(train_dir, i) class_num=classes.index(i) for img in os.listdir(path): img_array=cv.imread(os.path.join(path, img)) mig_array=cv.cvtColor(img_array, cv.COLOR_BGR2RGB) all_arrays.append([img_array, class_num]) test_dir = 'fruits-360/Test' classes2 = os.listdir(test_dir) classes2 = classes2[:30] all_arrays2=[] img_size=100 for i in classes2: path=os.path.join(test_dir, i) class_num2=classes.index(i) for img in os.listdir(path): img_array=cv.imread(os.path.join(path, img)) mig_array=cv.cvtColor(img_array, cv.COLOR_BGR2RGB) all_arrays.append([img_array, class_num2]) import random random.shuffle(all_arrays) X_train=[] Y_train=[] for features, label in all_arrays: X_train.append(features) Y_train.append(label) X_train=np.array(X_train) random.shuffle(all_arrays2) X_test=[] Y_test=[] for features, label in all_arrays: X_test.append(features) Y_test.append(label) X_test=np.array(X_test) X_train=X_train.reshape(-1, img_size, img_size, 3) X_train=X_train/255 X_test=X_test.reshape(-1, img_size, img_size, 3) X_test=X_test/255 from keras.utils import to_categorical Y_train=to_categorical(Y_train, num_classes=30) Y_test=to_categorical(Y_test, num_classes=30) from sklearn.metrics import confusion_matrix, ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from keras.models import Sequential from keras.layers import Dense, Conv2D, Flatten, MaxPool2D, Dropout from keras.callbacks import ReduceLROnPlateau from keras.optimizers import Adam x_train, x_val, y_train, y_val = train_test_split(X_train, Y_train, test_size=0.3, random_state=42) model=Sequential() model.add(Conv2D(filters=16, kernel_size=(5,5), padding='Same', activation='relu', input_shape=(100, 100, 3))) model.add(MaxPool2D(pool_size=(2,2))) model.add(Conv2D(filters=32, kernel_size=(5,5), padding='Same', activation='relu')) model.add(MaxPool2D(pool_size=(2,2))) model.add(Conv2D(filters=64, kernel_size=(5,5), padding='Same', activation='relu')) model.add(MaxPool2D(pool_size=(2,2))) model.add(Flatten()) model.add(Dense(128, activation='relu')) model.add(Dropout(0.6)) model.add(Dense(30, activation='softmax')) model.compile(optimizer=Adam(learning_rate=0.001), loss='categorical_crossentropy', metrics=['accuracy']) epochs=10 batch_size = 32 history=model.fit(x_train, y_train, batch_size=batch_size, epochs=epochs) y_pred = model.predict(x_train) y_pred_classes = np.argmax(y_pred, axis=1) y_true = np.argmax(y_train, axis=1) conf_mat = confusion_matrix(y_true, y_pred_classes) disp = ConfusionMatrixDisplay(conf_mat, display_labels=classes) fig, ax = plt.subplots(figsize=(15,15)) disp.plot(ax=ax) plt.xticks(rotation=90) plt.show() model.summary() The issue is not with the code itself, provided it just in case. When i run this code on jupyter notebook on windows, overall RAM usage is at about 9/16GB and the code runs fine, however if i run the code on Linux, it consumes all available RAM and swap partition, then jupyter crashes. If i run jupyter notebook with command: systemd-run --scope -p MemoryMax=8192M jupyter-notebook Jupyter still crashes after reaching 8 gigs and using the entire swap. Is there a way to fix it somehow?
dummygum (1 rep)
Apr 19, 2023, 09:05 PM • Last activity: Apr 20, 2023, 02:49 PM
0 votes
0 answers
123 views
Starting a process for all users as root (case of jupyter notebook server)
This might be a peculiar case where we need to start the `jupyter notebook` for all system users on a common machine. All users have their own conda envs (installed in their home) which has same name `base`. However, for simplicity, we would like to start jupyter notebook after restart using a scrip...
This might be a peculiar case where we need to start the jupyter notebook for all system users on a common machine. All users have their own conda envs (installed in their home) which has same name base. However, for simplicity, we would like to start jupyter notebook after restart using a script for all users. **Present case, works for 2-3 users.** Ask user to execute from their bash session
tmux 
conda activate base
jupyter notebook --ip a.b.c.d -- port pqrs
followed by Ctrl+b, d to close the tmux session. ------ **New case (larger number of users)** Script run by root which starts the jupyter server for each user on a specific port. For this we have prepared a bash script which starts the notebook on an empty port for the current user.
#!/bin/bash
source ~/.bashrc
eval "$(conda shell.bash hook)"

conda activate base

current_env=$CONDA_DEFAULT_ENV
echo -e "\t ----------\n\t Current conda environment : " $current_env

################################################
#  get an empty port number between a range

used=$(ss -tulpn | grep -e9{700..800} | awk '{print $5}' | grep -o -E '[^:]+$' | xargs)

#echo -e "\t\t Currently used ports : $used"

# function to generate random number within a range
rnd() {
  out=$(shuf -i 9700-9800 -n 1)
  echo $out
}

val=$(rnd)

# this loop breaks when val is not found in string
while  grep -q "$val" <<<"$string"; do
   #echo "port being used"
   val=$(rnd)
done

#echo "$val"
port=$val

################################################

jupyter notebook --ip a.b.c.d  --port "$port" # start on specific port

################################################
status=$(ss -tulpn  | grep "jupyter" | grep "$port")
echo -e "\t\t $status \n\n"
Permission : users can read files from other user. Execution not allowed (even for root) in other users home. **Question :** how to automate this as a root user so that all servers (for users) are started upon system restart. - One way might be use nohup with the command instead of using tmux, and iterate over all users in a loop. Any ideas. Not using other approach like jupyterhub since it requires Ubuntu and configuring PAM authentication is non-trivial. Thanks.
ankit7540 (331 rep)
Nov 16, 2022, 03:13 PM • Last activity: Nov 16, 2022, 03:51 PM
Showing page 1 of 10 total questions