Hi All,
I’m trying to follow the tutorial: nbdev tutorial | nbdev. I like to use conda to have isolated environments.
I created a new conda environment and installed nbdev
using:
conda create -n nbdev -c conda-forge jupyterlab
conda activate nbdev
pip install nbdev
I confirm everything is ok by running:
python (nbdev) 22:32:37
Python 3.10.2 | packaged by conda-forge | (main, Feb 1 2022, 19:30:18) [Clang 11.1.0 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import nbdev
>>> nbdev
<module 'nbdev' from '/Users/dleen/miniconda3/envs/nbdev/lib/python3.10/site-packages/nbdev/__init__.py'>
>>>
My repo was created from the template from the tutorial: https://github.com/dleen/nbdevtest.
When I run nbdev_build_docs
I get the following error:
ModuleNotFoundError Traceback (most recent call last)
/var/folders/lz/jtq8b7qn037d7n39zwlnxk000000gn/T/ipykernel_17420/1418304125.py in <module>
----> 1 from nbdev.showdoc import show_doc
ModuleNotFoundError: No module named 'nbdev'
ModuleNotFoundError: No module named 'nbdev'
An error occurred while executing the following cell:
------------------
from nbdev.showdoc import show_doc
------------------
What I’ve tried:
- Installing nbdev in a non conda environment: same issue
- Running the notebook from Jupyter: the import works fine
- Changing the kernel when running the notebook to the conda kernel: also fine
- I checked out the code and saw it uses nbconvert under the hood. So I tried:
jupyter nbconvert --to=html --execute 00_core.ipynb
and that was fine.
The error seems to indicate that whatever temporary environment the code is using does not use the same python path as the rest of my environment.
I’ve run out of ideas… am I missing something obvious?
Thanks,
David.