Custom python launcher for ipython jupyter - ipython

I use a shell script (call it run_py.sh) to launch python. Is there a way to have the notebook run using this shell script instead of the normal python executable?

Related

VSCODE terminal settings configuration

I am able to run streamlit and python on Anaconda cmd prompt on a separte window, but I can't get the streamlit to run on the VSCODE terminal (python runs fine). When I type in streamlit in the terminal, it generates a message saying
'streamlit' is not recognized as an internal or external command,
operable program or batch file.
I am guessing if I can get my VSCode terminal to run as Anaconda prompt, it should run streamlit without an error, as I am able to run streamlit on a separate Anaconda prompt outside of VSCode.
I am using Python 3.9.5 64-bit as my interpreter on VSCode and selected Command Prompt for my terminal option. I am on Windows environment.
I tried selecting Python 3.8.5 ('base') as my interpreter, but it threw the same message. Here is the image of the options I have for interpreter.
I had to create a new command prompt on VSCode that's using 3.8.5 ('base': conda) as my interpreter in order to successfully run streamlit!!

Running a Python file on command prompt launches vscode instead

I'm trying to launch a python script on windows command prompt, but instead of it doing it, it opens the script on vscode instead. I searched the options in vscode and didn't find anything. How can I stop this behavior?
SOLVED
I simply changed the default program for .py files
You need to change the default application for .py files to python.exe.
This will instruct Windows to pass the filename of the python script you're trying to open to python.exe, which will execute it.
python my_script.py
As a bonus, if you change the PATHEXT environment variable to include .py extension. This will allow you to run a python script without prefixing it with python command when working in a shell.
./my_script.py
Python installer does this by default, but if it isn't there, you can add it.

Can't run python programs in command prompt even though I have added python to Path

I can use "python" command in Command prompt and it works fine but when I try to run a python file in Command prompt this message pops up. https://imgur.com/a/DLGfURE
Yesterday I could run my python program normally but today when I tried again, the entire code from that program that I ran yesterday was deleted and I can't run any python programs in Command prompt anymore. Python command still works though. My Python version is 3,7.
I order to run a python script in python you need to specify that Python should be used. So your command would be
python Test.py

Invoking pyspark with `ipython` specified results in jupyter notebook being launched

I prefer using the ipython enhanced REPL over the python and so am specifying as such in the pyspark command line:
Result: jupyter notebook launched (surprising):
PYSPARK_DRIVER_PYTHON=ipython MASTER="local[*]" $SPARK_HOME/bin/pyspark
This approach was working for several years - but at the present it is causing jupyter notebook to be launched.
That result would make sense if the explicit command notebook were also present:
Result: jupyter notebook launched (expected):
PYSPARK_DRIVER_PYTHON=ipython notebook MASTER="local[*]" $SPARK_HOME/bin/pyspark
Given that the notebook is not specified then why is the notebook launched instead of the REPL ?
Note: when using ipython alone on the command line via
Result: ipython REPL launched (expected):
ipython
the REPL is launched (and not the jupyter notebook).
you might have set PYSPARK_DRIVER_PYTHON_OPTS variable to "notebook". this will cause to open jupyter notebook

QT Shell in Canopy

I've switched to Enthought's Canopy 1.0.0 but I miss the standalone QT shell and the QT notebook. I don't want to use the built-in shell which comes in the IDE. Where can I find the QT shell?
Are you asking about the IPython QtConsole? It and the Ipython notebook (NB this is not a QT notebook; it runs in a browser) are both accessible from the terminal / command prompt:
ipython qtconsole
ipython notebook
But you must have Canopy User Python on your PATH, as described here.
FWIW, the Python shell in Canopy is QtConsole, integrated with the editor and file browser.