Giter Site home page Giter Site logo

remocolab's Introduction

remocolab

remocolab is a Python module to allow remote access to Google Colaboratory using SSH or TurboVNC. It also install VirtualGL so that you can run OpenGL programs on a Google Colaboratory machine and see the screen on VNC client. It secures TurboVNC connection using SSH port forwarding.

How to access SSH server running in colab?

ngrok currently doesn't work! ngrok works now

You cannot directory login to the SSH server running on a colab instace. remocolab uses third party service to access it from your PC. You can choose ngrok or Argo Tunnel. You don't need to buy paid plan. Which service works faster can depend on where/when you are.

  • ngrok
    • require that you sign up for an account.
    • You don't need to install specific software on client machine.
    • You need to copy and paste authtoken to colab everytime you run remocolab.
  • Argo Tunnel
    • You don't need to create account. Cloudflare provide free version
    • You need to copy cloudflared on your client PC.
    • You cannot specify argo tunnel server's region. They says the connection uses Argo Smart Routing technology to find the most performant path.

Requirements

If you use ngrok:

  • ngrok Tunnel Authtoken
  • You need to sign up for ngrok to get it

If you use Argo Tunnel:

  • Download cloudflared on your client PC and untar/unzip it.

How to use

  1. (Optional) Generate ssh authentication key
    • By using public key authentication, you can login to ssh server without copy&pasting a password.
    • example command to generate it with ssh-keygen:
    ssh-keygen -t ecdsa -b 521
  2. Create a new notebook on Google Colaboratory
  3. Add a code cell and copy & paste one of following codes to the cell
    • If you use public key authentication, specify content of your public key to public_key argument of remocolab.setupSSHD() or remocolab.setupVNC() like remocolab.setupSSHD(public_key = "ecdsa-sha2-nistp521 AAA...")
    • add tunnel = "ngrok" if you use ngrok.
  • SSH only:
!pip install git+https://github.com/demotomohiro/remocolab.git
import remocolab
remocolab.setupSSHD()
  • SSH and TurboVNC:
!pip install git+https://github.com/demotomohiro/remocolab.git
import remocolab
remocolab.setupVNC()
  1. (Optional) If you want to run OpenGL applications or any programs that use GPU, Click "Runtime" -> "Change runtime type" in top menu and change Hardware accelerator to GPU.
  2. Run that cell
  3. (ngrok only)Then the message that ask you to copy & paste tunnel authtoken of ngrok will appear. Login to ngrok, click Auth on left side menu, click Copy, return to Google Colaboratory, paste it to the text box under the message and push enter key.
    • ngrok token must be kept secret. I understand people hate copy & pasting ngrok token everytime they use remocolab, but I don't know how to skip it without risking a security. If you could specify ngrok token to remocolab.setupSSHD() or remocolab.setupVNC(), you can save ngrok token to a notebook. Then, you might forget that your notebook contains it and share the notebook.
  4. (ngrok only)Select your ngrok region. Select the one closest to your location. For example, if you were in Japan, type jp and push enter key.
    • You can also specify ngrok region to remocolab.setupSSHD() or remocolab.setupVNC() in the code like remocolab.setupSSHD(ngrok_region = "jp").
  5. remocolab setup ngrok and SSH server (and desktop environment and TurboVNC server if you run setupVNC). Please wait for it done
    • remocolab.setupSSHD() takes about 2 minutes
    • remocolab.setupVNC() takes about 5 minutes
  6. Then, root and colab user password and ssh command to connect the server will appear.
  7. Copy & paste that ssh command to your terminal on your local machine and login to the server.
    • use displayed colab user's password if you dont use public key authentication
    • Even if you just want to use TurboVNC, you need to login using SSH to make SSH port forwarding
  • If you use TurboVNC:
  1. Run TurboVNC viewer on your local machine, set server address to localhost:1 and connect.
  2. Then, password will be asked. Copy & paste the VNC password displayed in remocolab.setupVNC()'s output to your TurboVNC viewer.

