0

Searched high and low and have not found an answer to what I thought was a simple/common question:

I am working on a raw Python script in VSCode (.py, not .ipynb). I would like to be able to work on & run this script without an internet connection (specifically on a long plane ride).

How can I do this?

Bonus points if you are able to point me to a solution that lets me use an Interactive kernel (I've been using these for "runs" in my current workflow, so it would be my preference, however I'll take what I can get).

Thanks!!

(This is what I see when I try to run an interactive session with no internet connection. It eventually times out, and I receive the error: Unable to start Kernel 'base (Python 3.10.9)' due to a timeout waiting for the ports to get used. View Jupyter log for further details.)

This is what I see when I try to run an interactive session with no internet connection

3
  • You don't need internet access to run Python code. What's the problem you're running into? Commented Jun 25, 2023 at 15:24
  • 2
    Install the Python interpreter locally from python.org, then tell VSCode to use that. Commented Jun 25, 2023 at 15:25
  • @Carcigenicate appreciate the quick reply, forgot to add the screenshot in the original post to provide some context. Commented Jun 25, 2023 at 15:29

1 Answer 1

1

Executing python scripts (.py) does not require internet unless there is a specific need in your code.

You just need to download the python interpreter and select the correct interpreter in vscode (Ctrl+Shift+P --> Python: Select Interpreter).

Also executing a python script doesn't require a jupyter kernel, it only works when you execute a jupyter file (.ipynb).

Sign up to request clarification or add additional context in comments.

3 Comments

This makes more sense now, thank you! I think that my misunderstanding is because I have been working in the Interactive Python mode in VSCode that is sort of a pseudo notebook with the # %% blocks. I guess my secondary question still remains: can a Jupyter kernel be established and used without an internet connection?
sure. However, when selecting a new environment as the jupyter kernel for the first time, you may need to download and install some necessary packages, which requires networking. It is no longer needed in future use, unless you also need to download and install specific packages. There is detailed documentation here about the python interactive you are using.
Are you able to clarify how this is possible? This is the part I'm effectively still stuck on - initializing a kernel (either in base or conda create myenv) without an active internet connection

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.