Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

python - Can't launch Jupyter Notebook ModuleNotFoundError: No module named 'resource'

I've been using Jupyter Notebook from the command line for a month now, today I didn't shut the running notebook and put my laptop to sleep for 4 hours. After turning my laptop back on I tried to run the notebook again and I'm getting the same error ever since. Please help me out.

Traceback (most recent call last):
  File "c:userschinmayappdatalocalprogramspythonpython38-32libsite-packagesIPythonutilsiming.py", line 27, in <module>
    import resource
ModuleNotFoundError: No module named 'resource'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:userschinmayappdatalocalprogramspythonpython38-32lib
unpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:userschinmayappdatalocalprogramspythonpython38-32lib
unpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:UsersChinmayAppDataLocalProgramsPythonPython38-32Scriptsjupyter-notebook.EXE\__main__.py", line 9, in <module>
  File "c:userschinmayappdatalocalprogramspythonpython38-32libsite-packagesjupyter_coreapplication.py", line 270, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "c:userschinmayappdatalocalprogramspythonpython38-32libsite-packagesraitletsconfigapplication.py", line 663, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-7>", line 2, in initialize
  File "c:userschinmayappdatalocalprogramspythonpython38-32libsite-packagesraitletsconfigapplication.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "c:userschinmayappdatalocalprogramspythonpython38-32libsite-packages
otebook
otebookapp.py", line 1769, in initialize
    self.init_webapp()
  File "c:userschinmayappdatalocalprogramspythonpython38-32libsite-packages
otebook
otebookapp.py", line 1451, in init_webapp
    self.web_app = NotebookWebApplication(
  File "c:userschinmayappdatalocalprogramspythonpython38-32libsite-packages
otebook
otebookapp.py", line 153, in __init__
    settings = self.init_settings(
  File "c:userschinmayappdatalocalprogramspythonpython38-32libsite-packages
otebook
otebookapp.py", line 269, in init_settings
    nbextensions_path=jupyter_app.nbextensions_path,
  File "c:userschinmayappdatalocalprogramspythonpython38-32libsite-packages
otebook
otebookapp.py", line 1120, in nbextensions_path
    from IPython.paths import get_ipython_dir
  File "c:userschinmayappdatalocalprogramspythonpython38-32libsite-packagesIPython\__init__.py", line 49, in <module>
    from .terminal.embed import embed
  File "c:userschinmayappdatalocalprogramspythonpython38-32libsite-packagesIPythonerminalembed.py", line 19, in <module>
    from IPython.terminal.ipapp import load_default_config
  File "c:userschinmayappdatalocalprogramspythonpython38-32libsite-packagesIPythonerminalipapp.py", line 30, in <module>
    from IPython.core.magics import ScriptMagics
  File "c:userschinmayappdatalocalprogramspythonpython38-32libsite-packagesIPythoncoremagics\__init__.py", line 21, in <module>
    from .execution import ExecutionMagics
  File "c:userschinmayappdatalocalprogramspythonpython38-32libsite-packagesIPythoncoremagicsexecution.py", line 46, in <module>
    from IPython.utils.timing import clock, clock2
  File "c:userschinmayappdatalocalprogramspythonpython38-32libsite-packagesIPythonutilsiming.py", line 64, in <module>
    clocku = clocks = clock = time.clock
AttributeError: module 'time' has no attribute 'clock'```
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Open this file: c:userschinmayappdatalocalprogramspythonpython38-32libsite-packagesIPythonutilsiming.py

  1. change import time to import timeit
  2. change time.clock to timeit.default_timer

This worked for me, should work for you.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...