When you got error and want to rerun remocolab.setupVNC() or remocolab.setupSSHD(), you need to do factory reset runtime before rerun the command. As you can run only 1 ngrok process with free ngrok account, running remocolab.setupVNC/setupSSHD will fail if there is another instace that already ran remocolab. In that case, terminate another instance from Manage sessions screen.

How to run OpenGL applications

Put the command to run the OpenGL application after vglrun. For example, vglrun firefox runs firefox and you can watch web sites using WebGL with hardware acceleration.

How to mount Google Drive

remocolab can allow colab user reading/writing files on Google Drive. If you just mount drive on Google Colaboratory, only root can access it.

Click the folder icon on left side of Google Colaboratory and click mount Drive icon. If you got new code cell that contains python code "from google.colab import ...", create a new notebook, copy your code to it and mount drive same way. On new notebook, you can mount drive without getting such code cell.

  • You can still mount google drive by clicking the given code cell, but it requres getting authorization code and copy&pasting it everytime you run your notebook.
  • If you mount google drive on new notebook, it automatically mount when your notebook connect to the instance.

Add mount_gdrive_to argument with directory name to remocolab.setupSSHD() or remocolab.setupVNC(). For example:

  remocolab.setupSSHD(mount_gdrive_to = "drive")

Then, you can access the content of your drive in /home/colab/drive. You can also mount specific directory on your drive under colab user's home directory. For example:

  remocolab.setupSSHD(mount_gdrive_to = "drive", mount_gdrive_from = "My Drive/somedir")

Arguments of remocolab.setupSSHD() and remocolab.setupVNC()

  • ngrok_region Specify ngrok region like "us", "eu", "ap". List of region. This argument is ignored if you specified tunnel = "argotunnel".
  • check_gpu_available When it is True, it checks whether GPU is available and show warning in case GPU is not available.
  • tunnel Specify which service you use to access ssh server on colab. It must be "ngrok" or "argotunnel". default value is "argotunnel".
  • mount_gdrive_to Specify a directory under colab user's home directory which is used to mount Google Drive. If it was not specified, Google Drive is not mount under colab user's home directory. Specifying it without mounting Google Drive on Google Colaboratory is error.
  • mount_gdrive_from Specify a path of existing directory on your Google Drive which is mounted on the directory specified by mount_gdrive_to. This argument is ignored when mount_gdrive_to was not specified.
  • public_key Specify ssh public key if you want to use public key authentication.

How to setup public key authentication for root login

If you want to login as root, use following code:

!mkdir /root/.ssh
with open("/root/.ssh/authorized_keys", 'w') as f:
  f.write("my public key")
!chmod 700 /root/.ssh
!chmod 600 /root/.ssh/authorized_keys

And replace user name colab in ssh command to root.

Experimental kaggle support

  • As Kaggle stops sesson right after running ssh server, kaggle is no longer supported.

remocolab in kaggle branch works on Kaggle.

  1. Create a new Notebook with Python language.
  2. Set settings to:
    • Internet on
    • Docker to Latest Available
    • GPU on if you use TurboVNC
  3. Add a code cell and copy & paste one of following codes to the cell
  • SSH only:
!pip install git+https://github.com/demotomohiro/remocolab.git@kaggle
import remocolab
remocolab.setupSSHD()
  • SSH and TurboVNC:
!pip install git+https://github.com/demotomohiro/remocolab.git@kaggle
import remocolab
remocolab.setupVNC()
  1. Follow instructions from step 4 in above "How to use".

remocolab's People

Contributors

anon-exploiter avatar demotomohiro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

remocolab's Issues

Getting ssh error

Collecting git+https://github.com/demotomohiro/remocolab.git
Cloning https://github.com/demotomohiro/remocolab.git to /tmp/pip-req-build-rjdhct4h
Running command git clone -q https://github.com/demotomohiro/remocolab.git /tmp/pip-req-build-rjdhct4h
Building wheels for collected packages: remocolab.py
Building wheel for remocolab.py (setup.py) ... done
Created wheel for remocolab.py: filename=remocolab.py-0.1-cp36-none-any.whl size=6283 sha256=d70228dceac82fb367f6adae386d9e0e20ac9f3565cad9148d39233a93477840
Stored in directory: /tmp/pip-ephem-wheel-cache-o7ho3121/wheels/9e/c3/02/22e12a4614e679c5555718bd4d0356e4b7cc1d69a1f3ddb564
Successfully built remocolab.py
Installing collected packages: remocolab.py
Successfully installed remocolab.py-0.1
This is not a runtime with GPU
Do you want to continue? [y/n] y

