2

I did write some deep learning code sometimes ago.Now I want to run it again . But at first it gave me these errors. here is the first block of code that went into a problem:

import tensorflow.keras
from tensorflow.keras import layers
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Activation,Flatten,MaxPooling2D,Conv2D
from tensorflow.keras.utils import to_categorical

and here is the error:

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.

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

this is the Traceback error:

Traceback (most recent call last):
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 3418, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-1-177d4802053d>", line 1, in <module>
    import tensorflow.keras
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 101, in <module>
    from tensorflow_core import *
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
    module = self._load()
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 44, in _load
    module = _importlib.import_module(self.__name__)
  File "C:\Users\msi-pc\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow_core\python\__init__.py", line 64, in <module>
    from tensorflow.core.framework.graph_pb2 import *
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow_core\core\framework\graph_pb2.py", line 7, in <module>
    from google.protobuf import descriptor as _descriptor
ImportError: cannot import name 'descriptor' from 'google.protobuf' (unknown location)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 2045, in showtraceback
    stb = value._render_traceback_()
AttributeError: 'ImportError' object has no attribute '_render_traceback_'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 1170, in get_records
    return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 316, in wrapped
    return f(*args, **kwargs)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 350, in _fixed_getinnerframes
    records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
  File "C:\Users\msi-pc\Anaconda3\lib\inspect.py", line 1502, in getinnerframes
    frameinfo = (tb.tb_frame,) + getframeinfo(tb, context)
  File "C:\Users\msi-pc\Anaconda3\lib\inspect.py", line 1460, in getframeinfo
    filename = getsourcefile(frame) or getfile(frame)
  File "C:\Users\msi-pc\Anaconda3\lib\inspect.py", line 696, in getsourcefile
    if getattr(getmodule(object, filename), '__loader__', None) is not None:
  File "C:\Users\msi-pc\Anaconda3\lib\inspect.py", line 733, in getmodule
    if ismodule(module) and hasattr(module, '__file__'):
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
    module = self._load()
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 44, in _load
    module = _importlib.import_module(self.__name__)
  File "C:\Users\msi-pc\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow_core\__init__.py", line 42, in <module>
    from . _api.v2 import audio
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow_core\_api\v2\audio\__init__.py", line 10, in <module>
    from tensorflow.python.ops.gen_audio_ops import decode_wav
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow_core\python\ops\gen_audio_ops.py", line 10, in <module>
    from tensorflow.python.eager import context as _context
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow_core\python\eager\context.py", line 25, in <module>
    from absl import logging
ModuleNotFoundError: No module named 'absl'
Traceback (most recent call last):
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 3418, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-1-177d4802053d>", line 1, in <module>
    import tensorflow.keras
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 101, in <module>
    from tensorflow_core import *
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
    module = self._load()
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 44, in _load
    module = _importlib.import_module(self.__name__)
  File "C:\Users\msi-pc\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow_core\python\__init__.py", line 64, in <module>
    from tensorflow.core.framework.graph_pb2 import *
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow_core\core\framework\graph_pb2.py", line 7, in <module>
    from google.protobuf import descriptor as _descriptor
ImportError: cannot import name 'descriptor' from 'google.protobuf' (unknown location)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 2045, in showtraceback
    stb = value._render_traceback_()
AttributeError: 'ImportError' object has no attribute '_render_traceback_'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 3338, in run_ast_nodes
    if (await self.run_code(code, result,  async_=asy)):
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 3435, in run_code
    self.showtraceback(running_compiled_code=True)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 2048, in showtraceback
    value, tb, tb_offset=tb_offset)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 1437, in structured_traceback
    self, etype, value, tb, tb_offset, number_of_lines_of_context)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 1337, in structured_traceback
    self, etype, value, tb, tb_offset, number_of_lines_of_context
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 1194, in structured_traceback
    tb_offset)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 1151, in format_exception_as_a_whole
    last_unique, recursion_repeat = find_recursion(orig_etype, evalue, records)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 451, in find_recursion
    return len(records), 0
TypeError: object of type 'NoneType' has no len()

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 2045, 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 "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 1170, in get_records
    return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 316, in wrapped
    return f(*args, **kwargs)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 350, in _fixed_getinnerframes
    records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
  File "C:\Users\msi-pc\Anaconda3\lib\inspect.py", line 1502, in getinnerframes
    frameinfo = (tb.tb_frame,) + getframeinfo(tb, context)
  File "C:\Users\msi-pc\Anaconda3\lib\inspect.py", line 1460, in getframeinfo
    filename = getsourcefile(frame) or getfile(frame)
  File "C:\Users\msi-pc\Anaconda3\lib\inspect.py", line 696, in getsourcefile
    if getattr(getmodule(object, filename), '__loader__', None) is not None:
  File "C:\Users\msi-pc\Anaconda3\lib\inspect.py", line 733, in getmodule
    if ismodule(module) and hasattr(module, '__file__'):
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
    module = self._load()
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 44, in _load
    module = _importlib.import_module(self.__name__)
  File "C:\Users\msi-pc\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow_core\__init__.py", line 42, in <module>
    from . _api.v2 import audio
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow_core\_api\v2\audio\__init__.py", line 10, in <module>
    from tensorflow.python.ops.gen_audio_ops import decode_wav
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow_core\python\ops\gen_audio_ops.py", line 10, in <module>
    from tensorflow.python.eager import context as _context
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow_core\python\eager\context.py", line 25, in <module>
    from absl import logging
