Colabtools: Colab not connecting to drive anymore

Created on 23 Sep 2018  路  9Comments  路  Source: googlecolab/colabtools

Just today I find that I can't connect my drive to google colab.
It worked fine this morning and I don't think I did anything special since my last run.

This code does not work anymore (gives error I copied further below):

  from google.colab import drive
  drive.mount('/content/temp_drive')
ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.

ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pexpect/expect.py", line 111, in expect_loop
    incoming = spawn.read_nonblocking(spawn.maxread, timeout)
  File "/usr/local/lib/python3.6/dist-packages/pexpect/pty_spawn.py", line 482, in read_nonblocking
    raise TIMEOUT('Timeout exceeded.')
pexpect.exceptions.TIMEOUT: Timeout exceeded.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py", line 2882, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-16-404dcb9fb3bb>", line 2, in <module>
    drive.mount('/content/temp_drive')
  File "/usr/local/lib/python3.6/dist-packages/google/colab/drive.py", line 101, in mount
    re.compile(u'(Go to this URL in a browser: https://.*)\r\n')])
  File "/usr/local/lib/python3.6/dist-packages/pexpect/spawnbase.py", line 341, in expect
    timeout, searchwindowsize, async_)
  File "/usr/local/lib/python3.6/dist-packages/pexpect/spawnbase.py", line 369, in expect_list
    return exp.expect_loop(timeout)
  File "/usr/local/lib/python3.6/dist-packages/pexpect/expect.py", line 119, in expect_loop
    return self.timeout(e)
  File "/usr/local/lib/python3.6/dist-packages/pexpect/expect.py", line 82, in timeout
    raise TIMEOUT(msg)
pexpect.exceptions.TIMEOUT: Timeout exceeded.
<pexpect.pty_spawn.spawn object at 0x7f252cb9cc88>
command: /bin/bash
args: [b'/bin/bash', b'--noediting']
buffer (last 100 chars): 'ZI [89734080] ui.cc:76:DisplayNotification Drive File Stream encountered a problem and has stopped\r\n'
before (last 100 chars): 'ZI [89734080] ui.cc:76:DisplayNotification Drive File Stream encountered a problem and has stopped\r\n'
after: <class 'pexpect.exceptions.TIMEOUT'>
match: None
match_index: None
exitstatus: None
flag_eof: False
pid: 4272
child_fd: 161
closed: False
timeout: 120
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 1000000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
    0: re.compile('google.colab.drive MOUNTED')
    1: re.compile('root@78ff53926754-b15ec395f82e44f5ae21f286e63fcd59: ')
    2: re.compile('(Go to this URL in a browser: https://.*)\r\n')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py", line 1823, in showtraceback
    stb = value._render_traceback_()
AttributeError: 'TIMEOUT' object has no attribute '_render_traceback_'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/IPython/core/ultratb.py", line 1132, in get_records
    return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
  File "/usr/local/lib/python3.6/dist-packages/IPython/core/ultratb.py", line 313, in wrapped
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/IPython/core/ultratb.py", line 358, in _fixed_getinnerframes
    records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
  File "/usr/lib/python3.6/inspect.py", line 1480, in getinnerframes
    frameinfo = (tb.tb_frame,) + getframeinfo(tb, context)
  File "/usr/lib/python3.6/inspect.py", line 1438, in getframeinfo
    filename = getsourcefile(frame) or getfile(frame)
  File "/usr/lib/python3.6/inspect.py", line 693, in getsourcefile
    if getattr(getmodule(object, filename), '__loader__', None) is not None:
  File "/usr/lib/python3.6/inspect.py", line 730, in getmodule
    if ismodule(module) and hasattr(module, '__file__'):
  File "/usr/local/lib/python3.6/dist-packages/IPython/utils/shimmodule.py", line 90, in __getattr__
    return import_item(name)
  File "/usr/local/lib/python3.6/dist-packages/IPython/utils/importstring.py", line 31, in import_item
    module = __import__(package, fromlist=[obj])
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 951, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 894, in _find_spec
  File "<frozen importlib._bootstrap_external>", line 1157, in find_spec
  File "<frozen importlib._bootstrap_external>", line 1129, in _get_spec
  File "<frozen importlib._bootstrap_external>", line 1245, in find_spec
  File "<frozen importlib._bootstrap_external>", line 1285, in _fill_cache
OSError: [Errno 107] Transport endpoint is not connected: '/content/temp_drive/My Drive/Work'
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pexpect/expect.py", line 111, in expect_loop
    incoming = spawn.read_nonblocking(spawn.maxread, timeout)
  File "/usr/local/lib/python3.6/dist-packages/pexpect/pty_spawn.py", line 482, in read_nonblocking
    raise TIMEOUT('Timeout exceeded.')
pexpect.exceptions.TIMEOUT: Timeout exceeded.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py", line 2882, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-16-404dcb9fb3bb>", line 2, in <module>
    drive.mount('/content/temp_drive')
  File "/usr/local/lib/python3.6/dist-packages/google/colab/drive.py", line 101, in mount
    re.compile(u'(Go to this URL in a browser: https://.*)\r\n')])
  File "/usr/local/lib/python3.6/dist-packages/pexpect/spawnbase.py", line 341, in expect
    timeout, searchwindowsize, async_)
  File "/usr/local/lib/python3.6/dist-packages/pexpect/spawnbase.py", line 369, in expect_list
    return exp.expect_loop(timeout)
  File "/usr/local/lib/python3.6/dist-packages/pexpect/expect.py", line 119, in expect_loop
    return self.timeout(e)
  File "/usr/local/lib/python3.6/dist-packages/pexpect/expect.py", line 82, in timeout
    raise TIMEOUT(msg)
pexpect.exceptions.TIMEOUT: Timeout exceeded.
<pexpect.pty_spawn.spawn object at 0x7f252cb9cc88>
command: /bin/bash
args: [b'/bin/bash', b'--noediting']
buffer (last 100 chars): 'ZI [89734080] ui.cc:76:DisplayNotification Drive File Stream encountered a problem and has stopped\r\n'
before (last 100 chars): 'ZI [89734080] ui.cc:76:DisplayNotification Drive File Stream encountered a problem and has stopped\r\n'
after: <class 'pexpect.exceptions.TIMEOUT'>
match: None
match_index: None
exitstatus: None
flag_eof: False
pid: 4272
child_fd: 161
closed: False
timeout: 120
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 1000000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
    0: re.compile('google.colab.drive MOUNTED')
    1: re.compile('root@78ff53926754-b15ec395f82e44f5ae21f286e63fcd59: ')
    2: re.compile('(Go to this URL in a browser: https://.*)\r\n')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py", line 1823, in showtraceback
    stb = value._render_traceback_()
AttributeError: 'TIMEOUT' object has no attribute '_render_traceback_'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py", line 2828, in run_ast_nodes
    if self.run_code(code, result):
  File "/usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py", line 2899, in run_code
    self.showtraceback()
  File "/usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py", line 1826, in showtraceback
    value, tb, tb_offset=tb_offset)
  File "/usr/local/lib/python3.6/dist-packages/IPython/core/ultratb.py", line 1411, in structured_traceback
    self, etype, value, tb, tb_offset, number_of_lines_of_context)
  File "/usr/local/lib/python3.6/dist-packages/IPython/core/ultratb.py", line 1319, in structured_traceback
    self, etype, value, tb, tb_offset, number_of_lines_of_context
  File "/usr/local/lib/python3.6/dist-packages/IPython/core/ultratb.py", line 1182, in structured_traceback
    formatted_exceptions += self.prepare_chained_exception_message(evalue.__cause__)
TypeError: must be str, not list

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py", line 1823, in showtraceback
    stb = value._render_traceback_()
AttributeError: 'TypeError' object has no attribute '_render_traceback_'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/IPython/core/ultratb.py", line 1132, in get_records
    return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
  File "/usr/local/lib/python3.6/dist-packages/IPython/core/ultratb.py", line 313, in wrapped
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/IPython/core/ultratb.py", line 358, in _fixed_getinnerframes
    records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
  File "/usr/lib/python3.6/inspect.py", line 1480, in getinnerframes
    frameinfo = (tb.tb_frame,) + getframeinfo(tb, context)
  File "/usr/lib/python3.6/inspect.py", line 1438, in getframeinfo
    filename = getsourcefile(frame) or getfile(frame)
  File "/usr/lib/python3.6/inspect.py", line 693, in getsourcefile
    if getattr(getmodule(object, filename), '__loader__', None) is not None:
  File "/usr/lib/python3.6/inspect.py", line 730, in getmodule
    if ismodule(module) and hasattr(module, '__file__'):
  File "/usr/local/lib/python3.6/dist-packages/IPython/utils/shimmodule.py", line 90, in __getattr__
    return import_item(name)
  File "/usr/local/lib/python3.6/dist-packages/IPython/utils/importstring.py", line 31, in import_item
    module = __import__(package, fromlist=[obj])
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 951, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 894, in _find_spec
  File "<frozen importlib._bootstrap_external>", line 1157, in find_spec
  File "<frozen importlib._bootstrap_external>", line 1129, in _get_spec
  File "<frozen importlib._bootstrap_external>", line 1245, in find_spec
  File "<frozen importlib._bootstrap_external>", line 1285, in _fill_cache
OSError: [Errno 107] Transport endpoint is not connected: '/content/temp_drive/My Drive/Work'
---------------------------------------------------------------------------
TIMEOUT                                   Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/pexpect/expect.py in expect_loop(self, timeout)
    110                 # Still have time left, so read more data
--> 111                 incoming = spawn.read_nonblocking(spawn.maxread, timeout)
    112                 if self.spawn.delayafterread is not None:

/usr/local/lib/python3.6/dist-packages/pexpect/pty_spawn.py in read_nonblocking(self, size, timeout)
    481             else:
