Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NotebookApp' object has no attribute 'background_tasks' #44

Closed
jessebot opened this issue Dec 1, 2022 · 4 comments
Closed

Comments

@jessebot
Copy link
Contributor

jessebot commented Dec 1, 2022

This is such a cool app! Thank you for this! :)

I tried to run it in iterm2 using Python 3.11.0 on macOS Ventura (13.0.1) after running:

python -m pip install --user euporie
euporie-notebook

And it launches, but when I do CTRL+n to create a new notebook, it unfortunately gives an error:
Screenshot 2022-12-01 at 08 31 10

I can't select the ? in that image, but I can select copy traceback, which doesn't do anything immediately, but if I hit CTRL+q, it prints the following traceback

2022-12-01 08:24:02 CRITICAL Uncaught exception     euporie.core.log.handle_exception:421
Traceback (most recent call last):
    File "/Users/friend/Library/Python/3.11/bin/euporie-notebook", line 8, in <module>
      sys.exit(main())
               ^^^^^^
    File "/Users/friend/Library/Python/3.11/lib/python/site-packages/euporie/notebook/__main__.py", line 8, in main
      __main__.main(__name__.split(".")[1])
    File "/Users/friend/Library/Python/3.11/lib/python/site-packages/euporie/core/__main__.py", line 10, in main
      return entry.load().launch()
             ^^^^^^^^^^^^^^^^^^^^^
    File "/Users/friend/Library/Python/3.11/lib/python/site-packages/euporie/core/app.py", line 534, in launch
      return cls().run()
             ^^^^^^^^^^^
   File "/Users/friend/Library/Python/3.11/lib/python/site-packages/prompt_toolkit/application/application.py",
  line 978, in run    return loop.run_until_complete(
             ^^^^^^^^^^^^^^^^^^^^^^^^
   File
  "/usr/local/Cellar/python@3.11/3.11.0/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_event…
  , line 650, in run_until_complete    return future.result()
             ^^^^^^^^^^^^^^^
   File "/Users/friend/Library/Python/3.11/lib/python/site-packages/prompt_toolkit/application/application.py",
  line 891, in run_async    await self.cancel_and_wait_for_background_tasks()
   File "/Users/friend/Library/Python/3.11/lib/python/site-packages/euporie/core/app.py", line 832, in
  cancel_and_wait_for_background_tasks    for task in self.background_tasks:
                  ^^^^^^^^^^^^^^^^^^^^^
  AttributeError: 'NotebookApp' object has no attribute 'background_tasks'

I also tried uninstalling with pip and then reinstalling with pipx, but got the same error and traceback:

2022-12-01 08:40:32 CRITICAL Uncaught exception
euporie.core.log.handle_exception:421
Traceback (most recent call last):
              File "/Users/friend/.local/bin/euporie", line 8, in <module>
                sys.exit(main())
                         ^^^^^^
             File
            "/Users/friend/.local/pipx/venvs/euporie/lib/python3.11/site-packages/euporie…
            , line 10, in main    return entry.load().launch()
                       ^^^^^^^^^^^^^^^^^^^^^
             File
            "/Users/friend/.local/pipx/venvs/euporie/lib/python3.11/site-packages/euporie…
            , line 32, in launch    main(app)
             File
            "/Users/friend/.local/pipx/venvs/euporie/lib/python3.11/site-packages/euporie…
            , line 10, in main    return entry.load().launch()
                       ^^^^^^^^^^^^^^^^^^^^^
             File
            "/Users/friend/.local/pipx/venvs/euporie/lib/python3.11/site-packages/euporie…
            , line 534, in launch    return cls().run()
                       ^^^^^^^^^^^
             File
            "/Users/friend/.local/pipx/venvs/euporie/lib/python3.11/site-packages/prompt_…
            , line 978, in run    return loop.run_until_complete(
                       ^^^^^^^^^^^^^^^^^^^^^^^^
             File
            "/usr/local/Cellar/python@3.11/3.11.0/Frameworks/Python.framework/Versions/3.…
            , line 650, in run_until_complete    return future.result()
                       ^^^^^^^^^^^^^^^
             File
            "/Users/friend/.local/pipx/venvs/euporie/lib/python3.11/site-packages/prompt_…
            , line 891, in run_async    await self.cancel_and_wait_for_background_tasks()
             File
            "/Users/friend/.local/pipx/venvs/euporie/lib/python3.11/site-packages/euporie…
            , line 832, in cancel_and_wait_for_background_tasks    for task in self.
            background_tasks:                ^^^^^^^^^^^^^^^^^^^^^
            AttributeError: 'NotebookApp' object has no attribute 'background_tasks'
@jessebot
Copy link
Contributor Author

jessebot commented Dec 1, 2022

This also happens when installing Debian Bookworm with , however, at a later stage. It happens after I've run the following :

  • sudo apt install gcc-11
  • pip3.11 install --user euporie
  • pip3.11 install ipykernel
  • run euporie notebook command
  • create a new notebook with CTRL+n
  • add some content to a cell, in this case just print("hi friends") for testing
  • hit tab and then go to Run -> Run -> either option

Then it doesn't do anything, so I quit, and then there's the same error that was present on macOS, but in Debian this time:

2022-12-01 09:08:14 CRITICAL Uncaught exception              euporie.core.log.handle_exception:421                             Traceback (most recent call last):
                               File "/home/friend/.local/bin/euporie", line 8, in <module>
                                 sys.exit(main())
                                          ^^^^^^
                              File
                             "/home/friend/.local/lib/python3.11/site-packages/euporie/core/__mai…
                             , line 10, in main    return entry.load().launch()
                                        ^^^^^^^^^^^^^^^^^^^^^
                              File
                             "/home/friend/.local/lib/python3.11/site-packages/euporie/core/launc…
                             , line 32, in launch    main(app)
                              File
                             "/home/friend/.local/lib/python3.11/site-packages/euporie/core/__mai…
                             , line 10, in main    return entry.load().launch()
                                        ^^^^^^^^^^^^^^^^^^^^^
                              File
                             "/home/friend/.local/lib/python3.11/site-packages/euporie/core/app.p…
                             , line 534, in launch    return cls().run()
                                        ^^^^^^^^^^^
                              File
                             "/home/friend/.local/lib/python3.11/site-packages/prompt_toolkit/app…
                             , line 978, in run    return loop.run_until_complete(
                                        ^^^^^^^^^^^^^^^^^^^^^^^^
                              File
                             "/home/linuxbrew/.linuxbrew/opt/python@3.11/lib/python3.11/asyncio/b…
                             , line 650, in run_until_complete    return future.result()
                                        ^^^^^^^^^^^^^^^
                              File
                             "/home/friend/.local/lib/python3.11/site-packages/prompt_toolkit/app…
                             , line 891, in run_async    await self.
                             cancel_and_wait_for_background_tasks()  File
                             "/home/friend/.local/lib/python3.11/site-packages/euporie/core/app.p…
                             , line 832, in cancel_and_wait_for_background_tasks    for task in
                             self.background_tasks:                ^^^^^^^^^^^^^^^^^^^^^
                             AttributeError: 'NotebookApp' object has no attribute 'background_tas
                             ks'

@joouha
Copy link
Owner

joouha commented Dec 1, 2022

Hello! I'm glad you like euporie

There seem to be three separate issues here:

  1. Kernel died before replying to kernel_info error

    This is probably because your ipykernel install is messed up somehow. You can usually fix this by re-installing ipykernel, then re-registering the kernel as follows:

    python -m ipykernel install --user 
  2. 'NotebookApp' object has no attribute 'background_tasks' error

    I just noticed this myself yesterday - it's due to a change in the latest version of prompt_toolkit (v3.0.33). I've pushed a fix (67f64f6) and made a new release (v2.1.5), so if you upgrade euporie hopefully this will be fixed.

  3. GCC required to install euporie in Python 3.11

    The reason for this is that Python 3.11 was only released just over a month ago, and it takes time for package maintainers to build and release new wheels for packages with compiled components. This is why pip is having to compile some packages from source, and hence the need for GCC.

    I just tried installing euporie on Debian Bookworm with Python 3.11, and pip had to compile yarl from source, which required python3.11-dev and gcc to be installed. Once yarl releases wheels for 3.11, GCC should no longer be necessary. There is an issue for this here: CPython 3.11 wheels on PyPI aio-libs/yarl#781

I hope this helps

@jessebot
Copy link
Contributor Author

jessebot commented Dec 2, 2022

Thank you for your quick reply, I will give this a try asap! :)

@jessebot
Copy link
Contributor Author

Very late responding but yes, with the latest version, and fixing my ipykernel for python3.11 (who knows what i did with that), we are good to go! Thank you for your help! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants