Python and jupyter are not recognized even when in path - python

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

Related

Jupyter Notebook creates a .txt file - and doesn't let me save as .ipynb. Manually creating a .ipynb file doens't open a jupyter notebook

I'm trying to move my data science Environment to VSCODE, it seems a really powerfull IDE to deal with multiple languages and with great versatility,
But currently I'm dealing with an annoying issue with the python and jupyter extension,
Expected behaviour
Using command palette 'Jupyter: Create blank new Jupyter notebook' it should open a .ipynb file with all the features of a jupyter notebook.
(source: https://code.visualstudio.com/docs/datascience/jupyter-notebooks)
Actual behaviour
Using command palette 'Jupyter: Create new blank notebook' it opens a jupyter notebook with all the features and the proper jupyter notebook layout, but with extension .txt.
I tried to save it as .ipynb but returns and error and don't let me save it.
When I create a file manually with 'filename.ipynb' it creates a file with the jupyter icon, but without all the features of a jupyter notebook.. it is a simple plain script file like a .py file.
I already have done a lot of web search looking for some solution, but without success.
already tried reinstall vscode and downgrade some versions of the python and jupyter extensions, but all without success.
Any help to solve this would be appreciated.
Environment data
VS Code version: 1.59.0
Extension version : Python v2021.8.1105858891, Jupyter v2021.8.1195043623
OS and version: Windows 10 64bit
Python version : Python 3.9.6 64bit

Creating multiple Jupyter working directories/config files in Anaconda

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).

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.

Jupyter file path change to project location

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.

Open a Jupyter notebook within running server from command line

My Jupyter/IPython notebooks reside in various directories all over my file system. I don't enjoy navigating hierarchies of directories in the Jupyter notebook browser every time I have to open a notebook. In absence of the (still) missing feature allowing to bookmark directories within Jupyter, I want to explore if I can open a notebook from the command line such that it is opened by the Jupyter instance that is already running. I don't know how to do this....
Option 1: Run multiple jupyter notebook servers from your project directory root(s). This avoids navigating deeply nested structures using the browser ui. I often run many notebook servers simultaneously without issue.
$ cd path/to/project/; jupyter notebook;
Option 2: If you know the path you could use webbrowser module
$ python -m webbrowser http://localhost:port/path/to/notebook/notebook-name.ipynb
Of course you could alias frequently accessed notebooks to something nice as well.

Categories

Resources