notebook: TypeError: register() takes from 2 to 3 positional arguments but 4 were given

when opening jupyter notebook it shows this error

jupyter notebook
[I 11:56:10.168 NotebookApp] Serving notebooks from local directory: /home/malsym
[I 11:56:10.168 NotebookApp] 0 active kernels
[I 11:56:10.168 NotebookApp] The Jupyter Notebook is running at:
[I 11:56:10.168 NotebookApp] http://localhost:8888/?token=d789fe23acf854272ed5c9977d[XXXXXXXX]07d4c863f16d33
[I 11:56:10.168 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
Traceback (most recent call last):
  File "/usr/bin/jupyter-notebook", line 11, in <module>
    load_entry_point('notebook==5.3.0', 'console_scripts', 'jupyter-notebook')()
  File "/usr/lib/python3.7/site-packages/jupyter_core/application.py", line 266, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/usr/lib/python3.7/site-packages/traitlets/config/application.py", line 658, in launch_instance
    app.start()
  File "/usr/lib/python3.7/site-packages/notebook/notebookapp.py", line 1597, in start
    browser = webbrowser.get(self.browser or None)
  File "/usr/lib/python3.7/webbrowser.py", line 42, in get
    register_standard_browsers()
  File "/usr/lib/python3.7/webbrowser.py", line 567, in register_standard_browsers
    cmd = _synthesize(cmdline, -1)
  File "/usr/lib/python3.7/webbrowser.py", line 116, in _synthesize
    register(browser, None, controller, update_tryorder)
TypeError: register() takes from 2 to 3 positional arguments but 4 were given

my system information

os: arch linux Kernel Information: Linux 4.17.12-arch1-1-ARCH x86_64 python version: Python 3.7.0 jupyter version: 4.4.0

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (1 by maintainers)

Most upvoted comments

Both jupyter notebook and jupyter-lab have this problem. As @takluyver suggest doing “unset BROWSER” in terminal first fixes the problem:

$ unset BROWSER $ jupyter notebook

Looks like this is a bug in Python itself: https://bugs.python.org/issue31014

It sounds like it depends on the BROWSER environment variable; you might be able to work around it by unsetting that. Hopefully it will be fixed in 3.7.1.

You currently cannot create a Conda environment with python 3.7.1 along with Jupyter. If you try, it will fail or attempt to downgrade your python to 2.7 😂

On Fri, 26 Oct 2018, 17:31 Maximilian Schambach, notifications@github.com wrote:

I have the same problem in a clean Python 3.7 conda environment. As Python 3.7.1 has just been released, I think it will take a little while for the conda branches to update. In principle, using conda update -n envname python should update Python in the Python branch of the environment, i.e. in the Python 3.7 branch from 3.7.0 to 3.7.1.

But this has nothing to do with the actual issue here. That is, Jupyter notebook not being compatible with Python 3.7 due to the bug in webbrowser.py

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jupyter/notebook/issues/3840#issuecomment-433448598, or mute the thread https://github.com/notifications/unsubscribe-auth/AMOhpZ6C6Lou-sV7ZYsR4BLbXArb_fy1ks5uoyrrgaJpZM4V1aDj .

If the above doesn’t work for you, try the following:

Given the error message, we are looking at line 116 of webbrowser.py. There I changed this:

register(browser, None, controller, update_tryorder)

to this:

register(browser, None, controller, preferred=update_tryorder)

Now running jupyter notebook works as expected!