Copy&paste your tunnel authtoken from https://dashboard.ngrok.com/auth
(You need to sign up for ngrok and login,)
··········
Select your ngrok region:
us - United States (Ohio)
eu - Europe (Frankfurt)
ap - Asia/Pacific (Singapore)
au - Australia (Sydney)
sa - South America (Sao Paulo)
jp - Japan (Tokyo)
in - India (Mumbai)
in
Install openssh-server
Failed to download https://astuteinternet.dl.sourceforge.net/project/libjpeg-turbo/2.0.4/libjpeg-turbo-official_2.0.4_amd64.deb

SSLError Traceback (most recent call last)
/usr/lib/python3.6/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
1324 h.request(req.get_method(), req.selector, req.data, headers,
-> 1325 encode_chunked=req.has_header('Transfer-encoding'))
1326 except OSError as err: # timeout error

19 frames
SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)

During handling of the above exception, another exception occurred:

URLError Traceback (most recent call last)
/usr/lib/python3.6/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
1325 encode_chunked=req.has_header('Transfer-encoding'))
1326 except OSError as err: # timeout error
-> 1327 raise URLError(err)
1328 r = h.getresponse()
1329 except:

URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)>

Colab TurboVNC root session.

When I'm using turboVNC, we can only login using our colab account. Can we login using our root account so that we have two simultaneous online turbo VNC sessions?

AttributeError: module 'remocolab' has no attribute 'setupSSHDImpl'

I generated a key using this command - ssh-keygen -t ecdsa -b 521
Copied the code from here
cat .ssh/id_ecdsa.pub
Then i tried to setup it up along with my ngrok authtoken and region as india , but it is giving error

!pip install git+https://github.com/demotomohiro/remocolab.git
import remocolab
remocolab.setupSSHDImpl("in", "my_publickey", "authtoken")

Error :

AttributeError                            Traceback (most recent call last)
<ipython-input-3-7e6c1d342a81> in <module>()
      1 get_ipython().system('pip install git+https://github.com/demotomohiro/remocolab.git')
      2 import remocolab
----> 3 remocolab.setupSSHDImpl("in", "ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBACPCV7VXkMQ/v5TS7JeE4e7ZyQPnxdHzu0200XK2oGhQ8sD57ZtNEgnB1oWTWi4FKhr40wYwsPKootp0zRqZ9JzyAAalA/BecdkzZhuz1rltqeJP0I7erFulyX+MCjJSTpi8kks1PcD/iVZUyYipiF9WLk5b6NbOjUSVXHGUT/Wi/q99A== xd003@localhost", "1c47NiImPdrt8yyCn#################################")

AttributeError: module 'remocolab' has no attribute 'setupSSHDImpl'                                                                   

Supporting Baidu AI studio

Baidu provide Tesla v100 gpus for free for at least 12 hours a day while Google only give us Tesla k80. But we need to use natcpp or other ngrok alternatives because ngrok.io is unstable in China.

[email protected]: Permission denied (publickey,password).

Hi,
I have used remocolab a couple of weeks back. I was successfully connected to VM instance using VNC.
I am trying to replicate the same scenario, however, I am not successful this time. I could not successfully execute 9th step of "README.md".
When I copy pasted (cntr+v) the password in command-prompt, it is giving following error after 3 failed attempts:
'[email protected]: Permission denied (publickey,password).'

Any help would be appreciated. Thank you!

[Feature Request]Azure Notebooks Preview Support with Junest Environment

Microsoft Azure Notebooks supports Linux namespace feature (nc) which google colab DOES NOT. We can install junest environment https://github.com/fsquillace/junest and use millions of newest software from Arch Linux User Repositories faster by using yaourt or yay or Pacman. Azure Notebooks are not blocked by the Chinese firewall in china thus it is much easier to use than google colab. @demotomohiro

