How do I resolve this error when I open Jupyter notbook? - python

error message
(base) grantmeadowsjr#Grants-Mac ~ % jupyter lab
[I 2021-11-27 10:33:53.031 ServerApp] jupyterlab | extension was successfully linked.
[I 2021-11-27 10:33:53.429 ServerApp] nbclassic | extension was successfully linked.
Traceback (most recent call last):
File "/opt/anaconda3/bin/jupyter-lab", line 10, in <module>
sys.exit(main())
File "/opt/anaconda3/lib/python3.9/site-packages/jupyter_server/extension/application.py", line 510, in launch_instance
serverapp = cls.initialize_server(argv=args)
File "/opt/anaconda3/lib/python3.9/site-packages/jupyter_server/extension/application.py", line 479, in initialize_server
serverapp.initialize(
File "/opt/anaconda3/lib/python3.9/site-packages/traitlets/config/application.py", line 88, in inner
return method(app, *args, **kwargs)
File "/opt/anaconda3/lib/python3.9/site-packages/jupyter_server/serverapp.py", line 1831, in initialize
self.init_httpserver()
File "/opt/anaconda3/lib/python3.9/site-packages/jupyter_server/serverapp.py", line 1752, in init_httpserver
self.http_server.listen(port, self.ip)
File "/opt/anaconda3/lib/python3.9/site-packages/tornado/tcpserver.py", line 151, in listen
sockets = bind_sockets(port, address=address)
File "/opt/anaconda3/lib/python3.9/site-packages/tornado/netutil.py", line 161, in bind_sockets
sock.bind(sockaddr)
OSError: [Errno 49] Can't assign requested address
This is the error I receive when I open jupyter notebook from anaconda. I am not very familiar with using the mac terminal, I had to download anaconda for my class.

Related

I cant launch my jupyter lab in my Windows 10 machine. Non Virtual Machine laptop

Hope anyone can help me figure out how to solve.
Here is the message:
Traceback (most recent call last):
File "C:\Users\AA\anaconda3\Scripts\jupyter-lab-script.py", line 9, in
sys.exit(main())
File "C:\Users\AA\anaconda3\lib\site-packages\jupyter_core\application.py", line 270, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "C:\Users\AA\anaconda3\lib\site-packages\traitlets\config\application.py", line 844, in launch_instance
app.initialize(argv)
File "C:\Users\AA\anaconda3\lib\site-packages\traitlets\config\application.py", line 87, in inner
return method(app, *args, **kwargs)
File "C:\Users\AA\AppData\Roaming\Python\Python38\site-packages\notebook\notebookapp.py", line 1368, in initialize
self.init_webapp()
File "C:\Users\AA\AppData\Roaming\Python\Python38\site-packages\notebook\notebookapp.py", line 1188, in init_webapp
self.http_server.listen(port, self.ip)
File "C:\Users\AA\anaconda3\lib\site-packages\tornado\tcpserver.py", line 152, in listen
self.add_sockets(sockets)
File "C:\Users\AA\anaconda3\lib\site-packages\tornado\tcpserver.py", line 165, in add_sockets
self._handlers[sock.fileno()] = add_accept_handler(
File "C:\Users\AA\anaconda3\lib\site-packages\tornado\netutil.py", line 279, in add_accept_handler
io_loop.add_handler(sock, accept_handler, IOLoop.READ)
File "C:\Users\AA\anaconda3\lib\site-packages\tornado\platform\asyncio.py", line 100, in add_handler
self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ)
File "C:\Users\AA\anaconda3\lib\asyncio\events.py", line 501, in add_reader
raise NotImplementedError
NotImplementedError
I my opinion there are 2 solutions :
solution 1 :
try to downgrade you Jupyter lab from anaconda navigator .
solution 2:
open your anaconda navigator .
click on jupyter lab setting option and then remove it.
open anaconda prompt and type command conda install -c conda-forge jupyterlab
open anaconda command prompt as administrator

Jupyter Notebook Server on Ubuntu Error: Cannot assign requested address

Trying to setup a Jupyter notebook server on personal machine with public IP and getting this error:
jupyter notebook --ip 69.84.109.70 --no-browser --port 8888
Traceback (most recent call last):
File "/usr/local/bin/jupyter-notebook", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.7/dist-packages/jupyter_core/application.py", line 270, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/traitlets/config/application.py", line 663, in launch_instance
app.initialize(argv)
File "</usr/local/lib/python3.7/dist-packages/decorator.py:decorator-gen-7>", line 2, in initialize
File "/usr/local/lib/python3.7/dist-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/notebook/notebookapp.py", line 1769, in initialize
self.init_webapp()
File "/usr/local/lib/python3.7/dist-packages/notebook/notebookapp.py", line 1490, in init_webapp
self.http_server.listen(port, self.ip)
File "/usr/local/lib/python3.7/dist-packages/tornado/tcpserver.py", line 151, in listen
sockets = bind_sockets(port, address=address)
File "/usr/local/lib/python3.7/dist-packages/tornado/netutil.py", line 174, in bind_sockets
sock.bind(sockaddr)
OSError: [Errno 99] Cannot assign requested address
When I run it with my internal IP address it works fine.
Config file:
cat /home/user/.jupyter/jupyter_notebook_config.
c.NotebookApp.allow_origin = '*' #allow all origins
c.NotebookApp.ip = '0.0.0.0' # listen on all IPs
Use the following command to run your jupyter notebook
jupyter notebook --ip=0.0.0.0 --port=8080

Jupyter notebook kernel not connecting

I have previously used Jupyter Notebook (python 2 and 3) on my mac. After not using it for a while, there seems to be a problem I am unable to fix. When starting the notebook from terminal using the command Jupyter notebook, and then select a notebook I want to work with, I get the error:
"A connection to the notebook server could not be established. The notebook will continue trying to reconnect. Check your network connection or notebook server configuration."
I am positive this has nothing to do with my internet connection (I have tried 2 machines connected to different networks).
I have read that the browser could be the problem, therefore I have installed Chrome and Firefox. However, I get this error when I am using Safari, Chrome, and Firefox.
Then I read about it being a proxy issue. I have tried to add the server address of the notebook to the No proxy fields of the advanced network preferences of my mac, and of the advanced setting on Firefox.
The only thing I can think of is that I am entering the wrong server address?
I do not know much about setting and errors in general, hopefully someone can provide me with some alternative options to get Jupyter working again.
Terminal output:
ValueError: signal only works in main thread
ERROR:tornado.application:Exception in callback <functools.partial object at 0x111e2b208>
Traceback (most recent call last):
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/ioloop.py", line 759, in _run_callback
ret = callback()
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/stack_context.py", line 276, in null_wrapper
return fn(*args, **kwargs)
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 536, in <lambda>
self.io_loop.add_callback(lambda : self._handle_events(self.socket, 0))
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 450, in _handle_events
self._handle_recv()
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 480, in _handle_recv
self._run_callback(callback, msg)
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/zmq/eventloop/zmqstream.py", line 432, in _run_callback
callback(*args, **kwargs)
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/stack_context.py", line 276, in null_wrapper
return fn(*args, **kwargs)
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/ipykernel/kernelbase.py", line 283, in dispatcher
return self.dispatch_shell(stream, msg)
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/ipykernel/kernelbase.py", line 233, in dispatch_shell
self.pre_handler_hook()
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/ipykernel/kernelbase.py", line 248, in pre_handler_hook
self.saved_sigint_handler = signal(SIGINT, default_int_handler)
ValueError: signal only works in main thread
[I 19:03:26.685 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports
Traceback (most recent call last):
File "/Users/xxx/anaconda2/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/Users/xxx/anaconda2/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/ipykernel/kernelapp.py", line 477, in start
ioloop.IOLoop.instance().start()
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/ioloop.py", line 928, in start
raise RuntimeError("IOLoop is already running")
RuntimeError: IOLoop is already running
[I 19:03:29.696 NotebookApp] KernelRestarter: restarting kernel (2/5), new random ports
Traceback (most recent call last):
File "/Users/xxx/anaconda2/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/Users/xxx/anaconda2/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/ipykernel/kernelapp.py", line 477, in start
ioloop.IOLoop.instance().start()
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/ioloop.py", line 928, in start
raise RuntimeError("IOLoop is already running")
RuntimeError: IOLoop is already running
[I 19:03:32.712 NotebookApp] KernelRestarter: restarting kernel (3/5), new random ports
Traceback (most recent call last):
File "/Users/xxx/anaconda2/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/Users/xxx/anaconda2/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/ipykernel/kernelapp.py", line 477, in start
ioloop.IOLoop.instance().start()
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/ioloop.py", line 928, in start
raise RuntimeError("IOLoop is already running")
RuntimeError: IOLoop is already running
[W 19:03:33.717 NotebookApp] Timeout waiting for kernel_info reply from 2cf24420-719b-4666-ad9f-fcdf8db505f3
[E 19:03:33.721 NotebookApp] Uncaught exception in /api/kernels/2cf24420-719b-4666-ad9f-fcdf8db505f3/channels
Traceback (most recent call last):
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/websocket.py", line 498, in _run_callback
result = callback(*args, **kwargs)
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/notebook/services/kernels/handlers.py", line 262, in open
super(ZMQChannelsHandler, self).open()
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/notebook/base/zmqhandlers.py", line 176, in open
self.send_ping, self.ping_interval, io_loop=loop,
TypeError: __init__() got an unexpected keyword argument 'io_loop'
[E 19:03:34.749 NotebookApp] Uncaught exception in /api/kernels/2cf24420-719b-4666-ad9f-fcdf8db505f3/channels
Traceback (most recent call last):
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/websocket.py", line 498, in _run_callback
result = callback(*args, **kwargs)
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/notebook/services/kernels/handlers.py", line 262, in open
super(ZMQChannelsHandler, self).open()
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/notebook/base/zmqhandlers.py", line 176, in open
self.send_ping, self.ping_interval, io_loop=loop,
TypeError: __init__() got an unexpected keyword argument 'io_loop'
[I 19:03:35.724 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports
[E 19:03:35.771 NotebookApp] Uncaught exception in /api/kernels/2cf24420-719b-4666-ad9f-fcdf8db505f3/channels
Traceback (most recent call last):
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/websocket.py", line 498, in _run_callback
result = callback(*args, **kwargs)
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/notebook/services/kernels/handlers.py", line 262, in open
super(ZMQChannelsHandler, self).open()
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/notebook/base/zmqhandlers.py", line 176, in open
self.send_ping, self.ping_interval, io_loop=loop,
TypeError: __init__() got an unexpected keyword argument 'io_loop'
Traceback (most recent call last):
File "/Users/xxx/anaconda2/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/Users/xxx/anaconda2/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/traitlets/config/application.py", line 658, in launch_instance
app.start()
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/ipykernel/kernelapp.py", line 477, in start
ioloop.IOLoop.instance().start()
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/ioloop.py", line 928, in start
raise RuntimeError("IOLoop is already running")
RuntimeError: IOLoop is already running
[E 19:03:36.791 NotebookApp] Uncaught exception in /api/kernels/2cf24420-719b-4666-ad9f-fcdf8db505f3/channels
Traceback (most recent call last):
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/websocket.py", line 498, in _run_callback
result = callback(*args, **kwargs)
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/notebook/services/kernels/handlers.py", line 262, in open
super(ZMQChannelsHandler, self).open()
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/notebook/base/zmqhandlers.py", line 176, in open
self.send_ping, self.ping_interval, io_loop=loop,
TypeError: __init__() got an unexpected keyword argument 'io_loop'
[E 19:03:37.810 NotebookApp] Uncaught exception in /api/kernels/2cf24420-719b-4666-ad9f-fcdf8db505f3/channels
Traceback (most recent call last):
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/tornado/websocket.py", line 498, in _run_callback
result = callback(*args, **kwargs)
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/notebook/services/kernels/handlers.py", line 262, in open
super(ZMQChannelsHandler, self).open()
File "/Users/xxx/anaconda2/lib/python2.7/site-packages/notebook/base/zmqhandlers.py", line 176, in open
self.send_ping, self.ping_interval, io_loop=loop,
TypeError: __init__() got an unexpected keyword argument 'io_loop'
[W 19:03:38.733 NotebookApp] KernelRestarter: restart failed
[W 19:03:38.733 NotebookApp] Kernel 2cf24420-719b-4666-ad9f-fcdf8db505f3 died, removing from map.
[W 19:03:38.830 NotebookApp] 404 GET /api/kernels/2cf24420-719b-4666-ad9f-fcdf8db505f3/channels?session_id=3F75F379F865488D8379D3BB7FC0BF0F (::1): Kernel does not exist: 2cf24420-719b-4666-ad9f-fcdf8db505f3
[W 19:03:38.838 NotebookApp] 404 GET /api/kernels/2cf24420-719b-4666-ad9f-fcdf8db505f3/channels?session_id=3F75F379F865488D8379D3BB7FC0BF0F (::1) 12.00ms referer=None
[W 19:03:40.859 NotebookApp] Replacing stale connection: 2cf24420-719b-4666-ad9f-fcdf8db505f3:3F75F379F865488D8379D3BB7FC0BF0F
Running the following version of jupyter and tornado seemed to solve the issue:
Jupyter: 4.4.0
Tornado: 4.5.3
I needed to downgrade my version of tornado (which was 5.0.2)
I faced this problem too. My problem was because of a custom module name. I named the module 'copy.py.' My issue was solved when I renamed it.
I found a way out, Installing Python on my PC solved it. I didn't install python before installing anaconda
I was also facing the kernal related issues and all my problems were solved by installing jupyter notebook from anaconda navigator.
So,The best way to handle jupyter notebook related problems is to install jupyter notebook from anaconda navigator for your environment in which you want to run jupyter notebook. If you will install jupyter notebook from anaconda navigator then you will not face any problem.

Jupyter notebooks: Tornado pointing to incorrect path

I'm trying to run a Jupyter notebook. I installed Anaconda 5.3 with the Python 3.7 version. The notebook starts up, but the Kernel fails to run because it's pointing to another version of Tornado that I've installed for some of my ROS projects (output below). How do I ensure the Jupyter kernel is using Tornado installed in the Anaconda path?
[I 10:56:54.649 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports
Traceback (most recent call last):
File "/dir/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/dir/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/dir/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py", line 16, in <module>
app.launch_new_instance()
File "/dir/anaconda3/lib/python3.7/site-packages/traitlets/config/application.py", line 657, in launch_instance
app.initialize(argv)
File "<decorator-gen-123>", line 2, in initialize
File "/dir/anaconda3/lib/python3.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/dir/anaconda3/lib/python3.7/site-packages/ipykernel/kernelapp.py", line 467, in initialize
self.init_sockets()
File "/dir/anaconda3/lib/python3.7/site-packages/ipykernel/kernelapp.py", line 260, in init_sockets
self.init_iopub(context)
File "/dir/anaconda3/lib/python3.7/site-packages/ipykernel/kernelapp.py", line 268, in init_iopub
self.iopub_thread = IOPubThread(self.iopub_socket, pipe=True)
File "/dir/anaconda3/lib/python3.7/site-packages/ipykernel/iostream.py", line 66, in __init__
self.io_loop = IOLoop(make_current=False)
File "/dir/ros_projects/forked/rosbridge_suite/rosbridge_server/src/tornado/util.py", line 208, in __new__
instance.initialize(**args)
File "/dir/ros_projects/forked/rosbridge_suite/rosbridge_server/src/tornado/platform/epoll.py", line 26, in initialize
super(EPollIOLoop, self).initialize(impl=select.epoll(), **kwargs)
TypeError: initialize() got an unexpected keyword argument 'make_current'
[W 10:56:57.665 NotebookApp] KernelRestarter: restart failed
[W 10:56:57.666 NotebookApp] Kernel 2dd183ff-850d-4f79-945c-c8f56f1e695e died, removing from map.
A little late, but answering my own question. PYTHONPATH was set for a bunch of other projects. Since conda doesn't set PYTHONPATH, running
unset PYTHONPATH
did the trick.

Getting error while trying to execute jupyter-notebook

I'm getting an error while trying to execute jupyter-notebook in the console, the error happen here:
devnull = open(os.devnull, 'w')
FileNotFoundError: [Errno 2] No such file or directory: 'nul'
The strange thing is that it began to happen from one day to another, since until recently I could use jupyter-notebook perfectly, due to this error I uninstalled and then reinstalled anaconda, but the error persists.
My OS is Windows 10 and I installed the 64-bit installer with python 3.6
The Traceback is:
C:\Users\username\Anaconda3\Scripts>jupyter notebook
Traceback (most recent call last):
File "C:\Users\username\Anaconda3\Scripts\jupyter-notebook-script.py", line 5, in <module>
sys.exit(notebook.notebookapp.main())
File "C:\Users\username\Anaconda3\lib\site-packages\jupyter_core\application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "C:\Users\username\Anaconda3\lib\site-packages\traitlets\config\application.py", line 657, in launch_instance
app.initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "C:\Users\username\Anaconda3\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "C:\Users\username\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 1296, in initialize
self.init_webapp()
File "C:\Users\username\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 1093, in init_webapp
self.jinja_environment_options
File "C:\Users\username\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 167, in __init__
default_url, settings_overrides, jinja_env_options)
File "C:\Users\username\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 259, in init_settings
nbextensions_path=jupyter_app.nbextensions_path,
File "C:\Users\username\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 807, in nbextensions_path
from IPython.paths import get_ipython_dir
File "C:\Users\username\Anaconda3\lib\site-packages\IPython\__init__.py", line 49, in <module>
from .terminal.embed import embed
File "C:\Users\username\Anaconda3\lib\site-packages\IPython\terminal\embed.py", line 17, in <module>
from IPython.core.interactiveshell import DummyMod, InteractiveShell
File "C:\Users\username\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 62, in <module>
from IPython.utils import io
File "C:\Users\username\Anaconda3\lib\site-packages\IPython\utils\io.py", line 90, in <module>
devnull = open(os.devnull, 'w')
FileNotFoundError: [Errno 2] No such file or directory: 'nul'
Any help is welcome.

Categories

Resources