When I open Jupyter Notebooks, I see all of the folders under "Owner" on my computer (including My Documents, My Pictures, etc). I wanted to see if there was any way that I could install Anaconda or use Jupyter notebooks so that these folders are not seen. Having all of those folders clutters the screen, I just want folders for my datasets and notebooks.
In addition, when I open it in localhost and I see these folders (My Documents, My Pictures).
Does this mean that these files are copied onto python's servers? Or would it only be accessible from my computer?
If someone is a complete newbie to using Jupyter Notebook, like me, then here's the elaboration to Yasin Yousif and ALollz comments:
Open Jupyter Notebook which results in the Juyter Dashboard.
Open new terminal from here.
This is where the solutions suggested by Yasin Yousif and ALollz need to be implemented:
You can change the default directory of Jupyter Notebook.
Go to .jupyter folder. It's usually in <USER NAME>/.jupyter
Open the config file jupyter_notebook_config.py in a text editor
If the file was missing, create it first by running the command:
jupyter notebook --generate-config
Change it at:
c.NotebookApp.notebook_dir = 'D:/'
Related
When i run example.ipynb file in vs code, it saves me a lot of files like:
example-caloifdf-498s-a54d-sdj8-caksjnbrhn83.ipynb
example-a60c6s44-9fax-4747-a9da-as9876fg34r8.ipynb
etc...
in the same folder where example.ipynb is in.
Questions:
What are those files?
How i can i stop vs code from making them\put them in another path if they are relevant?
Thank You.
That should actually be a bug. It's supposed to delete those files. There a consequence of us using jupyter under the covers to run your kernel.
This bug here should resolve it when we fix it:
https://github.com/microsoft/vscode-jupyter/issues/6510
.ipynb files aren't created by vs-code, they are jupyter notebook files generated when working with jupyter notebooks. They don't appear in anaconda or other IDEs which have built-in jupyter notebook support because there is no need to interact with the underlying .ipynb file directly.
I have Anaconda distribution of Python on Windows.
I have issues with auto-complete in Jupyter Notebook.
I think auto-complete was working before but it doesn't quite work now. I don't get it.
So I am trying to disable Jedi as it messes up my auto-complete in Jupyter Notebook (that's what other folks say who had the same issue).
This is described on several web pages as a possible solution.
See also
Kernel taking too long to autocomplete (tab) in Jupyter notebook
I follow this suggestion
https://github.com/ipython/ipython/issues/10493#issuecomment-298968328
I can locate my profile directory but there's no ipython_config.py there.
C:\Users\username\.ipython> dir ipython_config.py /s
Volume in drive C is OS
Volume Serial Number is BC61-492E
File Not Found
C:\Users\username\.ipython>
Why so? What am I missing?
Should I create the file myself if it's missing?
Maybe under the profile_default subfolder of C:\Users\username\.ipython?
Just in case you need it on the fly for a single notebook in jupyter:
%config IPCompleter.use_jedi=False
does the magic trick, too.
If the file ipython_config.py is missing then:
Run ipython profile create in the profile_default sub-folder
Append this property c.IPCompleter.use_jedi = False
to the newly created ipython_config.py file
I have read about .py and .ipy, also the difference between python, ipython and notebook.
But the question is: what is the real difference between .py and .ipynb file?
Is .ipynb file just more convenient to be run on jupyter notebook, or anything more? I am wondering because I am thinking about which format to be used for publishing on GitHub.
Thanks
.py is a regular python file. It's plain text and contains just your code.
.ipynb is a python notebook and it contains the notebook code, the execution results and other internal settings in a specific format. You can just run .ipynb on the jupyter environment.
Better way to understand the difference: open each file using a regular text editor like notepad (on Windows) or gedit (on Linux).
Save on git the .ipynb if you want to show the results of your script for didatic purposes, for example. But if you are going to run your code on a server, just save the .py
Adding #Josir answer, the below information is very useful for open .ipynb file using PyCharm.
Create a new Python project in Pycharm
Specify a virtual environment, and install the jupyter package(pip install jupyterlab).
Run the server using the jupyter-lab command.
Browser will open the jupyter notebook like below, there you can execute the .ipynp file.
Here is documentation https://jupyterlab.readthedocs.io/en/latest/
py means PYthon
ipynb means Interactive PYthon NoteBook - which is now known as Jupyter notebook.
The latter one is merely a Python script with descriptive contents - you describe what your data is doing by means of Python script and some funny texts. That's pretty much it - and also, you need a specific editor e.g. PyCharm or Google Collab to open and run it.
I think the answer here might help you: https://stackoverflow.com/a/32029027/11924650
.ipy indicates that it's an IPython script. The only difference between IPython scripts and normal Python scripts is that IPython scripts can use IPython magics, e.g. %timeit, and run system commands as !echo Hi.
How can I run .py files from jupyter lab? I have spent my all coding life using jupyter notebook and jupyter lab but replication codes of research papers are mostly in .py file format
For instance, this is a github repository for beta variational autoencoder. As you can see from the repository, these kinds of repositories are usually comprised of main.py, model.py, which looks a lot different from .ipynb format that I usually use.
Can someone share how to comfortably run these kinds of .py codeson jupyter lab? I would appreciate it a lot if someone tells me a video or an article explaining how to run these .py codes on jupyter lab comfortably.
"...how to run these .py codes on jupyter lab comfortably."
Basically the Jupyter's IPython interface allows you to do magic commands that commands within a shell.
Here is the magic for python subprocess.
You can use:
%python -m /path/to/myfile
Then execute the cell and the command will run in the cell and the output cell is the standard output for this run.
You can also make this run in tmux or other tools to make it as a managed background job.
There is a rather thorough discussion of how to interact with .py files from Jupyter notebook here:
How to load/edit/run/save text files (.py) into an IPython notebook cell?
(No terminal window is needed.)
Find File-> new launcher -> other -> terminal, then you use command line run your python file, like "python xxx.py"
I'm trying to set a custom starting directory in Jupyter Notebook. I have edited jupyter_notebook_config.py.
Removed # from line "c.NotebookApp.notebook_dir =", added parameter:
c.NotebookApp.notebook_dir = u'c:\\my\\chosen\\directory'.
But still doesn't work, console coming up with error, and jupyter starting in the default home directory.
I'm using Windows server 2008. According to the manuals, it should work.
Does anyone have a suggestion about my problem?
The followings steps work perfectly for me on Windows:
First find which directory Jupyter is looking in for your config file:
jupyter --config-dir
If there is no jupyter_notebook_config.py file in that directory, generate one by typing:
jupyter notebook --generate-config
Then edit the jupyter_notebook_config.py file and add something like:
## The directory to use for notebooks and kernels.
c.NotebookApp.notebook_dir = 'c:\\users\\rsignell\\documents\\github'
Then start your jupyter notebook from any directory:
jupyter notebook
and it will start in the directory you specified.
For more info see: http://jupyter-notebook.readthedocs.io/en/latest/config.html
Microsoft Windows
Open dos command line by typing cmd on windows explorer address bar. This will open command prompt with current path set to current folder. Type jupyter notebook --notebook-dir=%CD% on commandline to start jupyter notebook (ipython notebook) with current directory as notebook's starting directory
I also had the problem, and editing jupyter configuration file didn't work either.
My workaround is to make a batch file that goes to a specified directory, then start jupyter notebook from that directory.
You can use notepad to write the batch file, just save it as an all files and specify the extension as .bat
An easy way is also available from DOS prompt using copy con. First, access command prompt (usually by typing "cmd" and enter). Then:
copy con startjupyter.bat
after that you can specify your directory and start notebook from there, for example if your directory is D:\python_codes :
d:
cd python_codes
jupyter notebook
After that, save the file using CTRL+Z and Enter.
You can run the batch file by calling the name (startjupyter), or click it. For the latter, maybe put it in your desktop for easy access.
I had also problems with the solutions given here. My solution was quick and dirty then, but it works with Windows. I made a batch-file:
cd C:\[starting Directory]
jupyter notebook
stop
You can start Jupyter with a defined directory when you use different batch-files. For example:
cd C:\datascience
or
cd C:\browsergame