I guess that means the diff command doesn’t work on windows, which means in turn that nbdev_diff_nbs won’t work on Windows. How come your CI is executed on Windows?
The full CI executed on GitHub. The error log (copied below) that I posted first is not from widows, it is from GitHub actions. Is there any way to make it more verbose? :
Run 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.9/x64 !!! Detected difference between the notebooks and the library ##[error] Process completed with exit code 1.
I have the same issue/question finding GitHub error on nbdev_diff_nbs unhelpful and then trying to determine the difference on my windows laptop.
Thanks for any suggestions…
For now, I ended up installing Cygwin and putting it in my path. So, diff works as well as make, touch and other Linux commands on my windows laptop.
I’m able to test locally using nbdev_diff_nbs .
I’m not convinced this is the best solution, I’d rather use the new WSL tooling but it seems to work and I haven’t yet experienced negative consequences.
Others that have tried this workaround, any warnings or advice?
Thanks…Steve
While nbdev_diff_nbs is working locally now (and reporting no differences). GitHub actions are still failing on the diff step but reporting no differences.
So, back to bezova’s question - is there a way to determine why GitHub is detecting a difference (and then exiting without sharing the diff)?
Thanks…
Not sure what the problem is since GitHub should be reporting the diff on the CI (it’s likely the diff comes from special chars or difference in line endings but I’d need to spend some time on this on windows to be sure). I’d suggest to comment that part of the yaml file in .github/workflows/main.yml of your repo as a temporary fix. When I have time, I’ll rework the diff command to make it work on any OS, which should hopefully fix this.
First of all, thanks for what looks like an amazing tool. Can’t wait to dive deeper (-;
Unfortunately, while trying to follow along with the tutorial, I’ve encountered an issue when trying to use nbdev_test_nbs, about preprocess()
missing an argument [trace below].
(nbdev_test) ubuntu@ip-172-31-26-179:~/dev/nbdev-playground$ nbdev_test_nbs
testing: /home/ubuntu/dev/nbdev-playground/00_core.ipynb
testing: /home/ubuntu/dev/nbdev-playground/index.ipynb
Error in /home/ubuntu/dev/nbdev-playground/index.ipynb:
preprocess() missing 1 required positional argument: 'resources'
Error in /home/ubuntu/dev/nbdev-playground/00_core.ipynb:
preprocess() missing 1 required positional argument: 'resources'
Traceback (most recent call last):
File "/home/ubuntu/anaconda3/envs/nbdev_test/bin/nbdev_test_nbs", line 8, in <module>
sys.exit(nbdev_test_nbs())
File "/home/ubuntu/anaconda3/envs/nbdev_test/lib/python3.6/site-packages/fastscript/fastscript.py", line 42, in _f
func(**args.__dict__)
File "/home/ubuntu/anaconda3/envs/nbdev_test/lib/python3.6/site-packages/nbdev/cli.py", line 71, in nbdev_test_nbs
raise Exception(msg + '\n'.join([f.name for p,f in zip(passed,files) if not p]))
Exception: The following notebooks failed:
00_core.ipynb
index.ipynb
I looked inside cli.py
and the test.py
it calls, and the best I could find is that preprocess()
, called from test_nb
has this:
ep = NoExportPreprocessor(flags, timeout=600, kernel_name='python3')
pnb = nbformat.from_dict(nb)
ep.preprocess(pnb)
I created my own Conda env (called nbdev_test) to play with nbdev, could this be the reason?
Any help would be appreciated,
Thanks
Thanks for this great tool! I love notebooks but really was frustrated with its inability to be used for good dev, that’s great someone attempts at bridging this gap!
Is there any plan to integrate the @patch
decorator to it? I saw it was (briefly) part of fastai v2 but had to dig up the git history to find its source.
To me that’s one of the biggest shortcomings of notebooks: the inability to cleanly update class members and the obligation to type a whole class in a cell. @patch removes that obligation and is a great tool!
I actually hesitated to open a github issue instead, but it seems like not a lot are opened. Please tell me if this is the favorite way instead of feeding this huge and growing forum post!
@Ory it looks like you don’t have the last version of nbformat, you should try to update.
@Yves You can use the package fastcore for the patch decorator along with all the basic stuff we used in fastai v2. It doesn’t have any dependency from what I remember.
In general we keep issues for known bugs and deal with feature requests on the forum
Thanks.
I feel @patch should really be part of nbdev instead of fastai actually. It is such a useful generic feature to add to notebooks!
Thanks for the reply, much appreciated.
I tried updating nbformat, the package is reported by conda list
as version 4.4.0, both before and after update, and the error persists.
Is there a newer version than 4.4.0? Both conda/pypi and nbformat github page seem to indicate it is the latest.
Update: it was an outdated version of nbconvert
, not nbformat
, turns out.
This upgrade solved it:
nbconvert 5.4.1-py36_3 --> 5.6.1-py36_0
Thanks again for the help, and for what looks like an amazing tool (-;
Ah yes, I wanted to say nbconvert, sorry. Glad you solved your issue
to add confusion:
I cloned and rerun my library on MacOS. Recreated lib folder with nbdev_build_lib
.
The nbdev_diff_nbs
showed no output.
if I save res
from diff_nb_script
- it has returncode=0
so everything indeed seems similar,
BUT after pushing to GitHub its CI exited with same error from nbdev_diff_nbs
.
For those trying to use standalone Jekyll installation (I have to because GitHub pages are public even on private repositories), following the installation instructions as listed on the Jekyll page did not work.
The apt-get installed ruby 2.3 for me, then threw an error about rubyzip requiring ruby 2.4 at least. Manually upgrading Ruby caused different errors, which my Ruby knowledge was not strong enough to handle.
I found using chruby with Ruby 2.4.9 worked, I’d recommend using chruby to install Ruby 2.4.9 or higher before proceeding with the Jekyll instructions (skipping the first step).
Hope this helps
Hello, Just starting with NBev and having a few issues.
I installed nbdev and it works from the command line (I can import it etc.).
However, when I run the 00_core notebook in the tutorial, I can’t import the library.
For example,
#hide
from nbdev.showdoc import *
returns a Module not found error (see below).
What am I missing?
ModuleNotFoundError Traceback (most recent call last)
in
1 #hide
----> 2 from nbdev.showdoc import *
ModuleNotFoundError: No module named ‘nbdev’
I had the same issue, where locally nbdev_diff_nbs
worked, but it failed on CI. It ended up being related to a mismatch in nbdev
versions.
In .github/workflows/main.yaml
copied from nbdev_template
, the latest release of nbdev
is installed by default. I built my local libraries with a different release, which caused minor differences in .py file creation (such as adding version info and differences in whitespace) compared to the version created in GitHub Actions.
I upgraded nbdev locally ( pip install -U nbdev
), rebuilt my libraries and pushed to GitHub again, then it worked as expected.
Would it be worth pinning the nbdev
version used for CI? Or have another means to make sure the version used to build libraries is the one installed in CI?
I also found this Ruby installation link useful in getting an up-to-date version on Ubuntu 16
It looks like some conda enviromnent issue, you should double check where you ran the command jupyter notebook.
Yes, thanks for your prompt reply.
I had to do some substantial clean up of messy multiple Conda installations.
It works now.