VSCODE terminal settings configuration - visual-studio-code

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!!

Related

Visual Studio Code Opens and run scripts on the non-default terminal

Until yesterday, my VSC worked fine. I opened, edited, and run my python scripts without a problem.
However since today when I start my VSC session, it starts on Powershell Terminal, that doesn't recognize my conda enviroment despite I set the default terminal as cmd:
When I open the cmd terminal manually, automatically loads my conda env, however when I run the command "Run Python File in terminal" it always opens on Powershell
Any suggestion on how to fix this?

cannot open .ipynb file even if ipython and jupyter is installed in my pc

I have installed ipython, jupyter etc using pip in my windows 7 pc. Now I want to open a .pynb file from command line. When I typed 'jupyter notebook' it is showing: 'jupyter' is not a recognized internal or external command ...... Can you tell where is the problem? Can't I open the file from command line or I have to install an IDE like 'pycharm' or 'anaconda'?
Please try the below command:
python -m notebook
This should work without anaconda.

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

how to open an IPython console connected to an exiting running kernel in PyCharm

Is there a way to open an IPython interactive console in pycharm that is connected to an existing running kernel (similar to "python --existing")?
btw: in case it's relevant, in my case, the running kernel is of a Jupiter notebook...
EDIT: To clarify, my question is NOT about how to open an interactive console in PyCharm. It is about how to connect that interactive console to a an existing running (Jupiter notebook) Kernel.
(tl;dr: Use jupyter console --existing in the PyCharm "Terminal" tool window (not the "Python Console" tool window) to connect to an existing iPython kernel running in a local Jupyter Notebook server.)
I can confirm that the comment by #john-moutafis suggesting ipython console --existing is the right idea. The command gives "WARNING | You likely want to use jupyter console in the future" so I tried that.
I have a project using a conda environment as its interpreter. Jupyter Notebook is installed in the conda environment.
I open the Terminal tool window. It automatically activates the conda environment.
I type jupyter notebook. The notebook server starts and a browser window opens.
I create a notebook in the browser, and execute a cell containing foo = "bar".
In PyCharm, I open another Terminal tool window by clicking the plus sign to the left of the terminal pane.
In the new terminal I type jupyter console --existing, and it starts an ipython console session.
At the prompt I type dir(), and foo is among the results, confirming that I'm attached to the same kernel as the notebook.
I don't know how it picks which kernel to connect to when there are multiple kernels running in the notebook server.
Don't type exit in the iPython session if you plan to continue using the notebook, it shuts down the kernel.
Unfortunately, tools like Debug and "Execute Line/Selection in Console", which are available for the "Python Console" tool window, are not available for the "Terminal" tool window. In fact, because the Terminal tool window is a simple tool, and that's where I've run my commands, this solution isn't very integrated with PyCharm. The terminal opens in the project directory and activates the conda environment, and it's conveniently adjacent to the editors and tools of the IDE, but otherwise there's no connection to PyCharm's tools.
If anyone can successfully attach PyCharm's integrated PyDev debugger to a running kernel, please chime in.
I'm using PyCharm 2016.3 on macOS 10.12.3.
The easiest way for me is just to type %qtconsole in a jupyter notebook cell and run it. A qt console will open already connected to the running kennel. No PyCharm involved.

Cannot start Canopy's IPython from Windows command shell

I have been using EPD for some time and recently started using Canopy. So now I have both EPD and Canopy installed on my machine, which runs Windows 7 Pro x64. But I just realized I cannot launch Canopy's IPython interactive session (located in the directory C:\Users\User\AppData\Local\Enthought\Canopy\User\Scripts) in a Windows command prompt. I already added this directory to my Path before the EPD's python directory.
I checked out those files in the directory .../Canopy/User/Scripts/, I believe that problem is not with the file "ipython-script.py" there, but with the file "ipython.exe", which is what will be run when I simply type "ipython" in a Windows command shell (I set the path already).
In a Windows command shell, if I changed to the directory .../Canopy/User/Scripts/ and type up "python ipython-script.py", then I can correctly start the IPython session in the command shell. So, it looks like that "ipython.exe" does not run the script "ipython-script.py"...
Has anyone run into this same problem? Is there an easy fix?
P.S. I already had the latest Canopy (version 1.0.1.1160) installed.
Thanks for any help.
If you want to launch web interactive then the command
ipython notebook in windows shell or in canopy shell works.