If we install junest in google colab, it will fail like this:

bwrap: pivot_root: Operation not permitted
Error: Something went wrong while executing bwrap command. Exiting

But on the azure notebook, junest runs perfectly normal.

Free Azure Notebook also runs more stable than google colab since they don't disconnect you after 1 hour of inactivity on the webpage and can guarantee to run for at least 8 hours.

The other thing is that you can get a web shell access which google colab is unable to provide.

But the downside is that the bandwidth and memory are far more restricted than google colab.

Please implement this feature, and another thing is that when we are working in azure notebooks, everything in ~/library directory is under rotational hard drive but the home directory is under Solid States Drive. We should install the ngrok and junest under the home directory for the best performance.

@demotomohiro

Cannot assign requested address

--------------------------------------------------------------------------`
OSError                                   Traceback (most recent call last)
/usr/lib/python3.6/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
   1317                 h.request(req.get_method(), req.selector, req.data, headers,
-> 1318                           encode_chunked=req.has_header('Transfer-encoding'))
   1319             except OSError as err: # timeout error

17 frames
/usr/lib/python3.6/http/client.py in request(self, method, url, body, headers, encode_chunked)
   1253         """Send a complete request to the server."""
-> 1254         self._send_request(method, url, body, headers, encode_chunked)
   1255 

/usr/lib/python3.6/http/client.py in _send_request(self, method, url, body, headers, encode_chunked)
   1299             body = _encode(body, 'body')
-> 1300         self.endheaders(body, encode_chunked=encode_chunked)
   1301 

/usr/lib/python3.6/http/client.py in endheaders(self, message_body, encode_chunked)
   1248             raise CannotSendHeader()
-> 1249         self._send_output(message_body, encode_chunked=encode_chunked)
   1250 

/usr/lib/python3.6/http/client.py in _send_output(self, message_body, encode_chunked)
   1035         del self._buffer[:]
-> 1036         self.send(msg)
   1037 

/usr/lib/python3.6/http/client.py in send(self, data)
    973             if self.auto_open:
--> 974                 self.connect()
    975             else:

/usr/lib/python3.6/http/client.py in connect(self)
    945         self.sock = self._create_connection(
--> 946             (self.host,self.port), self.timeout, self.source_address)
    947         self.sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)

/usr/lib/python3.6/socket.py in create_connection(address, timeout, source_address)
    723     if err is not None:
--> 724         raise err
    725     else:

/usr/lib/python3.6/socket.py in create_connection(address, timeout, source_address)
    712                 sock.bind(source_address)
--> 713             sock.connect(sa)
    714             # Break explicitly a reference cycle

OSError: [Errno 99] Cannot assign requested address

During handling of the above exception, another exception occurred:

URLError                                  Traceback (most recent call last)
<ipython-input-6-eb8e07eb1066> in <module>()
      1 get_ipython().system('pip install git+http://github.com/rayanfer32/remocolab.git')
      2 import remocolab
----> 3 remocolab.setupVNC()

/usr/local/lib/python3.6/dist-packages/remocolab.py in setupVNC(ngrok_region)
    265 
    266 def setupVNC(ngrok_region = None):
--> 267   if setupSSHD(ngrok_region, True):
    268     _setupVNC()

/usr/local/lib/python3.6/dist-packages/remocolab.py in setupSSHD(ngrok_region, check_gpu_available)
    138     ngrok_region = region = input()
    139 
--> 140   _setupSSHDImpl(ngrok_token, ngrok_region)
    141   return True
    142 

/usr/local/lib/python3.6/dist-packages/remocolab.py in _setupSSHDImpl(ngrok_token, ngrok_region)
     98   time.sleep(2)
     99 
--> 100   with urllib.request.urlopen("http://localhost:4040/api/tunnels") as response:
    101     url = json.load(response)['tunnels'][0]['public_url']
    102     m = re.match("tcp://(.+):(\d+)", url)

/usr/lib/python3.6/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
    221     else:
    222         opener = _opener
--> 223     return opener.open(url, data, timeout)
    224 
    225 def install_opener(opener):

/usr/lib/python3.6/urllib/request.py in open(self, fullurl, data, timeout)
    524             req = meth(req)
    525 
--> 526         response = self._open(req, data)
    527 
    528         # post-process response

/usr/lib/python3.6/urllib/request.py in _open(self, req, data)
    542         protocol = req.type
    543         result = self._call_chain(self.handle_open, protocol, protocol +
--> 544                                   '_open', req)
    545         if result:
    546             return result

/usr/lib/python3.6/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
    502         for handler in handlers:
    503             func = getattr(handler, meth_name)
--> 504             result = func(*args)
    505             if result is not None:
    506                 return result

/usr/lib/python3.6/urllib/request.py in http_open(self, req)
   1344 
   1345     def http_open(self, req):
-> 1346         return self.do_open(http.client.HTTPConnection, req)
   1347 
   1348     http_request = AbstractHTTPHandler.do_request_

/usr/lib/python3.6/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
   1318                           encode_chunked=req.has_header('Transfer-encoding'))
   1319             except OSError as err: # timeout error
-> 1320                 raise URLError(err)
   1321             r = h.getresponse()
   1322         except:

URLError: <urlopen error [Errno 99] Cannot assign requested address>
`

