How to access remote python kernel using VSCode / Spyder - python-3.x

I have a python installation within a virtual environment on an Ubuntu server 18.04. Within the virtual environment I have installed Spyder and iPython and Jupyter.
My requirement is: I need to open a local installation of VSCode or Spyder on a different computer (Windows / Mac / Linux) and run my codes on the virtual environment on the Ubuntu server.
A guide would be highly appreciated!

(Spyder maintainer here) Please take at our documentation to learn how to connect our console to a remote kernel.

Related

Open3D-ML and pytorch

I’m currently trying to work with open3d ML and Pytorch. I followed the installation guide given in the Open3D-ML github. However when I try to import open3d.ml.torch it sends me the following error : Exception: Open3D was not built with PyTorch support!
I’m working with
python 3.8
open3d 0.12.0
pytorch 1.6.0
cuda 10.1
Windows 10
Do you have any idea of where that error comes from ?
It does not support for Windows at the moment. You can install Ubuntu on WSL (Window Subsystem for Linux) on Windows OS, and install open3d-ml on ubuntu.
Can you check if the output of the following commands on Windows Terminal (or PowerShell) is:
wsl cat /proc/version
Linux version 5.10.16.3-microsoft-standard-WSL2
wsl --list
Ubuntu-20.04 (Standard)
wsl -l -v
Ubuntu-20.04 Running 2
In my experience, Open3D-ML with CUDA only works if you are a Windows Insider, updated the WSL kernel correctly, and you are using Ubuntu in WSL.
Also, check if the folder /usr/lib/wsl/lib exists. If not, then CUDA won't work in WSL.

VSCode remote Python virtual environment

Here is how the thing doesn't work:
The project source code is located on a remote machine. The Python virtual environment is installed in the project's root directory (using venv).
I sshfs the project folder and start local VSCode. It detects the virtual environment, but doesn't see pylint or other packages installed in it.
Python 3.6.7
VS Code - latest version
OSs - Debian 9 remote, Linux Mint 19 local
Both sshfs connection and venv installation are performed under the same account.
Is there some special way a virtual environment should be set up to be usable remotely?
There were problems with sshfs in early VSCode versions, but recent distrib has Remote Development extension that lets you develop your code via ssh.
Since you have activated your virtual environment, just get venv python path with which python command and copy it to the Select Interpreter menu.
Activate your python environment:
source venv/bin/activate
Find which python path you are using:
which python
Usually it is in :
venv/bin/python
Go to the bottom of VS Code, and click on the version number :
Click on Enter interpreter path... :
Enter the path you found above with the which python command.

Remote coding in linux from windows

I have a ubuntu machine in the same network with my windows laptop. I have a Pycharm Community Edition in my windows machine. I want to use the Pycharm in my windows machine to write Python Scripts which I want to run in Python interpreter present in Ubuntu machine. I am having difficulties installing Samba, as a linux newbie. I get the error that says samba.conf not present.Is there any other alternatives?
Don't bother with Samba. You can configure PyCharm to directly upload changed files to a remote server. I.e., when you save locally on your Windows workstation, it can automatically ftp/sftp the file to a pre-configured location on your remote server. See configuration instructions here:
https://www.jetbrains.com/pycharm/help/creating-a-remote-server-configuration.html
I used this when I set up my LAMP machine a few years ago:
https://www.howtoforge.com/ubuntu_debian_lamp_server

cannot execute binary file - CentOS

I am running a virtual CentOS environment using virtual box. I am trying to install and run enthought canopy. But after installation canopy won't run. I simply get
./canopy: line3:/home/Andrew/Canopy/bin/_python: cannot execute binary file
./canopy: line3:/home/Andrew/Canopy/bin/_python: Success
But nothing happens. a GUI should open up.
I am wondering what is causing this error.
It is basically a fresh install of operating system. Only other thing I have done is installed python 2.7. Also I am a novice at using linux-style OS. so I may be missing something very basic

Python Lib to excute remote windows commands from a linux Box without using ssh

This a very basic requirement of our project.
I need to run Windows command from a linux box, without using ssh, as not all the windows boxes have ssh installed by default.
I was searching for some python libs that can do this work?
Links, tutorial, are highly appreciated.
Some alternatives:
http://www.krenger.ch/blog/wmi-commands-from-linux/
http://pypi.python.org/pypi/WMI/ (under wine or a Windows bridge VM)
https://code.google.com/p/impacket/source/browse/trunk/examples/psexec.py

Resources