Can I open ipynb files from local runtime as notebooks without uploading them to my Google Drive? - jupyter-notebook

I have connected to a local runtime of a Jupyter Notebook in Google Colab.
As you can see in my Collaborator tab I have a file called "My_Agent.ipynb" that I opened from my Google Drive (middle) and another, different, "My_Agent.ipynb" file (right) that I opened by double clicking that file name on the left.
Normally I would want to be able to open and edit all the .ipynb files on the left by doubling clicking them. Instead I get the format on the right which is not a notebook (it doesn't have cells) and as you can see it says I can't edit it.
The google drive file and the file on my local runtime are different files. Is it possible to open and edit the one in my local runtime without uploading it to my Google Drive?
It is the same unanswered question as this: Google CoLab - How to run a jupyter notebook file that is in the 'Files' tab (i.e. /content/) of my CoLab environment
, but hopefully more clear now.

I think it's protection against our stupidity.
I'm sure at some point you and I would lose a lot of work when the runtime closes or resets.

Related

how to open the .ipynb file in readable format

I have got downloaded a file that got downloaded in a format .ipynb extension but its not in a readable format. Can anyone help me to figure out how to make it in a readable format? Attaching a screenshot of the file when I tried opening it in notepad.
how to open it in readable format
One of the easiest ways to just view a notebook file that is also 100% secure in case what you are being sent is sensitive: nbpreview.
When you go there it asks you to choose a local file. The file isn't uploaded anywhere. It remains in your browser's local cache so it is useful for sensitive stuff that cannot be public.
Similarly, you can upload it to the notebook{sharing}space which is billed as "the fastest way to share your notebooks". It would provide you with a link to view the notebook you have and can be private if you limit sharing the link.
If the notebook can be posted to Github (repository or gist) or online, you can point nbviewer at it and have it rendered nicely. In fact, although it is technically 'static', nbviewer can render some interactive Plotly plots and widget controls that enable playing back animations comprised of frames. This rendering form is also very nice for sharing with non-programmers as the GitHub cruft is not surrounding the content.
You can use Jupyter running in your browser and backed by a free Jupyter community-run service to view the notebook file as an active notebook, on what is equivalent to a temporary remote machine.
Go to Try Jupyter and select either 'JupyterLab' or 'Jupyter Notebook' from the offerings presented. I'd suggest JupyterLab as the steps outline below are made easier as you have the file navigation pane on the left.
After your session spins up in your browser, if you chose JupyterLab, drag your file from your local machine into the file navigation pane on the left side. It will get a gray dashed line around it when you have dragged it to the right place. Drop it in and let it upload. Now double click on it to open it.
If you don't want to drag-and-drop or you chose Jupyter notebooks (classic notebook interface) make a text file and paste in the content you showed. (It's json format as that is the underlying .ipynb format presently.) Save that file with an .ipynb extension. You should then be able to open it the Jupyter Dashboard. (Note the following in the rest of this section was written before the 'Try Jupyter' offerings were switched to using the exerpimental JupyterLite and so your mileage may vary. If you drag-and-drop into JupyterLite, it actually is in your machine; however, it is in a virtual system in your browser that your local file system cannot access directly. To get what this section was specifically written for now, go here and click on the launch binder badge to trigger a session on a true remote machine served by MyBinder.) You used to click on the logo in the upper left to get to the dashboard but it will now take you to JupyterLab and you can double click to open your notebook file. If you really need the classic dashboard, change the end of the URL to change /lab to /tree.
Note because the environment backing your notebook hasn't been set up to handle everything, you'll be out of luck for now trying to run it. You'd have to add your pokemon.csv and install anything else besides pandas. There are ways to use the MyBinder system to handle that as well; however, probably best learned about later this stage.
The MyBinder session is temporary and unique to you. It will close after 10 minutes of inactivity and no longer be accessible. You can always open another session later and redo the steps. Or learn about other options eventually.
Related:
Nbpreview and a lot of the related tools mentioned here are also covered in Sharing R code in Jupyter notebooks.
(These following suggestions mostly assume the notebook is already online, usually at Github. You can still use a local notebook by uploading it to the session as I suggest above. They do though provide additional ways to learn about using MyBinder to serve active notebooks in your browser.)
How to save code file on GitHub and run on Jupyter notebook?
Run a Jupyter notebook directly online (without downloading it locally)
You need Jupyter Notebook in your machine. That is one option. Otherwise, you can upload the file into GitHub and open the .ipynb file from there.

How do I upload a local csv for use in Google Colab with an R kernel?

The only results for this question that I see is to use Python to either mount the drive or load through git/gist, etc.
This is how I'm currently loading the R kernel (How to use R with Google Colaboratory?): load the Demo.ipynb and it somehow retains the R kernel for me when I save a copy.
I'm dumb and figured out a workaround
In case anyone else has this problem:
1
Click on the arrow to expand the window, Files -> Upload
It should give you a warning that the files will get deleted after the runtime is refreshed.

Jupyter-notebook does not show my desktop folders

