Unable to run python script in Jupyter Notebook

How are you accessing Jupyter? Did you install it on your machine? Is it running on a remote system?

That is interesting, but what exactly happens in detail? How do you specify what to open? Does it open a window to do that? Is that window on your system like any other program or in the browser? Consider if that would be compatible with use in Jupyter, which granted may be difficult for you as you say you are new to both Python and to Jupyter. Based on the limited details you are you are sharing, it looks like the code you are trying to work with is not set up to be compatible with running in a Jupyter setting by default. (I see tkinter and Tk which tells me it is using older ways to run a graphical user interface (GUI) on a machine. A system that long predates Jupyter and works in very different ways.) Or at least the way you are triggering it to run in Jupyter which you provide no details about? (Are you using %run magic? Importing?) You show only trying to run it in what I assume is the associated terminal of the session.

Jupyter and Python are not synonymous. Jupyter can run a lot of other languages. All of them, including Python, do it through a language based kernel that communicates with Jupyter running in the browser. The way it runs things has to be compatible with this situation. And if you are running where Jupyter is installed in a remote machine on a full server or virtual remote machine, the situation is even more complex to consider.

You can think of Jupyter as an Integrated Development Environment (IDE) of sorts. In general it runs in your browser and so has limitations of what it can access imposed by browser workings & security concerns. For example, you wouldn’t want sites on the internet to be able to launch things and access your devices and files, right? And if you are running this Jupyter session remotely, those restrictions are even more important. Because if it is a remote server, it may not have access to a display device at all.

Contrast that with Anaconda PowerShell situation which I think is running as a program in your computer with full permissions to access your system and open windows and run devices, like display stuff in your system? It isn’t restricted by going through your browser I suspect?


Please read Getting good answers to your questions. I especially like the section in [the last link]( How do I ask a good question? ) with the heading ‘Help others reproduce the problem’.

If you need more specifics, compare what that says with what you have provided and reply with more information or a link or the code and/or link to it

1 Like