Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusing error if ipynb-filters are used #1298

Closed
rleyvasal opened this issue Feb 17, 2023 · 10 comments · Fixed by #1332
Closed

Confusing error if ipynb-filters are used #1298

rleyvasal opened this issue Feb 17, 2023 · 10 comments · Fixed by #1332
Labels
bug Something isn't working

Comments

@rleyvasal
Copy link

Followed tutorial but getting error

Followed the nbdev tutorial for nbdev_cards example and did git push results. but I keep getting errors about CI and Github pages failing because quarto needs root access.

Also ran nbdev_clean but the problem persists

installing quarto requires root

Minimal reproducible example

https://github.com/rleyvasal/nbdev_cards

@rleyvasal rleyvasal added the bug Something isn't working label Feb 17, 2023
@gaslitbytech
Copy link
Contributor

The error is a not an permission error about root access.

It is AttributeError: path_. From your most recent action I have downloaded the following log:

Quarto is not installed. We will download and install it for you.
Installing or upgrading quarto -- this requires root access.
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.9.16/x64/bin/nbdev_filter", line 8, in <module>
    sys.exit(nbdev_filter())
  File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/fastcore/script.py", line 119, in _f
    return tfunc(**merge(args, args_from_prog(func, xtra)))
  File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/nbdev/cli.py", line 46, in nbdev_filter
    with redirect_stdout(dn): filt(nb)
  File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/nbdev/processors.py", line 243, in __call__
    def __call__(self, nb): return self.nb_proc(nb).process()
  File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/nbdev/process.py", line 126, in process
    for proc in self.procs: self._proc(proc)
  File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/nbdev/process.py", line 120, in _proc
    if hasattr(proc,'end'): proc.end()
  File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/nbdev/frontmatter.py", line 66, in end
    self.fm.update({'output-file': _nbpath2html(Path(self.nb.path_)).name})
  File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/fastcore/basics.py", line 247, in __getattr__
    def __getattr__(self,k): return self[k] if k in self else stop(AttributeError(k))
  File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/fastcore/basics.py", line 216, in stop
    raise e
AttributeError: path_
Error: Process completed with exit code 1.

I had a look at https://github.com/fastai/workflows and didn't see any recent commits that may have broke things. So I followed the tutorial with https://github.com/tourdownunder/nbdev-hello-world and don't get this issue.

It may have been intermittent. What happens if you run it again?

@rleyvasal
Copy link
Author

rleyvasal commented Feb 18, 2023

I ran another 3 times and kept getting error:

  File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/fastcore/basics.py", line 216, in stop
    raise e
AttributeError: path_
Error: Process completed with exit code 1.

I'm using Jupyter notebooks in VSCode so I updated my code to use pre-commit as described in the nbdev tutorial , but I still got the same errors

I added .pre-commit-config.yaml to my repo root and added the following code to my yaml file.

repos:
- repo: https://github.com/fastai/nbdev
  rev: 2.2.10
  hooks:
  - id: nbdev_clean
  - id: nbdev_export
  

@gaslitbytech
Copy link
Contributor

What versions of fastcore and nbdev do you have?

fastcore==1.5.28
nbdev==2.3.12

If they are different it might be worth updating.

@jvivian
Copy link

jvivian commented Mar 6, 2023

What versions of fastcore and nbdev do you have?

fastcore==1.5.28
nbdev==2.3.12

If they are different it might be worth updating.

I am getting the same error and have the same versions installed. It looks like nbdev_filter is actually what is failing

nbdev_prepare
Success.
Traceback (most recent call last):
  File "<>/nbdev_filter", line 8, in <module>
    sys.exit(nbdev_filter())
  File "<>/lib/python3.8/site-packages/fastcore/script.py", line 119, in _f
    return tfunc(**merge(args, args_from_prog(func, xtra)))
  File "<>/lib/python3.8/site-packages/nbdev/cli.py", line 46, in nbdev_filter
    with redirect_stdout(dn): filt(nb)
  File "<>/lib/python3.8/site-packages/nbdev/processors.py", line 243, in __call__
    def __call__(self, nb): return self.nb_proc(nb).process()
  File "<>/lib/python3.8/site-packages/nbdev/process.py", line 126, in process
    for proc in self.procs: self._proc(proc)
  File "<>/lib/python3.8/site-packages/nbdev/process.py", line 120, in _proc
    if hasattr(proc,'end'): proc.end()
  File "<>/lib/python3.8/site-packages/nbdev/frontmatter.py", line 66, in end
    self.fm.update({'output-file': _nbpath2html(Path(self.nb.path_)).name})
  File "<>/lib/python3.8/site-packages/fastcore/basics.py", line 247, in __getattr__
    def __getattr__(self,k): return self[k] if k in self else stop(AttributeError(k))
  File "<>/lib/python3.8/site-packages/fastcore/basics.py", line 216, in stop
    raise e
AttributeError: path_

Will update if I figure it out

@ababino
Copy link

ababino commented Mar 7, 2023

This happened to me after upgrading nbdev. I deleted (move it to another folder) the _quarto.yml file and run nbdev_prepare and now it works. I hope this is useful.

@jvivian
Copy link

jvivian commented Mar 7, 2023

This happened to me after upgrading nbdev. I deleted (move it to another folder) the _quarto.yml file and run nbdev_prepare and now it works. I hope this is useful.

Not sure how I ran into it while setting up from scratch but that definitely solved the issue. Much appreciated @ababino !

@rleyvasal
Copy link
Author

I am still getting github emails about Run failed: CI .. and Run failed: Deploy to github.

I have updated to the latest versions of fastcore and nbdev and ran nbdev_prepare before commiting my changes.

fastcore==1.5.28
nbdev==2.3.12

@nicole-brewer
Copy link

nicole-brewer commented Mar 20, 2023

I'm also getting this error while setting up from scratch using nbdev 2.2.10.

@seeM
Copy link
Member

seeM commented Apr 27, 2023

I think this should be fixed by using the latest version of nbdev locally, and ensuring ipynb-filter doesn't appear in your _quarto.yml. I'm not sure what's causing it to appear there in the first place -- I can only suspect an older version of nbdev

@seeM seeM changed the title nbdev_cards example showing CI and github pages error Installing or upgrading quarto -- this requires root access. Confusing error if ipynb-filters are used Apr 27, 2023
seeM added a commit to seeM/nbdev that referenced this issue Apr 27, 2023
@seeM seeM mentioned this issue Apr 27, 2023
@seeM
Copy link
Member

seeM commented Apr 27, 2023

We're introducing a more useful error message in #1332. Also see this forum post for fixes to related issues.

jph00 added a commit that referenced this issue Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants