Nbdev v2 launched

I have deleted mambaforge folder and reinstalled everything, but the error persisted.

I just released something which should fix this - please try updating nbdev.

1 Like

I tried it but still not working for me.

First, I updated nbdev

Second, I ran nbdev_prepare, no problem, but nbdev_preview get me the following error message:

In order to see whether nbdev_preview can work in the end, I comment out all the places where I import and use my lib debuggable, but still can’t get nbdev_preview to work properly.

As the error says, it can’t find debuggable.utils. You need to install it. (eg “pip install - e .”)

1 Like

Yes, pip install -e . solved the import problem, but I still got this error. when running `nbdev_preview’

Maybe I accidentally deleted some file? I guess I could do nbdev_new to recreate the project

If you have ever wanted to use nbdev on gitlab.com then here are my notes on setting up nbdev v2 on gitlab: https://robtheoceanographer.com/gitlab-nbdev.html

Thanks again to Jeremy and Hamel for your quality work - nbdev is so well built that is easy to understand what it is doing and to hack on it for a gitlab port. I am always impressed with the work Jeremy does and with the brilliant people in the community that surounds him.


I create a new nbdev project from an empty repo and put utils.ipynb into the repo, and it works. But when I put use_kwargs.ipynb back in, the same error appeared.

Then, I noticed one thing which is the key to cause the error. I have #|default_exp utils without actually #|export anything. After I removed #|default_exp utils, no more error.

I have not tried it yet, but it seems quarto has figured it out

I enjoy using nbdev. With the new update, version 2 do we have any way to install Quarto without using sudo?

I’d suggest checking quarto.org. I haven’t tried that myself.

Thank you for your reply. If I want to install version 1 of nbdev. What can I do for installation? Thank you

pip install 'nbdev<2'

Thank you for your reply. When I pip install jupyter lab and nbdev version 1.2.11. I cannot open the jupyter and it give the error: “AttributeError: module ‘nbdev.clean’ has no attribute ‘clean_jupyter’” and “ImportError: No module named clean_jupyter”. Could you please help? Thank you

that sounds like the git hooks are still from v2. I would try to use the nbdev_install_hooks command from nbdev 1.x, maybe it can fix this? But I’m just guessing…

That’s right! There will be a couple of .py files in your home/.jupyter folder you’ll need to remove (or edit).

Thank you. I’ve created the new environment and installed python, notebook, and Jupiter lab. When I open jupyter lab, it will give the error: No module name call nbdev. Can you help me with what is happening and how I can remove the home/. jupyter folder. Is that in my base environment? How to delete the pre hook saved before? Thank you for helping.

Contributing sections of fastai and fastcore may need update

The current contributing section is written more or less as follows

After you clone this repository, please run nbdev_install_git_hooks in your terminal. This sets up git hooks, which clean up the notebooks to remove the extraneous stuff stored in the notebooks (e.g. which cells you ran) which causes unnecessary merge conflicts.

Before submitting a PR, check that the local library and notebooks match. The script nbdev_diff_nbs can let you know if there is a difference between the local library and the notebooks.

  • If you made a change to the notebooks in one of the exported cells, you can export it to the library with nbdev_build_lib or make fastai.
  • If you made a change to the library, you can export it back to the notebooks with nbdev_update_lib.

The actual workflow I used for contributing to fastcore is as follows:

After you clone this repository, make sure you have run nbdev_install_hooks in your terminal. This install Jupyter and git hooks to automatically clean, trust, and fix merge conflicts in notebooks.

After making changes in the repo, you should run nbdev_prepare and make additional and necessary changes in order to pass all the tests.

Before pushing to github, it’s better not to rerun the notebooks to avoid any unexpected changes to the repo.

What do you think of this workflow of making contribution to nbdev-based repo?

I think a PR with those changes would be great @Daniel – but just remove the line “Before pushing to github, it’s better not to rerun the notebooks to avoid any unexpected changes to the repo.” Sometimes it might be a good idea to run the notebooks, to make sure everything works OK.

1 Like

Thanks Jeremy, I have made PR for both fastcore and fastai.

1 Like

nbdev_export report no error but only export 2 out of 4 notebooks which have both #|default_exp.

Previously, all notebooks being asked to export have been exported perfectly. But now, both notebooks have exactly the same #|default_exp core and #|export in the same folder, only one get exported, the other two not. Also when I run nbdev_export there is no error reported.

You can read the notebooks exported fine here 1 and 2; and those failed to export 1 and 2

I couldn’t figure out how those notebooks differed to cause some to succeed and some to fail. What should I do next? Thanks @jeremy