when I launch jupyter notebook, I select desktop Folder, it says the folder is empty. I have many folders on desktop but jupyter notebook does not show any of them. Any idea how I can fix it?
I was experiencing the same issue as I could not access both desktop and documents on jupyter notebooks because on jupyter notebook it was showing that these folders are empty and I was very frustrated lol. It could be the folders are auto backed up on OneDrive, so on jupyter notebook, access them through onedrive i.e. onedrive>desktop or any other folders such as documents. I accessed them through onedrive. I hope it works for you too.
I was facing the same issue on windows 10; there are two Desktop folders!
one directly under / and another one under /OneDrive
The one you want is /OneDrive/Desktop
Hey Hey I was facing the same error, I tried downgrading upgrading re-installation but no results came out finally after two days efforts I found that Jupiter need to be started in a user directory by using(cmd)
cd C:\Users\Hamza Wahla
Then type
jupyter notebook
check this
Well I didn't find a way to make this default. But I am able to open the location whichever I want.
When you run "jupyter notebook" from your terminal. It was mentioning the serving location as "/Users/username/Downloads"
so to set another directory as working directory, just write
jupyter notebook --notebook-dir=/Users/username/Desktop
So this could happen because of few reasons:
OneDrive: As mentioned in other replies, folders are backed up on OneDrive and kept under the same folder for user.
The files are hidden in the user folder. Check the properties of the user folder and the hidden checkbox should be unchecked.
It happened with me, Jupiter Notebook was not able to recognize my documents, though i had files on my documents folder it was still showing empty, that's because my documents were saved in one drive, the solution is simple, open one drive in Jupiter and access documents and you'll find all your files there.

RStudio project "cannot find the file specified" on R session restart

I am getting strange and annoying behavior in one (yes, only one) of my RStudio projects. Whenever I restart the R session within this project, I can no longer save any of the files, and when I try to (or RStudio tries to automatically) I get a popup error saying "The system cannot find the file specified" and I have to reopen the project and all of the R scripts.
I looked at the log file, and I see a lot of the following error:
07 Oct 2015 00:52:05 [rsession-Mark] ERROR system error 5 (Access is denied) [path=C:/Users/Mark/GoogleDrive/Research/CEQUAL_event/.Rproj.user/5E5F98D9/sdb/s-26E44539/lock_file];
OCCURRED AT: bool rstudio::core::FilePath::exists() const C:\Users\Administrator\rstudio\src\cpp\core\FilePath.cpp:308;
LOGGED FROM: bool rstudio::core::FilePath::exists() const C:\Users\Administrator\rstudio\src\cpp\core\FilePath.cpp:308
It looks like the problem may be in the .Rproj.user folder. So I deleted that and let RStudio regenerate it, but the behavior started right back up again.
I am using Windows 7, RStudio version 0.99.441, and R version 3.2.2.
I think #Jack Wasey is right: Google drive locks files during sync. This causes many issues with other programs as well. There are alternatives from companies that do file syncing for a living, such as dropbox, whose clients don't lock files. With google drive you only have the option to use selective sync and exclude every .Rproj.user folder. Once the RStudio's database is corrupted, moving the project out of the Google drive folder won't be enough - you will need to delete/rename it to have RStudio fix its database.
Summary:
Copy contents from all unsaved files to a temp file outside of RStudio (while clicking away the error message every other second)
Quit Rstudio
Pause Google drive syncing
Rename (or move/delete) the hidden .Rproj.user folder in your project
Reopen the project in Rstudio
Exclude the new .Rproj.user folder from syncing with Google drive (Preferences -> sync only these folders)
Remember that Google drive is free / Become an awesome google developer and fix the issue once and for all
May not be related but might be helpful to someone else. I was getting the same error (over and over) and finally realized that I had an R session open from days ago, that had eventually gotten stuck. It was running in the background with a "Fatal Error" message waiting for me to click OK. When I closed that session everything started working again.
This was happening to me as well, but curiously only when I was using Project files (.Rproj - not stand alone R scripts). It was driving me crazy.
I found that buried in the settings (Tools -> Global Options -> Git/SVN) there was a setting "Enable Version Control Interface for RStudio Projects). I guess I had turned that option on when I was messing with my settings and then forgot about it since I don't normally use project files.
What worked for me was I noticed DescTools package I installed caused it, though it served the purpose I installed it - fetched me mode value without going through mode functions. I then deleted the line I got the install.package, re-saved the project (ctrl S) and I could knit it.
Bottom line, read the error message soon as the box pops up, it's going to give you a hint of what line is causing the issue.
I hope this works. Enjoy

How to easily open a script in R-studio

I am very new to R-studio. In RGui, I was used to click File / Open Script to open a new script. But in R-studio, I only see File / Open File which generaly opens any file (?). The disadvantage is that I have many files in my directory and I want to see only *.R files when opening a script - which is what Rgui does and I love it - but cannot figure out how to do the same in R-studio.
If you use windows, you can just type
~>".R"
into the search box top right (while you are in your R folder), and you will only see files that end on .R
If you click into the search box, you see your past search queries, so you won't have to type it again every time you open a script.
If you use a different OS, look for a respective search "wildcard".
edit: "show file extensions" should be activated

Resources