Can't save the file as an ipynb file from jupyterlab - github

I need to download an ipynb file from jupyter-lab on my Mac. For some reason there is no download option in file part. Is there any other way to save my Jupyter file on my desktop to be able to load the file to my Github?
thank you so much,

To download a file from JupyterLab use the file browser:
open context menu on the file of choice, and
select "Download":
This is also documented in the official documentation Working with Files chapter, which even includes this video deomnstartion: https://www.youtube.com/watch?v=Wl7Ozl6rMcc

Related

how to download file inside vscode terminal from remote server?

I want something like
code --download_file [path_to_file]
to download file from remote server to my local computer (instead of manual select file in file explorer because sometimes the file is not in currently open project)
Use curl. It's a "command line tool and library for transferring data with URLs"
This tutorial might help

Link to files in VSCode .ipynb notebooks

I'm trying to put a link to a file in a markdown cell in a notebook, for example:
See [feature scaling notes](feature_scaling_notes.md)
The file feature_scaling_notes.md is in the same folder as the .ipynb file.
A link is created, yet when I click on it, instead of opening the file, a browser window is opened with the address:
https://file+.vscode-resource.vscode-webview.net/...(file path)
How can I make the file open in the correct way?
Thanks.
Coming in v1.63 are file links in notebooks, see release note: file links in notebooks.
Markdown inside notebooks can now link to other files in the current
workspace
Links the start with / are resolved relative to the workspace root.
Links that start with ./ or just start with a filename are resolved
relative to the current notebook.
[link text](./cat.gif)
Bare http(s) links notebooks
In addition, markdown text that looks like an http and https is
now automatically turned into a link:

VSCode looking for file in wrong directory

I'm working on Laravel project. When I want VSCode jump to class's file in vendor, just got issue that it can't open file in correct location.
My working directory is C:\wamp64\www\merchant but VSCode try to open the file from C:\wamp64\www\wallet
My question is that is there anyway to tell VSCode the correct working directory?
delete folder .phpls (~/.phpls or %USERPROFILE%\AppData\Local\PHP Language Server\ on Windows)
is the way to clear VSCode PHP extension server cache.

Convert ipynb to pdf in Jupyter

I am new to ipython notebook, and I would like to convert my ipynb to pdf. But I get the following error when I try to Download as PDF via LaTex.
nbconvert failed: pdflatex not found on PATH
There is no documentation anywhere how to add pdflatex to my PATH. I use windows. Thank you!
A simple and surprisingly good solution is to print the notebook to pdf through the browser with ctrl+p. Just make sure your plots and figures are not on interactive mode otherwise they will not be displayed (set them to %matplotlib inline).
Exporting jupyter notebooks through latex is quite troublesome and takes a lot of tinkering to get something remotely close to publish ready. When I absolutely need publication quality I do it on a latex editor, but this tutorial goes in great length about doing it on jupyter.
A few useful tips to get better results:
Higher resolution plots
Hide your code-cells from the pdf
Take a look at these extensions to improve your jupyter documents
For Mac OS X, the solution for me was to install MacTex first and then export the path to find it:
### TeX
export PATH="/Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin:$PATH"
You can add this to your .bash_profile or similar config file to load it every time.
See more here https://github.com/jupyter/nbconvert/issues/406
As said by Thomas K in the comments, you need to have Latex installed, and after add the path to the directory containing pdflatex.exe file to the PATH variable of your system.
I have looked for a lightweight distribution and tried installing TeXworks, but I didn't find any pdflatex.exe file.
So I have tried TeX Live, which worked fine creating the pdflatex.exe file under the target installation directory. This path should be like C:\...\texlive\2016\bin\win32.
Finally, you should just add this path to the PATH environment variable of your system (you can use the link shared by Thomas K).
As said here, you need to quit jupyter notebook and open a new command prompt after making any path changes, in order for jupyter to find the newly added item to the PATH.
Then, in Jupyter, you can check your environment variables by running the following (refer to this link for details):
import os
os.environ['PATH'].split(';')
and check if it contains the path to pdflatex.exe file.
If you get some trouble when exporting your notebook to pdf due to missing files/packages (this happened to me), refer to this link to search and install them under TeX Live.
For Linux, the reported error is due to the lack of XeLatex, part of the texlive-xetex package.
Installation in ubuntu will be:
sudo apt install texlive-xetex
Instead of using nbconvert what you can do is :
Download your ipynb file as HTML from File option.
Right-click and select print or use Ctrl+P.
Save as PDF
Easy.
Here is the full solution that worked for me (for Mac).
brew cask install mactex
$ cd ~/
$ touch .bash_profile
This will open the bash profile on TextEditor
$ open -e .bash_profile
Paste the following to the top and save
export PATH="/Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin:$PATH"
Close any notebook you have and reopen it
Here is the notebook explaining it step by step:
https://github.com/ybaktir/notes/blob/master/Convert%20Jupyter%20Notebook%20to%20Pdf.ipynb
I agree that latex installation (at least on windows) is painful and the result in my case was not a great looking document. The ctrl-p method alone doesn't work great if you're running in JupyterLab, but if you export the notebook to HTML, then print from the browser, choosing PDF, the result is quite good.
I know my solution is not at a level. But it works !!
in your browser of notebook tab, simply do "ctrl + p" to get download in pdf
First export the notebook file to HTML (available through File> Download as..).
If you are using JupyterLab, then this is available under File > Export Notebook As....
Use (any) free online converters to convert html file to a pdf file. (One such free online converter is sejda (https://www.sejda.com/html-to-pdf)
Note, there are many such converters are available online.

How do I save .py files in IPython notebook with the .ipynb files

How do I set my IPython Notebook so that whenever I save the .ipynb file it will also automatically save the file as a .py file (in the same directory)?
In particular every time I make a change to a notebook I don't want to have to download the file as a .py file and then move the downloaded file into the directory.
I recently moved to a Mac and was able to do this on my previous (PC) setup, but haven't been able to find how to explicitly set IPython to do this.
You can start the notebook server with a --script flag, or set this variable to True in the file ipython_notebook_config.py:
c.FileNotebookManager.save_script = True