really simple question.
I have a URL here that I'm trying to open in Jupyter lab as a jupyter notebook. What is the easiest way to do this? Is there a command line command somewhere?
Thanks.
step 1:
visiting the URL "ctrl + s" to download that file (you would get the file name as xxx.ipynb.txt)
step 2:
Start jupyter notebook. Find the directory where you save to and double click file to open it.
step 3: Change it's name from 'xxx.ipynb.txt' to 'xxx.ipynb'. (delete .txt in the last of file name)close the window and open it again.
I think it's work!!
Just download that file to a working directory - with a menu 'save link as...' or visiting the URL and doing save.
Start juypter notebook from shell (commandline).
In the directory window that it opens for you, double click the saved style.ipynb. Now you have the notebook running in a new window.
Related
VSCode and Jupyter Notebooks on WSL2. Previewing a notebook and then closing the window results in a "unsaved changes" warning. What is this?
What did I do?
open a project with vs code code /path/to/project
git pull to make sure everything is up to date
use file explore to find a .ipynb file
click once on a notebook file
file opens with name in italic file.ipynb
file then changes to straight with unsaved changes notifier file.ipynb *
click the "x" close button for the file
"Do you want to save changes"
I didn't change anything. What is this and how do I fix it?
I would like to change the default browser for starting the Jupyter Notebook directly from Anaconda Navigator (the current browser is Chrome, but I want to open the notebook in Safari).
I can start Jupyter Notebook in Safari by running the following code in Terminal: jupyter notebook --browser safari (based on this answer).
Is there a way to define a different browser for launching the notebook from the Navigator?
Open Anaconda Prompt and run upyter notebook --generate-config
This writes a file to C:\Users\username\.jupyter\jupyter_notebook_config.py
Copy the link C:\Users\username\.jupyter\ and browse to the file location and open it in IDLE editor
Search for the following line in the file: #c.NotebookApp.browser = ''
Remove the # at the beginning of the line to allow the line to execute.
Add the browser target link inside the single quotes c.NotebookApp.browser = 'ENTER TARGET LINK HERE'
To find the browser target link, go to search and look for the browser you want to use. In your case, Safari.
Right click and select “open file location”
Right click on the file, select properties and copy the Target link
Paste the target link inside the single quotes and make sure you delete the double quotes and use forward slashes in your path. (Backslashes are use in double quotes, Forward slashes in single quotes)
Add %s before closing the single quote, so it reads our path as a browser command and add the letter u before the first single quote to indicate this is a unicode string c.NotebookApp.browser = u'BROWSER TARGET LINK HERE %s' and save the file.
Go to Anaconda Navigator and launch jupyter notebook. You will see your selected browser being set to Jupyter notebook.
Right, so digging a bit deeper into the Anaconda documentation, I've found that it's pretty simple, actually. I found the config file at ~/.jupyter/jupyter_notebook_config.py, uncommented the default line # c.NotebookApp.browser = '' and modified it so that it points to the Safari's executable:c.NotebookApp.browser = u'open -a /Applications/Google\ Chrome.app %s'.
I'm using jupyterNotebook from Coursera but see no way to revert everything to the beginning.
The only option relevant seems to be "Revert to Checkpoint" -- but I didn't save a checkpoint at the beginning.
Does it mean that I am unable to revert to it?
Open your notebook at Coursera
Rename it
After renaming just add ?forceRefresh=true to the end of your notebook URL
Hit enter
You now have old renamed version and new refreshed to default one
The procedure is described here.
As of July 2019 the ?forceRefresh=true solution worked for me.
These steps will work as of April, 2020:
Rename your notebook and add ?forceRefresh=true to the url and press enter. Your entire Jupyter notebook will be restarted. Go to the course week and a fresh notebook will be there.
Better late than never -
This is from the Coursera help section.
To keep your old work and also get a fresh copy of the initial Jupyter Notebook:
Make a copy of your Notebook by clicking File, then Make a copy. We recommend using a naming convention such as “Assignment 1 - Initial” and “Assignment 1 - Copy” to keep your notebook environment organized. You can also download this file locally.
Click Control Panel, then choose My Server
Find the name of your previous file, as well as the new copy of your file.
Delete the original notebook file (not the copy) by selecting the checkbox next to the filename. Click the trashcan icon that appears to delete the file.
Click Control Panel, then choose Stop My Server.
Select My Server to restart.
After a few minutes, launch the notebook again from your Course Home. If you get a 404 error while the notebook server restarts, wait a few minutes and try again.
After the restart is complete, you will see a fresh copy.
I believe this is a new feature in Coursera
This is the instruction from a course I was taking:
In any Jupyter notebook, first save your work by going clicking File -> Download as -> Notebook (.ipynb)
Next, click File -> Open. This opens up the file directory.
Select the notebook you wish to refresh from the list by clicking the check box next the the filename
Click the trashcan icon at the top to delete the notebook
Copy this text: ?forceRefresh=true and paste it onto the end of the URL in your browser bar then hit .
You will see your workspace refresh with the updated copy of the notebook
These steps:
1. Open your notebook at Coursera
2. Rename it
3. After renaming just add `?forceRefresh=true` to the end of your notebook URL
4. Hit enter
5. You now have old renamed version and new refreshed to default one
Still work as of 05/14/2021
I installed Spyder using Anaconda, and I am able to launch the IDE using the Spyder icon in my start menu (Win10). I wanted to set my preferences to open all .py files with Spyder, so I followed the Spyder start menu button to an executable, pythonw.exe. The problem is that I cannot launch pythonw.exe by clicking it.
How does the start menu icon for Spyder, which points to pythonw.exe, launch Spyder, but clicking the executable does not yield the same results? Also, when I double click spyder.exe in Anaconda\Scripts a command prompt opens along with the IDE, which does not happen when I click the start menu icon.
Why does this application behave so much differently than any other application I've used before (if this is just how things are in python, I apologize as I'm new!) and is it possible to set Spyder as the default application to open .py files in the same way I can open source files with IDEs in other languages?
Cheers
I found the answer in this question, answer by xyzjayne.
You create a bat file with the following contents:
start YOURPATH\Anaconda2\pythonw.exe YOURPATH\Anaconda2\cwp.py YOURPATH\Anaconda2 "YOURPATH/Anaconda2/pythonw.exe" "YOURPATH/Anaconda2/Scripts/spyder-script.py" %1
YOURPATH will be the path leading to the folder just above the Anaconda folder. For me it was:
C:\ProgramData
And you select the Choose default program to open this file... - and you choose that bat file.
When you go to Spyder shortcut's properties, the target includes a few files. So my guess is that for Spyder to run, all of these files must be run, and that's why when you just point .py files to one exe it doesn't work.
You can right click any of your *.py file, go to properties and choose Spyder as "Opens with" choice.
Right click on your file, and select open with or Choose default program to open this file.. and then in your system... select .. \Anaconda3\Scripts\spyder.exe .
I have also provided you the screenshot of the above path in my system for your reference.
In Windows 10 Anaconda installs itself into a hidden folder called ".anaconda" which is placed in the Users directory under your own profile sub directory.
When you first try to use the right-click menue "Open with" it opens up in C:\Program Files so you have to go up one folder and down into Users. You may need to have previously set one of the options in the View Menu of the file manager so that you can see hidden files. You can't do this from the "right-click open with" place, you have to set that in the regular file manager.
You will find a file called Spyder.bat a couple of folders down within that, e.g. C:\Users\Your_profile.anaconda\navigator\scripts
It will take forever to open each time.
for Anaconda3 on win11:
start YOURPATH\Anaconda3\pythonw.exe YOURPATH\Anaconda3\cwp.py YOURPATH\Anaconda3\ "YOURPATH\Anaconda3\pythonw.exe" "YOURPATH\Anaconda3\Scripts\spyder-script.py" %1
Below a baby-step guide to make Spyder your default program to open .py, including an icon!
First, search for Spyder in windows, and open the folder that contains spyder. Spyder will be a short-cut file. Right-click the spyder shortcut file and choose "Properties". Copy all the contents of the "target" content.
Open a Notepad. Write the word start and the paste the contents you obtained in step 1. Now, save the file as .bat, with any name you want, let's say "myspyderlauncher.bat", in a convenient location for you.
Go to any .py file, and choose "open with", and look for your .bat file (following the example above, the "myspyderlauncher.bat" file). Choose "always" to always open .py files with your bat.
Now double click the .py file and Spyder will automatically be started. Voilà!
Did you say you want a nice spyder icon too instead of that ugly white icon? Here are the next steps (optional):
Download Bat to exe converter (not worries, you will not need to install the software): https://web.archive.org/web/20190304134631/http://www.f2ko.de/en/b2e.php
Unzip the Bat_To_Exe_Converter.zip and go to the "portable" folder and run the .exe file. Open your .bat file ("myspyderlauncher.bat" in the example above), and then go to the right menu, click and look in the "icon" option and look for the Spyder icon (.ico file), which is normally in ...\Anaconda#\Scripts.
Now press "convert" in Bat_to_Exe and save your new .exe file in a convenient location with a convenient name you want. (Let's say we call it "spyderlauncher.exe")
Go to any .py file, and choose "open with", and look now for your .exe file (following the example above, the "spyderlauncher.exe" file). Choose always to always open .py files with your bat.
You will see that all your .py files are now associated to spyder, with a beautiful icon attached, and opening in Spyder.
Some screenshots below
After creating a .ipynb file in the root directory /, how can you move that .pynb file into a deeper directory ie: /subdirectory using the web UI?
As of Sep-21 2015, there is no direct feature that supports moving files. However, there is a simple workaround. (*)
Select the file that you want to move.
Click Rename
Add the new path to the beginning of the filename.
Click OK
That's it. You should be able to find your file in the new path.
(*) https://github.com/jupyter/notebook/issues/471
The steps below may be an overkill to explain how to move a Jupyter notebook file from one folder to another using Jupyter. . However, it may be useful for someone who may be trying this the first time.
Let's look at an example (with example screenshots) to move "practice.py.ipynb" from "/Learn/python/puzzles" folder to "/Learn/python/puzzles/exercises" folder.
Step 1: Check the status of "practice.py.ipynv" notebook
If status is "Running" then the option to "Move" the file will not show. Follow along to "Shutdown" the notebook.
If status does not show "Running" then proceed to Step 4.
Image link shows the status of the notebook. In our example it is "Running"
Step 2: Select the notebook by clicking the checkbox next to it.
Image link shows the options for the selected notebook. "Shutdown" is displayed as an option. Move is not an option for a running notebook
Step 3: Click the "Shutdown" button for the selected notebook to stop the "Running" notebook. Image link show the notebook is no longer running
Step 4: Select the notebook by clicking the checkbox next to it. Image link shows the options for the selected notebook. "Move" is displayed as an option
Step 5: Click "Move" button. A pop-up window is displayed with the current path (folder) of the notebook. Image link shows current path as "/Learn/python/puzzles"
Step 6: Specify the folder where you want to move the notebook. Then click the "Move" button on the pop-up window. Image link shows here in our example, we would like to move it to "/Learn/python/puzzles/exercises" folder
File is no longer displayed in the current folder "/Learn/python/puzzles". File is no longer in the current folder. Image link shows practice.ipynb file is not in "/Learn/python/puzzles" folder anymore
Step 7: Click the exercises folder to navigate to "/Learn/python/puzzles/exercises" folder.
Image link shows notebook "practice.ipynb" is moved to "/Learn/python/puzzles/exercises" folder
If some stumbles here as of 2020, it's now possible to move .ipynb or other kind of files by simply checking it and clicking move.
Nevertheless, for .ipynb files you must be sure that the notebook isn't running (gray icon). If it's running it should be green and you must shut it down before moving.
It's kind of a workaround, but you can do this:
Navigate to the directory you want to put the file in
Click the Click Here
Find the file and upload
Ipython 5.1:
1. Make new folder -- with IPython running, New, Folder, select 'Untitled folder' just created, rename (and remember the name!)
2. Go to the file you want to move, Move, write new directory name at prompt
Note: If the folder exists, skip 1.
Note: If you want to leave a copy in the original directory, Duplicate and then move.
Ran into this issue and solved it by :
Create a new folder in jupyter notebooks.
Go to the folder/directory and click the "Upload "button which is next to the "New" button.
Once you click "Upload", your pc file explorer window will pop-up, now simply find where you have your jupyter notebooks saved on your local machine and upload them to that desired file/directory.
Although this doesn't technically move your python files to your desired directory, it does however make a copy in that directory. So next time you can be more organized and just click on a certain directory that you want and create/edit/view the files you chose to be in there instead of looking for them through your home directory.
Duplicate the notebook and delete the original, was my workaround.
JupyterLab (based on version 2.1.5), does not appear to have a direct move functionality (AFAICT), but does provide yet another workaround:
Right-click on the notebook file you want to move
Select "Cut"
Navigate to the destination folder to which you want to move it
Right-click in that folder (anywhere inside)
Select "Paste"
Note that the cut file doesn't immediately disappear from the original location when you cut it, but will be removed from its original location after pasting into the destination folder.