I'm trying to execute a python script(machine learning) via remote server which has good resources. And I'm trying to call remote python code in local environment with Paramiko library. (I send command to remote server, and that remote server will execute that command)
code in local environment is below:
cli = paramiko.SSHClient()
cli.set_missing_host_key_policy(paramiko.AutoAddPolicy)
server = config['ip']
user = 'ubuntu'
pwd = config['pw']
cli.connect(server, username=user, password=pwd)
command="python my_code.py"
stdin, stdout, stderr = cli.exec_command(command)
I send a command to remote server via above code. But, that doesn't work. When the command is basic linux command (ex, ls -al, cd, pwd ...) those work. But the remote server's cell does not recognize other commands like, python ~.py, conda activate, pip install...
My wonder is that, those commands are available when I directly connect to remote server's shell. see below:
I guess the bash that is opened when I directly connect is different from the bash that Paramiko handles. How can I handles this problem? thanks sincerely