Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"module not found" in jupyter lab, but works fine in "jupyter notebook"

I use conda python environment. I start the Jupyter lab following the steps below:

$conda activate <env_name>
$jupyter lab --no-browser --port=8080 &

Now, from a jupyter lab notebook, when I try to import feather (import feather), it fails with Module Not Found message.

From the jupyter lab notebook, if I execute the following, it shows me that feather is present:

! conda list | grep feather

Now, if I shutdown Jupyter Lab in the same VM and start Jupyter Notebook instead, feather gets imported successfully from the notebook.

$conda activate <env_name>
$jupyter-notebook --no-browser --port=8080 &

I see this discussion, but don't see a solution there.

like image 263
Arnab Biswas Avatar asked Dec 01 '25 02:12

Arnab Biswas


1 Answers

I have found a possible work around to avoid this issue. This is based on this answer.

From the conda environment (e.g. my_env), I can create a new Python 3 kernel (say, python3_custom). Now, this kernel will be associated with all the libraries installed in that conda environment.

$ conda activate my_env
(my_env)$ conda install ipykernel
(my_env)$ ipython kernel install --user --name=python3_custom
(my_env)$ conda deactivate

I come out of my_env or base environment. Then I start JupyterLab from the command prompt:

jupyter lab --no-browser --port=8080 &

Once I open my notebook now, I can select the kernel as python3_custom. Since in the associated conda environment (my_env), feather is already installed, I don't get the error "Module Not Found" any more.

like image 163
Arnab Biswas Avatar answered Dec 03 '25 13:12

Arnab Biswas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!