Urls for packages are now not proper

File: https://svwh.dl.sourceforge.net/project/libjpeg-turbo/2.0.3/libjpeg-turbo-official_2.0.3_amd64.deb can not be downloaded
File: https://svwh.dl.sourceforge.net/project/virtualgl/2.6.2/virtualgl_2.6.2_amd64.deb can not be downloaded
File: https://svwh.dl.sourceforge.net/project/turbovnc/2.2.3/turbovnc_2.2.3_amd64.deb can not be downloaded

Additionally please add try except in

def _download(url, path):
try:
with urllib.request.urlopen(url) as response:
with open(path, 'wb') as outfile:
shutil.copyfileobj(response, outfile)
except:
pass
print('File:',url,' can not be downloaded')

Cannot create a session

I am trying to connect a vnc view with a non gpu runtime, and I am getting this error:

---------------------------------------------------------------------------
CalledProcessError                        Traceback (most recent call last)
<ipython-input-4-28a0dc8c2d39> in <module>()
      1 get_ipython().system('pip install git+https://github.com/demotomohiro/remocolab.git')
      2 import remocolab
----> 3 remocolab.setupVNC()

2 frames
/usr/local/lib/python3.6/dist-packages/remocolab.py in setupVNC(ngrok_region)
    269 def setupVNC(ngrok_region = None):
    270   if setupSSHD(ngrok_region, True):
--> 271     _setupVNC()

/usr/local/lib/python3.6/dist-packages/remocolab.py in _setupVNC()
    264                     check = True,
    265                     stdout = subprocess.PIPE,
--> 266                     universal_newlines = True)
    267   print(r.stdout)
    268 

/usr/lib/python3.6/subprocess.py in run(input, timeout, check, *popenargs, **kwargs)
    436         if check and retcode:
    437             raise CalledProcessError(retcode, process.args,
--> 438                                      output=stdout, stderr=stderr)
    439     return CompletedProcess(process.args, retcode, stdout, stderr)
    440 

CalledProcessError: Command '['su', '-c', 'python3 vncrun.py', 'colab']' returned non-zero exit status 2.

Please let me know if I am doing something wrong!

New 2nd connection

May I know what I would need to change to start multiple connections to VNC?
Example: I started two colabs, both ran remocolab.
The first can be connected to VNC through localhost:1
While the second cannot.

(Where can we change the server address parameter?)

Thanks

Fetch error

Hi ! Got error when trying to lauch VNC with GPU:

Warning! GPU of your assigned virtual machine is Tesla K80.

Error triggered when it was at:

fetch: libnvidia-decode-450

Traceback :

FetchFailedException                      Traceback (most recent call last)

<ipython-input-4-0266415ad402> in <module>()
----> 1 remocolab.setupVNC()

6 frames

