3

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.

Arnab Biswas
  • 4,495
  • 3
  • 42
  • 60

2 Answers2

2

Alternatively, check your path from within your Jupyter notebook vs on the command line. I found that appending the module paths to sys.path solved this exact issue.

All of the ~/anaconda3/envs/[env]/lib/python3.7* paths were missing in my case.

  • 1
    But this may actually be the root issue: https://stackoverflow.com/questions/37085665/in-which-conda-environment-is-jupyter-executing/39070588 – Rogan Grant Aug 29 '19 at 19:32
1

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.

Arnab Biswas
  • 4,495
  • 3
  • 42
  • 60