I create new ec2 for jupyter server and i'm running jupyter lab with back-ground so i can access jupyter lab in browser.
However, i want to edit my ipynb file in vscode but in vscode i can connect jupyter server but i can't see directories or read files in ec2. I tried over and over to connect the server and see the directories. The only solution I got was remote ssh. however, Remote-shh is not a good way for jobs in ec2
Is anybody can give me an answer?
I can only see the connection with vscode and i cannot see any files plz help me
remote ssh is the standard approach. you would need to SSH to your EC2 from vscode, then you can browse and run notebooks.
In vscode, go to extensions and install "Remote - SSH" & "Remote - SSH: Editing Configuration Files"
Open command palette (cmd/ctrl + shift + P) and type "show remote explorer"
Add new ssh target by editing ~/.ssh/config. should look like:
Host SOME-NAME
HostName YOUR-EC2-PUBLIC-IP
User YOUR-EC2-USER
IdentityFile PATH-TO-EC2-PEM-FILE
you can connect to your EC2 through vscode. you can then open .ipynb files (assuming you have required extensions. e.g: jupyter, IPython kernel) as well as having files explorer.
this question is old, but still worth answering it. to edit your files in remote VSCode:
in remote connected vscode go to terminal > new terminal, this will open an "ec2 instance" terminal.
while there, cd to the folder you want to work on it.
call the command "code ." this will open all the files in that folder, and you can edit or run them.
Related
I can connect to a remote Jupyter Notebook server with a token from VSCode through the "Python: Specify Jupyter server URI" command from the Command Palette.
However, I couldn't find a way to do this:
Access the remote server's terminal to run command-line Python code. Using the ! magic in cells itself is not useful as the command line code is interactive.
Is there a way to do this?
A little late and not sure if it's the answer you were looking for, but I personally prefer to access remote server's terminal from Windows Terminal, you can set a profile for your server as shown here SSH in Windows Terminal
You can mix this with the extension Windows Terminal Integration for vscode
When I start a jupyter notebook, I am able to start a terminal prompt running on the host machine with "New > Terminal".
Is it possible to connect to this terminal with, for instance, iTerm, instead of using the web interface?
How does jupyter connect to the remote terminal?
Note: I am using a remote Jupyter notebook with several port forwarding. I am not able to directly open a terminal onto this machine.
I have an aws ec2 instance to which I want to access and work via pycharm but I cannot correctly configure access to the remote terminal.
The steps I do are these:
using github and pycharm I clone the project repository and at the start of the program, since there is no configured python interpreter I start the configuration by clicking on the button "configure python interpreter"
then select ssh interpreter and enter the ip address of the aws instance and username ubuntu
3) as key I choose a previously saved ppk file
4)continuing with the settings I select the interpreter like the one identified in the path usr/bin/python and as the project directory I select the directory of my project in home/ubuntu/MyProject
this is what i see after setting up the remote interpreter
all connection tests are passed successfully but when I run the code I get this error
Error running 'main': Can't run remote python interpreter: Error connecting to remote host
So how can I solve this problem?
finally I found a solution, by default pycharm set the path for the interpreter usr/bin/python but the correct one is usr/bin/python3, now everything works correctly
I had the same error with a different cause:
One of the docker volume bindings in the Run Configuration pointed to a non-existing host dir
I can connect to a remote Jupyter Notebook server with a token from VSCode through the "Python: Specify Jupyter server URI" command from the Command Palette.
However, I didn't find a way to do 2 things:
Open an existing Notebook on the remote Jupyter Notebook server.
Specify a folder to connect to, where my existing notebook resides in the remote server.
Is there a way of doing it?
Currently, VSCode doesn't support this functionality. See this issue: https://github.com/microsoft/vscode-python/issues/8161
I have the following situation.
I want to write python code in my Laptop that will take more than 24 hours to run.I am using UBUNTU 12.04 lts.
Is it possible so that I write python code in my laptop, automatically send it to some remote desktop, run there and send the output result to my laptop when done?
one way suggested to me is to use openssh.
But I want to do this in the following way----
Write and Debug Python Code in my laptop.(Solved)
email the code as attachment to ****#gmail.com(Solved)
Other python program in the desktop will automatically download and run the source code(Unsolved)
and email the output file back to my gmail id.(Solved)
what is the python code to download the attachment from the latest email from a specific gmail folder?
If your remote system is windows, a good option would be to use PsExec from SysInternals.
Ex. If your script is long_running.py a typical usage would be
PsExec \\remote-server -c long_running.py
If your remote system is *nix, and your local system is Windows, you can use ssh for remote execution via Plink (part of PuTTY).
plink remote-server#user -m long_running.py
Finally if both remote and local machine are *nix systems, you can simply use ssh
ssh remote-server#user 'bash -s' < long_running.py
Note This is just some possible options, but the idea is remote execution is possible either via ssh or a similar option (like PsExec) for Windows
If both systems are running *nix, you can easily do all your dev work and debugging locally, while still executing remotely:
One time set up:
Mount a folder from the remote box locally
On your laptop, save your project/script to that (now local) folder, or set the mounted folder as your project's save path in your IDE.
Publishing:
Do work
Click the save button
Executing:
SSH into the remote box and open a new screen
Navigate to the folder you'd previously mounted, and run your script.
You can then safely detach and close ssh if necessary (ctrl+a d), and re-attach later:
3a. screen -ls (to find the screen name)
3b. screen -x screen_name
The advantage of this solution is that if you've got an ongoing project requiring frequent edits/changes, you can do all your dev work/debugging locally, and the only work required to "publish" is clicking the save button, starting the screen, and running.