I have experience in RStudio and Visual Studio and new to Python environment, I am struggling to set Python project in Jupyter like above two IDE. Here when I open new notebook then it create it as default location and I am not finding a way to put the file in my project location, Just want to know how to make production ready project like folder structure in Jupyter.
If this post is duplicate then I am not able to search the original one.
Under Linux, specify which directory Jupyter notebook uses to locate the notebooks with the command:
jupyter notebook --notebook-dir=<path to notebook location>
I have this aliased in my .bashrc file to jupytern.
In Windows I created a desktop shortcut and specified the notebook directory as:
C:\python36\Scripts\jupyter-notebook.exe --notebook-dir=<path to notebook locations>
You need to change the path to the jupyter-notebook.exe file to where it is on your installation.
Related
I have Anaconda Navigator on my work computer and I've changed the default working directory for Jupyter notebooks to be a certain location on the firm server, using the steps given here
I have also created a second environment in Anaconda, for which I would like to use a different Jupyter Notebook working directory than that of the base (root). To do this, I believe I would need to:
Create a second Jupyter Notebook config file
Get the second environment to refer to the new config file, while ensuring that the old file still referred to the original config file.
How would I go about this? Alternate approaches to creating multiple working directories also welcome.
Was looking to achieve the same result: pass different configurations which would include specific settings such as working and workspace directories when launching Jupyter Notebook/Lab in different conda or other virtual environments.
Noticing the following:
jupyter lab --help
--config=<Unicode>
Full path of a config file.
Default: ''
Equivalent to: [--JupyterApp.config_file]
Thus, to achieve the desired result, it is possible to pass the path to the relevant config file upon launching Jupyter Lab/Notebook as such:
jupyter lab --config=~/.jupyter/path_to_my_custom_jupyter_config_for_env_1.py
# or
jupyter notebook --config=~/.jupyter/path_to_my_custom_jupyter_config_for_env_1.py
You can copy your current configuration file, make the relevant adjustments and save it as a different file. You would then pass the path to that new config file when launching Jupyter as per above. To simplify, you can create shortcuts that do that (instead of typing/copying the specific parameters on each launch).
Otherwise (with no specific argument passed), Jupyter Lab/Notebook will launch using the default configuration file if it exists, which is always located in the home directory of the Unix user launching Jupyter (~/.jupyter/jupyter_notebook_config.py).
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.
I am using PyCharm Professional to install Jupyter and following the tutorial: https://www.jetbrains.com/help/pycharm/jupyter-notebook-support.html
However, after creating the .ipynb file and trying to run it I run into the following error: "This file does not belong to the project". Also I have "Jupyter file outside of the module" greyed out (see screenshot). Is there anything I am missing? I've created a new .ipynb file inside the project (see screenshot).
The problem here is that your .ipynb folder is inside the venv folder. This venv folder should only contain the Python interpreter and third party packages. You should not place any files you create under venv. Instead, put them directly in the module folder jupyter-eda.
I noticed the scratches folder was not in the project, so it helped to just add it...
I run Windows10, use the latest Anaconda3 (2019) and have installed Jupyter Notebook through conda.
I used to run Jupyter Notebook by navigating to a folder where I save my Jupyter Notebooks named \jupyter_notebook_files and from that directory running the command jupyter notebook from cmd.
A few hours ago I deleted for space saving reasons a folder named ABC.
When now I try to run Jupyter Notebook I get the message:
[C 20:57:04.610 NotebookApp] Bad config encountered during initialization:
[C 20:57:04.611 NotebookApp] No such notebook dir: ''D:/ABC''
I dealed with this problem by typing:
C:\WINDOWS\system32>jupyter notebook --notebook-dir='D:\DIGITAL_LIBRARY\Jupyter_Notebook_Files'
Is there a way to make this folder default and not have to repeat each time the clause: -notebook-dir='D:\DIGITAL_LIBRARY\Jupyter_Notebook_Files' ?
Try to run this code on the terminal:
jupyter --config-dir
The output will be a path. Go to that folder and delete all the contents.
Then run
jupyter notebook
Close Anaconda and or any related programs that are running (Presumably Jupyter is not). Drop down to the command prompt in Windows 10 (or other terminal if you have a different OS). Enter the command:
jupyter --config-dir
This will give you the configuration directory for Jupyter, which will most likely look something like this:
C:\Users<Your Local Account>.jupyter
use CD to go to that directory and use Notepad or your favorite text editor to edit the file called "jupyter_notebook_config.py" - for example:
notepad jupyter_notebook_config.py
Now use find (F3) to search for the line that begins with "c.NotebookApp.notebook_dir = ". The directory that follows the "=" sign probably doesn't exist. So copy that and create the directory OR enter the directory you want instead.
Save and Start Jupyter.
The only way for me to start Jupyter is to navigate to the directory. However, when I open the notebook it's already filled with various system files which I don't want to override. Is there a way to simply run python and Jupiter notebook directly from my desktop dir? Here's my python and jupyter path:
C:\Python36\Scripts;
C:\Users\opodopri\AppData\Local\Programs\Python\Python36\python.exe;
C:\Users\opodopri\AppData\Roaming\Python\Python36\Scripts\jupyter.exe