ModuleNotFoundError: No module named 'absl'
Traceback (most recent call last):
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 3418, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-1-177d4802053d>", line 1, in <module>
    import tensorflow.keras
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 101, in <module>
    from tensorflow_core import *
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
    module = self._load()
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 44, in _load
    module = _importlib.import_module(self.__name__)
  File "C:\Users\msi-pc\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow_core\python\__init__.py", line 64, in <module>
    from tensorflow.core.framework.graph_pb2 import *
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow_core\core\framework\graph_pb2.py", line 7, in <module>
    from google.protobuf import descriptor as _descriptor
ImportError: cannot import name 'descriptor' from 'google.protobuf' (unknown location)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 2045, in showtraceback
    stb = value._render_traceback_()
AttributeError: 'ImportError' object has no attribute '_render_traceback_'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 3338, in run_ast_nodes
    if (await self.run_code(code, result,  async_=asy)):
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 3435, in run_code
    self.showtraceback(running_compiled_code=True)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 2048, in showtraceback
    value, tb, tb_offset=tb_offset)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 1437, in structured_traceback
    self, etype, value, tb, tb_offset, number_of_lines_of_context)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 1337, in structured_traceback
    self, etype, value, tb, tb_offset, number_of_lines_of_context
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 1194, in structured_traceback
    tb_offset)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 1151, in format_exception_as_a_whole
    last_unique, recursion_repeat = find_recursion(orig_etype, evalue, records)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 451, in find_recursion
    return len(records), 0
TypeError: object of type 'NoneType' has no len()

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 2045, 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 "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 2923, in _run_cell
    return runner(coro)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\async_helpers.py", line 68, in _pseudo_sync_runner
    coro.send(None)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 3147, in run_cell_async
    interactivity=interactivity, compiler=compiler, result=result)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 3357, in run_ast_nodes
    self.showtraceback()
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 2048, in showtraceback
    value, tb, tb_offset=tb_offset)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 1437, in structured_traceback
    self, etype, value, tb, tb_offset, number_of_lines_of_context)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 1337, in structured_traceback
    self, etype, value, tb, tb_offset, number_of_lines_of_context
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 1212, in structured_traceback
    chained_exceptions_tb_offset)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 1151, in format_exception_as_a_whole
    last_unique, recursion_repeat = find_recursion(orig_etype, evalue, records)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 451, in find_recursion
    return len(records), 0
TypeError: object of type 'NoneType' has no len()

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\interactiveshell.py", line 2045, 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 "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 1170, in get_records
    return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 316, in wrapped
    return f(*args, **kwargs)
  File "C:\Users\msi-pc\AppData\Roaming\Python\Python37\site-packages\IPython\core\ultratb.py", line 350, in _fixed_getinnerframes
    records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
  File "C:\Users\msi-pc\Anaconda3\lib\inspect.py", line 1502, in getinnerframes
    frameinfo = (tb.tb_frame,) + getframeinfo(tb, context)
  File "C:\Users\msi-pc\Anaconda3\lib\inspect.py", line 1460, in getframeinfo
    filename = getsourcefile(frame) or getfile(frame)
  File "C:\Users\msi-pc\Anaconda3\lib\inspect.py", line 696, in getsourcefile
    if getattr(getmodule(object, filename), '__loader__', None) is not None:
  File "C:\Users\msi-pc\Anaconda3\lib\inspect.py", line 733, in getmodule
    if ismodule(module) and hasattr(module, '__file__'):
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
    module = self._load()
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 44, in _load
    module = _importlib.import_module(self.__name__)
  File "C:\Users\msi-pc\Anaconda3\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow_core\__init__.py", line 42, in <module>
    from . _api.v2 import audio
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow_core\_api\v2\audio\__init__.py", line 10, in <module>
    from tensorflow.python.ops.gen_audio_ops import decode_wav
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow_core\python\ops\gen_audio_ops.py", line 10, in <module>
    from tensorflow.python.eager import context as _context
  File "C:\Users\msi-pc\Anaconda3\lib\site-packages\tensorflow_core\python\eager\context.py", line 25, in <module>
    from absl import logging
ModuleNotFoundError: No module named 'absl'

I'm confused why it can not run.it said internal Python error in the inspect module.it was a confusing traceback to me . Anyone knows what's the problem with the code or other things?

1

1 Answer 1

1

In the last part of the error, we can see ModuleNotFoundError: No module named 'absl

You should, in theory, be able to solve that by just installing absl

Try installing it by running pip install absl-py

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.