--> 482                 raise TIMEOUT('Timeout exceeded.')
    483 

TIMEOUT: Timeout exceeded.

During handling of the above exception, another exception occurred:


During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py in showtraceback(self, exc_tuple, filename, tb_offset, exception_only)
   1822                         # in the engines. This should return a list of strings.
-> 1823                         stb = value._render_traceback_()
   1824                     except Exception:

AttributeError: 'TIMEOUT' object has no attribute '_render_traceback_'

During handling of the above exception, another exception occurred:

TypeError                                 Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py in run_code(self, code_obj, result)
   2897             if result is not None:
   2898                 result.error_in_exec = sys.exc_info()[1]
-> 2899             self.showtraceback()
   2900         else:
   2901             outflag = 0

/usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py in showtraceback(self, exc_tuple, filename, tb_offset, exception_only)
   1824                     except Exception:
   1825                         stb = self.InteractiveTB.structured_traceback(etype,
-> 1826                                             value, tb, tb_offset=tb_offset)
   1827 
   1828                     self._showtraceback(etype, value, stb)

/usr/local/lib/python3.6/dist-packages/IPython/core/ultratb.py in structured_traceback(self, etype, value, tb, tb_offset, number_of_lines_of_context)
   1409         self.tb = tb
   1410         return FormattedTB.structured_traceback(
-> 1411             self, etype, value, tb, tb_offset, number_of_lines_of_context)
   1412 
   1413 

/usr/local/lib/python3.6/dist-packages/IPython/core/ultratb.py in structured_traceback(self, etype, value, tb, tb_offset, number_of_lines_of_context)
   1317             # Verbose modes need a full traceback
   1318             return VerboseTB.structured_traceback(
-> 1319                 self, etype, value, tb, tb_offset, number_of_lines_of_context
   1320             )
   1321         else:

/usr/local/lib/python3.6/dist-packages/IPython/core/ultratb.py in structured_traceback(self, etype, evalue, etb, tb_offset, number_of_lines_of_context)
   1180             exception = self.get_parts_of_chained_exception(evalue)
   1181             if exception:
-> 1182                 formatted_exceptions += self.prepare_chained_exception_message(evalue.__cause__)
   1183                 etype, evalue, etb = exception
   1184             else:

TypeError: must be str, not list

Update: I get this error not with not just trying to connect to drive but sometimes very randomly when I am in the middle of running a bunch of code cells.

ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.

Most helpful comment

@ballcap231
Try this procedure. From list of menus on Colab notebook. Click 'Runtime' and select 'Restart Runtime'.
I hope it would work

All 9 comments

Is your issue resolved??
@ballcap231

Hard to say, I think at one point colab just started working again for me, but I don't think I ever figured out what was the error.

I am unable to find any help regarding this issue.

@ballcap231
Try this procedure. From list of menus on Colab notebook. Click 'Runtime' and select 'Restart Runtime'.
I hope it would work

Please see https://research.google.com/colaboratory/faq.html#drive-timeout for an explanation for why this happens and suggested remedies.

Hello there
i had the same issue
The Reason :
you had a lot of files in the root Dire (/content/gdrive/My Drive ) of your Drive
the time of counting files will be passed if the number of files is big for the calculation process
The Solution:
REMOVE some files or make them in a folder

Hello there
i had the same issue
The Reason :
you had a lot of files in the root Dire (/content/gdrive/My Drive ) of your Drive
the time of counting files will be passed if the number of files is big for the calculation process
The Solution:
REMOVE some files or make them in a folder

Hmm, what do you mean by "make them in a folder"? Because I have tried to put all my files in 3 folders under the "My Drive" folder and I think I still get timeouts. However, this isn't really consistent. Sometimes i have to repeatedly reconnect after timeouts to get it to work and sometimes the 1st try just works.

hi again
when i had this probelm i looked to my root dir (/content/gdrive/My Drive ) i found a huge number of files there si
what i did was removing some of them like 6.000 Mybe or 5.000 files and the mounting worked just fine
some proposed solution in stackoverflow said that make all of this file in a folder
(/content/gdrive/My Drive/folder) may also resolve theis probelm
i hope my solution would help Sir
sorry for my bad English

hi again
when i had this probelm i looked to my root dir (/content/gdrive/My Drive ) i found a huge number of files there si
what i did was removing some of them like 6.000 Mybe or 5.000 files and the mounting worked just fine
some proposed solution in stackoverflow said that make all of this file in a folder
(/content/gdrive/My Drive/folder) may also resolve theis probelm
i hope my solution would help Sir
sorry for my bad English

Yeah I understand what you are suggesting. I put all my files in /content/gdrive/My Drive/folder and I still have problems mounting it sometimes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

saurabhgayali picture saurabhgayali  路  4Comments

blois picture blois  路  5Comments

wezleysherman picture wezleysherman  路  4Comments

blois picture blois  路  7Comments

Gurubux picture Gurubux  路  5Comments