Uploading files to Jupyter running on VM VitualBox - python

Is it possible to upload a file (say a .pdf or .csv) saved in my hard disk into Jupyter running on VirtualBox?

Yes, it's possible.
To begin with, your host PC mut have a shared folder with your VM (Explained elsewhere).
A method I do is to
First create a folder myfolder for the (.pdf or .csv) files.
Secondly, load the folder by: going to the created myfolder --> right-click on the myfolder --> choose "Open in Terminal".
Thirdly, at the terminal it should look like this: myfolder]$. Then I type "jupyter notebook" as such: [username#localhost myfolder]$ jupyter notebook and hit ENTER.
The folder should be opened and containing my .pdf or .csv files.

Related

Opening an Excel (.xlsx) file on system restart and enabling autosave automatically

Context:
We have some Excel files with embedded VBA used only for refreshing them (the data source for each one of these Excel files is a SQL query therefore on refresh, the data gets pulled). After refresh, the file gets saved. All of these files are already saved in the One Drive folder.
When you open an Excel file that is stored in the OneDrive folder along with a specific ceremony (you have to first open Excel application, then go to open, then through Excel application open each file separately from the OneDrive folder), the AutoSave gets activated on Excel file. I hear that this is only available in O365.
Problem:
The problem is that on system restarts, planned & unplanned, we have to repeat this.
Granted this is not an efficient system to begin with and you can question the method itself, I was wondering if there is a way to open the files on system restart automatically with AutoSave enabled.
So far:
Please let me know if you need more information.
Currently I have tried Python and batch command, both open the file but do not enable the autosave which makes it pointless since the files should get save to OneDrive. It is worth mentioning that I used gpedit.msc in Run (Windows) to run the batch file on system restart and I have used the path for the shortcut of .bat file. The reason is that I wanted to test and see if running the .bat in Administrative mode would fix this and the only way that you can run a .bat file in admin mode is to create a shortcut and then set the default run-mode of that file to Admin mode.
For Python I used this script:
import os os.chdir('C:\\Users\\USER\\FOLDER) os.system('FILE.xlsx')
For .bat file I used this
#echo off set params=%* start excel "C:\Users\USER\FOLDER\FILE.xlsx" /e/%params%
I have tried using .bat to run Python to open the files as well and that also failed.
Many thanks in advance,

How to convert a python project to ipynb format notebook?

I have a python machine learning project in a folder. I want to change the whole project into ipynb formate notebook. Actually I want it in Google Colab.
You can do the following to achieve your goal in easiest way:
Compress your folder to a zip file
Open google colab and create a new notebook
On the left side there will be a menu, click the upload button on the upper left corner of that menu and upload the folder.
User ' !unzip /path-to-file' to unzip the whole folder.
Ps: you can copy the zipped folder path by right clicking on it and it will give you a few options including 'copy path'.
Use p2j to convert Python source code to Jupyter Notebook.
From the command line, run
pip install p2j
then go to the directory where your file is located. -->( for example-> cd downloads, if the file is in download directory)
then run
p2j myscript.py
This will create a myscript.ipynb file.

Voila not to Load Certain .ipynb Files

I am very new to Voila and Jupyter. I understand Jupyter notebook files (i.e. files with extension .ipynb) can be loaded in either Voila server or Jupyter server.
To elaborate, for instance, we have files below in the same folder: -
a.ipynb
b.ipynb
My question is that if it is possible for me only to load "a.ipynb" in Voila? The example is just for purpose of demonstration. We could have a large number of files / folders in the folder.
I have scanned through Voila website but doesn't look like there is any existing feature I can use to support this.
Thank you.

How to config automatic sync Jupyter notebook .ipynb and .py files in VSCode e.g. by using Jupytext

I have written some Jupyter notebooks using original Jupyter notebook web interface. All notebooks are synced nicely in this way.
But now, I would like to edit my notebooks in the VSCode. But I cannot configure syncing notebook file with its python script.
I tried this using jupytext:
created file jupytext in the folder ~/.config
put the next code into this file:
# Always pair ipynb notebooks to py:percent files
default_jupytext_formats = "ipynb,py:percent"
But no effect!
(Update) Can this be achieved, as a first solution, using VSCode Tasks (I am not used tasks yet)?
May be it possible to run the task with jupytext command if the notebook file is opened/saved/modified?
Currently, VSCode does not support such a function. The Jupyter function in VSCode is provided by a Python extension, which supports us to convert between .ipynb files and .py files in VSCode.
.ipynb files to .py files : Export as python script.
.py files to .ipynb files : Right click, "Export Current Python File as Jupyter Notebook"
I have submitted the requirement you described, and we look forward to the realization of this feature. Giuhub link: How to synchronize the jupyter file and python file of VSCode.

Google CoLab - How to run a jupyter notebook file that is in the 'Files' tab (i.e. /content/) of my CoLab environment

In Google CoLab on the left is a pane that can be opened that shows Table of Contents, Code snippets, and Files.
In the Files pane there is an upload button, I can upload a notebook file to this Files area. But once the notebook file is uploaded, there is no option to run it as a notebook. The menu option File->OpenNotebook doesn't show the CoLab /content/ files as an option to start a notebook.
Is there a way to do this? Or can it be added in future releases?
The reason for this request is I'd like to git-clone a repo with multiple notebook files into the /content (or Files) area of CoLab. And then be able to easily switch between the notebooks, much like the native Jupyter notebook interface that shows a directory with potentially multiple notebooks that can be started.
I've tried right-clicking on the notebook file in Files but there is no option to start the notebook. I've tried using File->Open_notebook... the Files files aren't shown as an option in any of the tabs.
The desired results is that I can start .ipynb files (i.e. Jupyter notebooks) directly from the 'Files' or /content/ section of Google CoLab.
You can run other notebooks in your current notebook like this:
# if the file was on the google drive
%run /content/gdrive/My\ Drive/Colab\ Notebooks/DenseVideoArchitecture.ipynb
# simply replace the path in your case
%run /content/DenseVideoArchitecture.ipynb
But what you are asking is to switch between different notebooks in the same environment which might not be possible in collab.
I couldn't understand what you actually need, but I hope below code help you:
from google.colab import drive
drive.mount('/content/gdrive')
!cd content/gdrive/My Drive/Colab Notebooks
You should mount your google drive and now you have access to drive as a local drive. In this code, at first two lines, I mount gdrive and then I redirect to some place in google drive for example "Colab Notebooks" and you can run everything you want.

Categories

Resources