MyST-NB icon indicating copy to clipboard operation
MyST-NB copied to clipboard

Handling unwanted execution artefacts + folders

Open najuzilu opened this issue 5 years ago • 7 comments

I keep getting this error. Any suggestions as to what I might be doing wrong? Screen Shot 2020-04-03 at 10 47 28 AM

najuzilu avatar Apr 03 '20 00:04 najuzilu

I'm guessing this is a jupyter-cache and/or myst-nb problem. I'll move it over to myst-nb as a starter. pinging @chrisjsewell in case he can spot-check this

choldgraf avatar Apr 03 '20 02:04 choldgraf

I've narrowed down the issue to these two code-blocks:

```{code-cell} ipython3
%%file math2.py
pi = 'foobar'
```

```{code-cell} ipython3
import math2
```

I can't find the location of math2.py.

najuzilu avatar Apr 03 '20 04:04 najuzilu

hey @najuzilu is this an issue with ipython magics? For these sorts of issues I typically write a very small temporary notebook in another (small testing project) with what you think is causing the issue -- it helps on two fronts:

  1. takes less time over building the project multiple times as you try and narrow the bug down
  2. helps identify the key issue and provides a minimal example.

If you're using jupyter-cache the issue might be the split in assets and artefacts @AakashGfude do notebooks execute in the same workspace as the artefacts that are generated by the notebook.

mmcky avatar Apr 03 '20 04:04 mmcky

Ah you're right, I found the file in artefacts under the appropriate hashed folder.

najuzilu avatar Apr 03 '20 05:04 najuzilu

@mmcky @najuzilu @choldgraf notebooks execute in the same workspace as the artefacts . Regarding this issue, the artefacts are not the problem, they are properly created with ipython magics and accessed. The problem is the __pycache__ folder which usually gets created with every import statement. In this case, because of the artefacts import statements, I presume..

Now, jupyter-cache specifically checks for artefacts to be a file:- image

And in this case, __pycache__ is also passed as an artefact, which breaks the system because it is a folder.

We will need to have some checks on what gets added to the array of paths passed as artefacts to jupyter-cache

AakashGfude avatar Apr 04 '20 02:04 AakashGfude

nice diagnosis @AakashGfude

mmcky avatar Apr 04 '20 11:04 mmcky

Hey all - does anybody have bandwidth to tackle this one soonishfully? I think that it is reasonable to be a blocker on a "release" of Jupyter Book since many folks may have this issue, and the fix seems relatively straightforward

choldgraf avatar May 13 '20 19:05 choldgraf