/usr/lib/python3/dist-packages/apt/cache.py in _run_fetcher(self, fetcher, allow_unauthenticated)
    448             raise FetchCancelledException(err_msg)
    449         elif failed:
--> 450             raise FetchFailedException(err_msg)
    451         return res
    452 

FetchFailedException: Failed to fetch http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu/pool/main/n/nvidia-graphics-drivers-450/libnvidia-compute-450_450.66-0ubuntu0~0.18.04.2_amd64.deb Could not connect to ppa.launchpad.net:80 (91.189.95.83), connection timed out [IP: 91.189.95.83 80]
Failed to fetch http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu/pool/main/n/nvidia-graphics-drivers-450/libnvidia-encode-450_450.66-0ubuntu0~0.18.04.2_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.83 80]
Failed to fetch http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu/pool/main/n/nvidia-graphics-drivers-450/libnvidia-fbc1-450_450.66-0ubuntu0~0.18.04.2_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.83 80]
Failed to fetch http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu/pool/main/n/nvidia-graphics-drivers-450/libnvidia-gl-450_450.66-0ubuntu0~0.18.04.2_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.83 80]
Failed to fetch http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu/pool/main/n/nvidia-graphics-drivers-450/libnvidia-ifr1-450_450.66-0ubuntu0~0.18.04.2_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.83 80]
Failed to fetch http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu/pool/main/n/nvidia-graphics-drivers-450/nvidia-compute-utils-450_450.66-0ubuntu0~0.18.04.2_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.83 80]
Failed to fetch http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu/pool/main/n/nvidia-graphics-drivers-450/nvidia-utils-450_450.66-0ubuntu0~0.18.04.2_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.83 80]
Failed to fetch http://ppa.launchpad.net/marutter/c2d4u3.5/ubuntu/pool/main/b/backports/r-cran-backports_1.1.9-1cran1.1804.0_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.83 80]
Failed to fetch http://ppa.launchpad.net/marutter/c2d4u3.5/ubuntu/pool/main/m/mgcv/r-cran-mgcv_1.8-33-1cran1.1804.0_amd64.deb Unable to connect to ppa.launchpad.net:http: [IP: 91.189.95.83 80] 

Error while running Carla on Colab

Hi,
I am getting the following error while running Carla on Colab. Could you please help me with this?

RuntimeError Traceback (most recent call last)
in ()
1 import remocolab
----> 2 remocolab.setupVNC()

2 frames
/usr/local/lib/python3.6/dist-packages/remocolab.py in _setupSSHDImpl(ngrok_token, ngrok_region)
100 time.sleep(2)
101 if ngrok_proc.poll() != None:
--> 102 raise RuntimeError("Failed to run ngrok. Return code:" + str(ngrok_proc.returncode) + "\nSee runtime log for more info.")
103
104 with urllib.request.urlopen("http://localhost:4040/api/tunnels") as response:

Lag while using vnc

I am facing lag while moving this setup. Internet speed is about 300Mbps, laptop description: Ubuntu 18.04. 8GB ram, intel core i5 8th gen.

Any suggestions to speed this up?

Command error

255 def setupVNC(ngrok_region = None):
    256   if setupSSHD(ngrok_region, True):
--> 257     _setupVNC()
    258 
    259 if __name__== "__main__":

/usr/local/lib/python3.6/dist-packages/vnc.py in _setupVNC()
    177   _download(nvidia_url, "nvidia.run")
    178   pathlib.Path("nvidia.run").chmod(stat.S_IXUSR)
--> 179   subprocess.run(["./nvidia.run", "--no-kernel-module", "--ui=none"], input = "1\n", check = True, universal_newlines = True)
    180 
    181   #https://virtualgl.org/Documentation/HeadlessNV

/usr/lib/python3.6/subprocess.py in run(input, timeout, check, *popenargs, **kwargs)
    436         if check and retcode:
    437             raise CalledProcessError(retcode, process.args,
--> 438                                      output=stdout, stderr=stderr)
    439     return CompletedProcess(process.args, retcode, stdout, stderr)
    440 

