notebookPowerTools / vscode-jupytext

Other
51 stars 16 forks source link

Nothing happens when clicking "Open as Jupyter Notebook" #9

Open robin-norconsult opened 2 years ago

robin-norconsult commented 2 years ago

I have been using this extension successfully on an ubuntu environment before, but now on my windows environment the extension doesn't work. The option "Open as Jupyter Notebook" is available, but doesnt respond at all. No error message, just nothing. I am currently working on insider-1.64.0

paw-lu commented 2 years ago

this is happening to me recently too (macOS)

paw-lu commented 2 years ago

actually right after commenting on this issue I realized that if I create a brand new blank file it's openable.

JamesHuckle commented 2 years ago

Problem Same problem for me too, it works fine the first time on a new .py but as soon as you save the cloned .ipynb and it makes the changes to the .py, you are then unable to "Open as a Jupyter Notebook" on that same .py file again (no error to be seen, just nothing)

Emotional damage It's a travesty because this will be game-changing when it works because it's convenient (runs on every save) and eliminates the need for having both cloned .ipynb and .py files.

Temporary solution I have resorted to adding and manually running this command in a cell: os.system(f'jupytext --to py:percent my_notebook.ipynb')

It is from the standard jupytext library and when ran it clones the .ipynb as a new interactive ("# %%" syntax) .py file.

I commit the cloned .py files into source control and then convert them back into their .ipynb counterparts if pulling fresh from the repo. I put this at top of every .ipynb I want to convert into a .py and vice-versa. Run it each time you want to save.


file_name = 'test'
if f'{file_name}.ipynb' not in os.listdir():  
   print('Save .py file as .ipynb because no such file already exists.')            
   os.system(f'jupytext --to notebook {file_name}.py')
else:
   print('Save .ipynb file as .py with interactive syntax') 
   os.system(f'jupytext --to py:percent {file_name}.ipynb')```
dynobo commented 2 years ago

Having the same issue.

A workaround that works for me: If a file won't open, I perform "Open as Jupyter Notebook" on a different file. When I then try it again on the original file, that one opens correctly now, too.

The bug makes this otherwise very useful extension cumbersome to use, hoping for a fix, too :-)

agftrading commented 2 years ago

Having similar issues, except not found a workaround even that works yet. Such a shame since when it was working it was awesome.

Marigold commented 2 years ago

@agftrading try this extension instead of the original one, it fixed the issue for me

DonJayamanne commented 2 years ago

I'm sorry for the inconvenience caused & apologies for the radio silence.

The reason this extension went stale is because of the hacks i implemented in this extension to ensure it worked well with the other Juptyer extnesion & VS Code (without using proposed API).

however I have some good news, this will be fixed soon, by moving this functionality into https://github.com/microsoft/vscode-jupyter-powertoys That way the support will be better as it will be more tightly integrated with the Jupyer externsion & we'll have the benefit of being able to use the API provided by VS Code which hasn't been published yet - i.e. no more work arounds/hacks.

That being said, please note the fact that this is purely experimental, the purpose & dev of power toys is outlined here https://github.com/microsoft/vscode-jupyter-powertoys

...
Features may be added or removed at any time and there is no guarantee of future support by virtue of inclusion in the extension now. Features in this extension that see high usage may be considered for removal from this extension and inclusion in the main Jupyter VS Code extension. In that case, best efforts will be made to notify of the change and migrate settings if possible.
...
DonJayamanne commented 2 years ago

Will update this issue and this repo soon

mjspeck commented 1 year ago

Having the same issue.

A workaround that works for me: If a file won't open, I perform "Open as Jupyter Notebook" on a different file. When I then try it again on the original file, that one opens correctly now, too.

The bug makes this otherwise very useful extension cumbersome to use, hoping for a fix, too :-)

I can't believe this worked, but it did. Thanks for finding this hacky workaround!

ener-jay commented 6 months ago

@DonJayamanne thanks for the super useful extension. Any updates on this issue? "Open as Jupyter Notebook" works the first time, but not after you close the notebook and try again. I get the same issue with congyiwu's version. I am using the official vscode (not insiders edition). Is it supported by powertoys now?

paw-lu commented 5 months ago

For people on this thread, check out the fork congyiwu/vscode-jupytext! At least on my machine, works as expected! (Huge thanks to the fork author!)

PlasmOwO commented 1 month ago

Having the same issue.

A workaround that works for me: If a file won't open, I perform "Open as Jupyter Notebook" on a different file. When I then try it again on the original file, that one opens correctly now, too.

The bug makes this otherwise very useful extension cumbersome to use, hoping for a fix, too :-)

WTF ? You saved my day. TY !