Nbdev_diff_nbs fails only on github

When my library runs on github it fails at the nbdev_diff_nbs with this error,

Run if [ -n “$(nbdev_diff_nbs)” ]; then echo -e “!!! Detected difference between the notebooks and the library”; false; fi
if [ -n “$(nbdev_diff_nbs)” ]; then echo -e “!!! Detected difference between the notebooks and the library”; false; fi
shell: /bin/bash -e {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.6.12/x64
!!! Detected difference between the notebooks and the library
Error: Process completed with exit code 1.

yet when I run nbdev_diff_nbs on the command line in my own system I get no such error.

How can I resolve this?

If you want help you have to provide steps on how to reproduce your error

Also iirc you should try a pull and a rebuild. I had this a couple of times but I don’t remember why tbh.

I do ‘git push’ and the error appears on the github CI build in the step that says “Check if there are no diff library/notebooks”.

Ok, I tried that and it now fails at the previous step, nbdev_clean_nbs, with this,

Run echo “Check we are starting with clean git checkout”
echo “Check we are starting with clean git checkout”
if [ -n “$(git status -uno -s)” ]; then echo “git status is not clean”; false; fi
echo “Trying to strip out notebooks”
nbdev_clean_nbs
echo “Check that strip out was unnecessary”
git status -s # display the status to see which nbs need cleaning up
if [ -n “$(git status -uno -s)” ]; then echo -e “!!! Detected unstripped out notebooks\n!!!Remember to run nbdev_install_git_hooks”; false; fi
shell: /bin/bash -e {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.6.12/x64
Check we are starting with clean git checkout
git status is not clean

I ran nbdev_install_git_hooks on my system and repushed with no change.

nbdev_clean_nbs doesn’t fail in on my system.

That doesn’t allow anyone to reproduce your error. You should share the repo or a paired down example that you can share publicly

I don’t know how to reproduce it apart from that.

But this is the repo.

Any help appreciated.

What’s the notebook that fails? What’s the link to the error message in actions?

these will help you get help not only on this forum but anything else you post on like StackOverflow

Did you commit all your local changes to notebooks AND scripts to GitHub? Your error suggests that your local env is out of sync with what’s on GitHub

This is what I run from my local environment.

nbdev_clean_nbs
nbdev_build_lib
nbdev_test_nbs
nbdev_build_docs
git add -A
git commit -m update
git push

That commits everything doesn’t it?

The error message doesn’t indicate a particular notebook. Are you able to see the build/CI errors on my repo?

I can tell you it fails here but I don’t know what “clean git status” is meant to mean. Google that git status command and the options it’s using.

If I clone your repository I get the following error when running nbdev_diff_nbs. So yes you haven’t cleaned and synced your notebooks.

(base) √ pct % nbdev_diff_nbs                                                                                                (master)pct
diff -ru /var/folders/88/9mddczp92wg04x0ykmw940q00000gn/T/tmp5ubvk1bp/_nbdev.py /var/folders/88/9mddczp92wg04x0ykmw940q00000gn/T/tmpm6r_zq9y/_nbdev.py
--- /var/folders/88/9mddczp92wg04x0ykmw940q00000gn/T/tmp5ubvk1bp/_nbdev.py	2020-10-19 23:21:37.000000000 -0700
+++ /var/folders/88/9mddczp92wg04x0ykmw940q00000gn/T/tmpm6r_zq9y/_nbdev.py	2020-10-19 23:21:49.000000000 -0700
@@ -2,32 +2,9 @@

 __all__ = ["index", "modules", "custom_doc_links", "git_url"]

-index = {"UniqueNamer": "01_putils.ipynb",
-         "FunctionsList": "01_putils.ipynb",
-         "sigmoid": "01_putils.ipynb",
-         "is_in_notebooks": "01_putils.ipynb",
-         "BaseFunction": "02_functions.ipynb",
-         "Subtract": "02_functions.ipynb",
-         "Proportional": "02_functions.ipynb",
-         "Variable": "02_functions.ipynb",
-         "PassOn": "02_functions.ipynb",
-         "GreaterThan": "02_functions.ipynb",
-         "Constant": "02_functions.ipynb",
-         "Step": "02_functions.ipynb",
-         "Integration": "02_functions.ipynb",
-         "IntegrationDual": "02_functions.ipynb",
-         "Sigmoid": "02_functions.ipynb",
-         "WeightedSum": "02_functions.ipynb",
-         "IndexedParameter": "02_functions.ipynb",
-         "OpenAIGym": "02_functions.ipynb",
-         "PCTNode": "03_nodes.ipynb",
-         "PCTNodeData": "03_nodes.ipynb",
-         "PCTHierarchy": "04_hierarchy.ipynb"}
-
-modules = ["putils.py",
-           "functions.py",
-           "nodes.py",
-           "hierarchy.py"]
+index = {}
+
+modules = []

 doc_url = "https://perceptualrobots.github.io/pct/"

It’s actually failing on the previous stage now, nbdev_clean_nbs.

But that is not what I am getting. I just get blank lines when I run both.

(pctdev) C:\Users\ruper\Versioning\python\nbdev\pct>nbdev_diff_nbs

(pctdev) C:\Users\ruper\Versioning\python\nbdev\pct>nbdev_clean_nbs

(pctdev) C:\Users\ruper\Versioning\python\nbdev\pct>

I am running these in an Anaconda prompt in an Anaconda environment in which nbdev is installed.

I noticed there was a “build” folder which was deleted. It wasn’t recreated when I ran nbdev_build_lib.

Also noticed there was a file “Makefile (1)” which I deleted, and “dist” folders.

I am using python 3.8.

Does any of that matter?

Try cloning your own repo fresh and see what happens

I did that yesterday and it is still failing at the clean stage.

I have created this new repo. That is failing at the diff stage.

Does it matter in which order I run these commands on my local system?

nbdev_build_lib
nbdev_read_nbs
nbdev_clean_nbs
nbdev_diff_nbs
nbdev_test_nbs
nbdev_build_docs