CalledProcessError: Command '['./nvidia.run', '--no-kernel-module', '--ui=none']' returned non-zero exit status 1.

i usually get this error

OSError Traceback (most recent call last)
in ()
1 import remocolab
----> 2 remocolab.setupVNC()

4 frames
/usr/local/lib/python3.6/dist-packages/remocolab.py in setupVNC(ngrok_region, check_gpu_available)
273
274 def setupVNC(ngrok_region = None, check_gpu_available = True):
--> 275 stat, msg = _setupSSHDMain(ngrok_region, check_gpu_available)
276 if stat:
277 msg += _setupVNC()

/usr/local/lib/python3.6/dist-packages/remocolab.py in _setupSSHDMain(ngrok_region, check_gpu_available)
143 ngrok_region = region = input()
144
--> 145 return (True, _setupSSHDImpl(ngrok_token, ngrok_region))
146
147 def setupSSHD(ngrok_region = None, check_gpu_available = False):

/usr/local/lib/python3.6/dist-packages/remocolab.py in _setupSSHDImpl(ngrok_token, ngrok_region)
78
79 _download("https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip", "ngrok.zip")
---> 80 shutil.unpack_archive("ngrok.zip")
81 pathlib.Path("ngrok").chmod(stat.S_IXUSR)
82

/usr/lib/python3.6/shutil.py in unpack_archive(filename, extract_dir, format)
981 func = _UNPACK_FORMATS[format][1]
982 kwargs = dict(_UNPACK_FORMATS[format][2])
--> 983 func(filename, extract_dir, **kwargs)
984
985

/usr/lib/python3.6/shutil.py in _unpack_zipfile(filename, extract_dir)
900 # file
901 data = zip.read(info.filename)
--> 902 f = open(target, 'wb')
903 try:
904 f.write(data)

OSError: [Errno 26] Text file busy: '/content/ngrok'

Simple instructions for non programmers..

Hi,i really want to try this but i am not able to understand what to do after the vnc password is generated on collab ..i am a non programmer and simple instructions to make this work will helpful.I am using windows 7 OS..Can you help me ? Thanks in advance..
I understand that you are going through trouble for our sake and i am grateful to you for that :-)

Error when running colab.

openssh-server is already installed

TypeError Traceback (most recent call last)
in ()
10 get_ipython().system('pip install git+https://github.com/demotomohiro/remocolab.git')
11 import remocolab
---> 12 remocolab.setupVNC(ngrok_region="us", check_gpu_available=False)
13
14

5 frames
/usr/lib/python3.6/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session)
1293 errread, errwrite,
1294 errpipe_read, errpipe_write,
-> 1295 restore_signals, start_new_session, preexec_fn)
1296 self._child_created = True
1297 finally:

TypeError: expected str, bytes or os.PathLike object, not dict

Permission issues

How do I get all the root permissions while using the vnc? Or at least permissions in some directories.

Help regarding setting up ssh keys for github

First i generated a ssh key par
ssh-keygen -t rsa -C "my_email"
And added the public key in my GitHub , now locallly ssh authentication works pretty well so i copied all text from both of ssh keys to add in google colab
Then i run this in google Colab

!pip install git+https://github.com/demotomohiro/remocolab.git
import remocolab
remocolab.setupSSHD(ngrok_region = "in")

!mkdir /root/.ssh
with open("/root/.ssh/authorized_keys", 'w') as f:
  f.write("my public key")
with open("/root/.ssh/id_rsa.pub", 'w') as f:
  f.write("my public key")
with open("/root/.ssh/id_rsa", 'w') as f:
  f.write("my private key")

!chmod 700 /root/.ssh
!chmod 600 /root/.ssh/authorized_keys
!chmod 600 /root/.ssh/id_rsa
!chmod 600 /root/.ssh/id_rsa.pub

I am able to login using ssh client mean authorized keys getting detected properly but ssh authentication for github is not working and i am getting following error

root@InstanceIDInHexa:~# ssh -T [email protected]                                 

The authenticity of host 'github.com (xxx.xxx.xxx.xxx)' can't be established.
RSA key fingerprint is SHA256:RandomStringOfAlphaNumericCharacters.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,xxx.xxx.xxx.xxx' (RSA) to the list of known hosts.
Load key "/root/.ssh/id_rsa": invalid format
[email protected]: Permission denied (publickey).
root@InstanceIDInHexa:~#

Please suggest a fix @demotomohiro

[Feature Request]Show installation process while `setupSSHD()`

The current script shows nothing while installing tubovnc, ngrok, and many other dependencies. We developers don't know whether it gets stucks or anything goes wrong in the background and can only wait for a long time every morning. Please do consider to make the installation process log transparent to users.

Cannot run software from gdrive directly

Running Firefox as root in a regular user's session is not supported.
gdrive cannot be accessed unless sudo

if i login as root in terminal and excute/run apps as
firefox

i get
ERROR :"cannot open display” error

`

Unable to enable ssh port forwarding

As mentioned in readme , i first connect to ssh , then enter the colab password ,ssh connects well

Now i run the vnc command inside colab ssh , it immediately gives me the following error ..

[email protected]'s password: 
bind: Cannot assign requested address
channel_setup_fwd_listener_tcpip: cannot listen to port: 5901
Could not request local forwarding.

please fix this issue

[error]FetchFailedException: E:The repository 'https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Release' no longer has a Release file.

/usr/local/lib/python3.6/dist-packages/remocolab.py in setupVNC(ngrok_region)

/usr/local/lib/python3.6/dist-packages/remocolab.py in setupSSHD(ngrok_region, check_gpu_available)

/usr/local/lib/python3.6/dist-packages/remocolab.py in _setupSSHDImpl(ngrok_token, ngrok_region)

/usr/lib/python3/dist-packages/apt/cache.py in update(self, fetch_progress, pulse_interval, raise_on_error, sources_list)
584 pulse_interval)
585 except SystemError as e:
--> 586 raise FetchFailedException(e)
587 if not res and raise_on_error:
588 raise FetchFailedException()

FetchFailedException: E:The repository 'https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ Release' no longer has a Release file.

Unable to start SSH Server for Google Colab

i am getting the following error

Copy&paste your tunnel authtoken from https://dashboard.ngrok.com/auth
(You need to sign up for ngrok and login,)
··········
Select your ngrok region:
us - United States (Ohio)
eu - Europe (Frankfurt)
ap - Asia/Pacific (Singapore)
au - Australia (Sydney)
sa - South America (Sao Paulo)
jp - Japan (Tokyo)
in - India (Mumbai)
India
Install openssh-server
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-2-cf1739e17346> in <module>()
      1 get_ipython().system('pip install git+https://github.com/demotomohiro/remocolab.git')
      2 import remocolab
----> 3 remocolab.setupSSHD()
/usr/local/lib/python3.6/dist-packages/remocolab.py in setupSSHD(ngrok_region, check_gpu_available
  146 
    147 def setupSSHD(ngrok_region = None, check_gpu_available = False):
--> 148   s, msg = _setupSSHDMain(ngrok_region, check_gpu_available)
    149   print(msg)
    150 

/usr/local/lib/python3.6/dist-packages/remocolab.py in _setupSSHDMain(ngrok_region, check_gpu_available)
    143     ngrok_region = region = input()
    144 
--> 145   return (True, _setupSSHDImpl(ngrok_token, ngrok_region))
    146 
    147 def setupSSHD(ngrok_region = None, check_gpu_available = False):

/usr/local/lib/python3.6/dist-packages/remocolab.py in _setupSSHDImpl(ngrok_token, ngrok_region)
    100   time.sleep(2)
    101   if ngrok_proc.poll() != None:
--> 102     raise RuntimeError("Failed to run ngrok. Return code:" + str(ngrok_proc.returncode) + "\nSee runtime log for more info.")
    103 
    104   with urllib.request.urlopen("http://localhost:4040/api/tunnels") as response:

SSH

How to use this with something like serveo or sish?

Password are way lengthy

on windows thhere is no ssh client ... i use git bash ..... problem is when i copy the pass some formatting is done ... it fails most of the time ... plz reduce the password size if possible ... thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.