Jupyter notebook cannot connect to the kernel - jupyter-notebook

Jupyter notebook cannot connect to the kernel. I tried all the methods. I also reinstalled the computer system, reset the c drive, reinstalled anaconda, etc., but the same error was reported. I also changed the file path to Chinese, but Still fails, why? How to deal with it? The error is as follows: (the front part is the startup part, you can start to see it from the end, and the startup fails at the end)
[W 2022-12-11 19:23:10.102 LabApp] 'notebook_dir' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[W 2022-12-11 19:23:10.102 LabApp] 'notebook_dir' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[I 2022-12-11 19:23:10.111 LabApp] JupyterLab extension loaded from C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab
[I 2022-12-11 19:23:10.111 LabApp] JupyterLab application directory is C:\ProgramData\Anaconda3\share\jupyter\lab
[I 19:23:10.117 NotebookApp] Serving notebooks from local directory: C:\Users\dilim
[I 19:23:10.117 NotebookApp] Jupyter Notebook 6.4.12 is running at:
[I 19:23:10.117 NotebookApp] http://localhost:8888/?token=a2380da4760b3519ffd6c9e8bc15220404126807c6c4f538
[I 19:23:10.117 NotebookApp] or http://127.0.0.1:8888/?token=a2380da4760b3519ffd6c9e8bc15220404126807c6c4f538
[I 19:23:10.117 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 19:23:10.149 NotebookApp]
To access the notebook, open this file in a browser:
file:///C:/Users/dilim/AppData/Roaming/jupyter/runtime/nbserver-7544-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=a2380da4760b3519ffd6c9e8bc15220404126807c6c4f538
or http://127.0.0.1:8888/?token=a2380da4760b3519ffd6c9e8bc15220404126807c6c4f538
[I 19:23:17.357 NotebookApp] Kernel started: 1474a909-0184-4cc9-995e-713135cea29f, name: python3
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\ProgramData\Anaconda3\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
from ipykernel import kernelapp as app
File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel\__init__.py", line 5, in <module>
from .connect import * # noqa
File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel\connect.py", line 11, in <module>
import jupyter_client
File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\__init__.py", line 8, in <module>
from .asynchronous import AsyncKernelClient # noqa
File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\asynchronous\__init__.py", line 1, in <module>
from .client import AsyncKernelClient # noqa
File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\asynchronous\client.py", line 6, in <module>
from jupyter_client.channels import HBChannel
File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\channels.py", line 4, in <module>
import asyncio
File "C:\ProgramData\Anaconda3\lib\asyncio\__init__.py", line 8, in <module>
from .base_events import *
File "C:\ProgramData\Anaconda3\lib\asyncio\base_events.py", line 23, in <module>
import socket
File "C:\ProgramData\Anaconda3\lib\socket.py", line 54, in <module>
import os, sys, io, selectors
File "C:\ProgramData\Anaconda3\lib\selectors.py", line 12, in <module>
import select
File "C:\Users\dilim\Desktop\chooseexce\select.py", line 3, in <module>
X = data=np.loadtxt("1.xlsx",delimiter=',',unpack=False)
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\lib\npyio.py", line 1338, in loadtxt
arr = _read(fname, dtype=dtype, comment=comment, delimiter=delimiter,
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\lib\npyio.py", line 999, in _read
arr = _load_from_filelike(
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2 in position 50: illegal multibyte sequence
[I 19:23:20.341 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\ProgramData\Anaconda3\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
from ipykernel import kernelapp as app
File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel\__init__.py", line 5, in <module>
from .connect import * # noqa
File "C:\ProgramData\Anaconda3\lib\site-packages\ipykernel\connect.py", line 11, in <module>
import jupyter_client
File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\__init__.py", line 8, in <module>
from .asynchronous import AsyncKernelClient # noqa
File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\asynchronous\__init__.py", line 1, in <module>
from .client import AsyncKernelClient # noqa
File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\asynchronous\client.py", line 6, in <module>
from jupyter_client.channels import HBChannel
File "C:\ProgramData\Anaconda3\lib\site-packages\jupyter_client\channels.py", line 4, in <module>
import asyncio
File "C:\ProgramData\Anaconda3\lib\asyncio\__init__.py", line 8, in <module>
from .base_events import *
File "C:\ProgramData\Anaconda3\lib\asyncio\base_events.py", line 23, in <module>
import socket
File "C:\ProgramData\Anaconda3\lib\socket.py", line 54, in <module>
import os, sys, io, selectors
File "C:\ProgramData\Anaconda3\lib\selectors.py", line 12, in <module>
import select
File "C:\Users\dilim\Desktop\chooseexce\select.py", line 3, in <module>
X = data=np.loadtxt("1.xlsx",delimiter=',',unpack=False)
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\lib\npyio.py", line 1338, in loadtxt
arr = _read(fname, dtype=dtype, comment=comment, delimiter=delimiter,
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\lib\npyio.py", line 999, in _read
arr = _load_from_filelike(
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2 in position 50: illegal multibyte sequence

Related

Is pyautogui work in the ubuntu 18.04 server version with no display accessed via ssh?

When I am import pyautogui it gives me:
Traceback (most recent call last):
File "app.py", line 2, in <module>
from register import reg
File "/home/nlp/Projects/face_recognition/register.py", line 12, in <module>
import pyautogui
File "/home/nlp/miniconda3/envs/face_recognition_env/lib/python3.6/site-packages/pyautogui/__init__.py", line 241, in <module>
import mouseinfo
File "/home/nlp/miniconda3/envs/face_recognition_env/lib/python3.6/site-packages/mouseinfo/__init__.py", line 223, in <module>
_display = Display(os.environ['DISPLAY'])
File "/home/nlp/miniconda3/envs/face_recognition_env/lib/python3.6/site-packages/Xlib/display.py", line 80, in __init__
self.display = _BaseDisplay(display)
File "/home/nlp/miniconda3/envs/face_recognition_env/lib/python3.6/site-packages/Xlib/display.py", line 62, in __init__
display.Display.__init__(*(self, ) + args, **keys)
File "/home/nlp/miniconda3/envs/face_recognition_env/lib/python3.6/site-packages/Xlib/protocol/display.py", line 58, in __init__
self.socket = connect.get_socket(name, host, displayno)
File "/home/nlp/miniconda3/envs/face_recognition_env/lib/python3.6/site-packages/Xlib/support/connect.py", line 76, in get_socket
return mod.get_socket(dname, host, dno)
File "/home/nlp/miniconda3/envs/face_recognition_env/lib/python3.6/site-packages/Xlib/support/unix_connect.py", line 78, in get_socket
raise error.DisplayConnectionError(dname, str(val))
Xlib.error.DisplayConnectionError: Can't connect to display ":0": [Errno 2] No such file or directory
I have tried this:
import os
os.environ['DISPLAY'] = ':0'
But still same error. According to one comment of to this link (https://github.com/asweigart/pyautogui/issues/161) in github says it is not accessible remotely. I have tried sudo xhost + command but it gives me below error.
xhost: unable to open display ""

import paramiko throws '_sodium' has no function error

Importing paramiko throws following exception on Python3.
Traceback (most recent call last):
File "requirements_check.py", line 117, in <module>
import paramiko
File "/usr/local/lib/python3.5/dist-packages/paramiko/__init__.py", line 22, in <module>
from paramiko.transport import SecurityOptions, Transport
File "/usr/local/lib/python3.5/dist-packages/paramiko/transport.py", line 90, in <module>
from paramiko.ed25519key import Ed25519Key
File "/usr/local/lib/python3.5/dist-packages/paramiko/ed25519key.py", line 22, in <module>
import nacl.signing
File "/usr/local/lib/python3.5/dist-packages/nacl/signing.py", line 17, in <module>
import nacl.bindings
File "/usr/local/lib/python3.5/dist-packages/nacl/bindings/__init__.py", line 17, in <module>
from nacl.bindings.crypto_aead import (
File "/usr/local/lib/python3.5/dist-packages/nacl/bindings/crypto_aead.py", line 28, in <module>
lib.crypto_aead_chacha20poly1305_ietf_keybytes()
AttributeError: cffi library '_sodium' has no function, constant or global variable named 'crypto_aead_chacha20poly1305_ietf_keybytes'
Does anyone know why?
Try uninstalling & reinstalling PyNaCl:
pip uninstall PyNaCl
pip install PyNaCl

cling Jupyter TypeError: readlink: can't specify None for path argument

I guess I need some support on fighting with the following issue:
[I 01:32:06.539 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel 81762983-2e89-47dc-a6f6-5f36d4f25865 restarted
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/bin/jupyter-cling-kernel", line 6, in <module>
exec(compile(open(__file__).read(), __file__, 'exec'))
File "/Users/Alexey/cling/share/cling/Jupyter/kernel/scripts/jupyter-cling-kernel", line 4, in <module>
main()
File "/Users/Alexey/cling/share/cling/Jupyter/kernel/clingkernel.py", line 317, in main
ClingKernelApp.launch_instance()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/traitlets/config/application.py", line 595, in launch_instance
app.initialize(argv)
File "<decorator-gen-122>", line 2, in initialize
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/ipykernel/kernelapp.py", line 421, in initialize
self.init_kernel()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/ipykernel/kernelapp.py", line 360, in init_kernel
user_ns=self.user_ns,
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/traitlets/config/configurable.py", line 405, in instance
inst = cls(*args, **kwargs)
File "/Users/Alexey/cling/share/cling/Jupyter/kernel/clingkernel.py", line 80, in __init__
whichCling = os.readlink(shutil.which('cling'))
TypeError: readlink: can't specify None for path argument
[W 01:32:09.546 NotebookApp] KernelRestarter: restart failed`
In .bash_profile:
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
export PATH
export CUDA_HOME="/usr/local/cuda"
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:$CUDA_HOME/lib"
export PATH="$CUDA_HOME/bin:$PATH"
export PATH="/Developer/cling/bin:$PATH"
Checked everywhere - nothing similar. Thanks in advance.
Try adding the path in .bashrc instead of .bash_profile. Or if you're using any virtual environment start the notebook in your root environment

QT conflict between Anaconda and MacPort

I'm on OS X 10.10.4 with Macports and Anaconda (condo 3.15.1).
During the process of building the robotic simulator ARGoS,
https://github.com/ilpincy/argos3
we ran into runtime 'qt' issues running the ARGoS examples.
[FATAL] Can't load library "/usr/local/lib/argos3/libargos3plugin_simulator_epuck.dylib" even after trying to add extensions for shared library (dylib) and module library (so):
/usr/local/lib/argos3/libargos3plugin_simulator_epuck.dylib: dlopen(/usr/local/lib/argos3/libargos3plugin_simulator_epuck.dylib, 1): Library not loaded: #rpath/./libQtOpenGL.4.dylib
I learned that cmake found 'qt' within Anaconda which had runtime problems.
-- Found Qt4: /Users/davidlaxer/anaconda/bin/qmake (found version "4.8.6")
Next, I installed qt4-mac:
sudo port install qt4-mac
---> Computing dependencies for qt4-mac
---> Fetching archive for qt4-mac
---> Attempting to fetch qt4-mac-4.8.7_0.darwin_14.x86_64.tbz2 from http://packages.macports.org/qt4-mac
---> Attempting to fetch qt4-mac-4.8.7_0.darwin_14.x86_64.tbz2.rmd160 from http://packages.macports.org/qt4-mac
---> Installing qt4-mac #4.8.7_0
---> Activating qt4-mac #4.8.7_0
NOTE: Qt database plugins for mysql55, postgresql91, and sqlite2 are NOT installed by this port; they are installed by qt4-mac-*-plugin instead.
---> Cleaning qt4-mac
---> Updating database of binaries
---> Scanning binaries for linking errors
---> No broken files found.
When I installed 'qt' with Macports, ipython qtconsole broke.
David-Laxers-MacBook-Pro:build_simulator davidlaxer$ ipython qtconsole
Traceback (most recent call last):
File "/Users/davidlaxer/anaconda/bin/ipython", line 6, in <module>
sys.exit(start_ipython())
File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/IPython/__init__.py", line 120, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/IPython/config/application.py", line 573, in launch_instance
app.initialize(argv)
File "<string>", line 2, in initialize
File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/IPython/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 321, in initialize
super(TerminalIPythonApp, self).initialize(argv)
File "<string>", line 2, in initialize
File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/IPython/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/IPython/core/application.py", line 369, in initialize
self.parse_command_line(argv)
File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 316, in parse_command_line
return super(TerminalIPythonApp, self).parse_command_line(argv)
File "<string>", line 2, in parse_command_line
File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/IPython/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/IPython/config/application.py", line 471, in parse_command_line
return self.initialize_subcommand(subc, subargv)
File "<string>", line 2, in initialize_subcommand
File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/IPython/config/application.py", line 75, in catch_config_error
return method(app, *args, **kwargs)
File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/IPython/config/application.py", line 402, in initialize_subcommand
subapp = import_item(subapp)
File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/IPython/utils/importstring.py", line 42, in import_item
module = __import__(package, fromlist=[obj])
File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/IPython/qt/console/qtconsoleapp.py", line 50, in <module>
from IPython.external.qt import QtCore, QtGui
File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/IPython/external/qt.py", line 23, in <module>
QtCore, QtGui, QtSvg, QT_API = load_qt(api_opts)
File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/IPython/external/qt_loaders.py", line 277, in load_qt
result = loaders[api]()
File "/Users/davidlaxer/anaconda/lib/python2.7/site-packages/IPython/external/qt_loaders.py", line 184, in import_pyqt4
from PyQt4 import QtGui, QtCore, QtSvg
ImportError: dlopen(/Users/davidlaxer/anaconda/lib/python2.7/site-packages/PyQt4/QtGui.so, 2): Symbol not found: _iconv
Referenced from: /Users/davidlaxer/anaconda/lib//libxml2.2.dylib
Expected in: /opt/local/lib//libiconv.2.dylib
How is this supposed to work?

Zopeskel ImportError: cannot import name BasicNamespace

I have zopeskel 2.21.2 in my virtualenv python and it works fine. Meanwhile, I also have the same version of zopeskel in my Plone buildout (located in ~/.buildout/eggs). However, it does not work. Running zopeskel --list throws the following error:
ImportError: cannot import name BasicNamespace
An advice from this link says to remove the egg. I have removed the egg as well as the cached package in ~/.buildout/cache/dist/ and ran buildout again. However, the problem persists. The funny thing is that the paster script in the same buildout is working.
My zopeskel section in buildout.cfg looks like below:
[zopeskel]
recipe = zc.recipe.egg
eggs =
ZopeSkel
Paste
PasteDeploy
PasteScript
zopeskel.dexterity
${instance:eggs}
Some package versions used in my buildout:
'/home/user/.buildout/eggs/Paste-1.7.5.1-py2.6.egg',
'/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg',
'/home/user/.buildout/eggs/PasteDeploy-1.3.4-py2.6.egg',
'/home/user/.buildout/eggs/PasteScript-1.7.4.2-py2.6.egg',
Full traceback:
[user#rizal myplone.site]$ ./bin/zopeskel --list
Traceback (most recent call last):
File "./bin/zopeskel", line 346, in <module>
import zopeskel.zopeskel_script
File "/home/user/.buildout/eggs/ZopeSkel-2.21.2-py2.6.egg/zopeskel/__init__.py", line 2, in <module>
from zopeskel.basic_namespace import BasicNamespace
File "/home/user/.buildout/eggs/ZopeSkel-2.21.2-py2.6.egg/zopeskel/basic_namespace.py", line 2, in <module>
from zopeskel.vars import var, DottedVar, StringVar, BooleanVar, TextVar
File "/home/user/.buildout/eggs/ZopeSkel-2.21.2-py2.6.egg/zopeskel/vars.py", line 2, in <module>
from paste.script.templates import var as base_var
File "/home/user/.buildout/eggs/PasteScript-1.7.4.2-py2.6.egg/paste/script/templates.py", line 6, in <module>
import copydir
File "/home/user/.buildout/eggs/PasteScript-1.7.4.2-py2.6.egg/paste/script/copydir.py", line 4, in <module>
import pkg_resources
File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 2727, in <module>
add_activation_listener(lambda dist: dist.activate())
File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 700, in subscribe
callback(dist)
File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 2727, in <lambda>
add_activation_listener(lambda dist: dist.activate())
File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 2230, in activate
map(declare_namespace, self._get_metadata('namespace_packages.txt'))
File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 1827, in declare_namespace
_handle_ns(packageName, path_item)
File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 1797, in _handle_ns
loader.load_module(packageName); module.__path__ = path
File "/usr/lib/python2.6/pkgutil.py", line 238, in load_module
mod = imp.load_module(fullname, self.file, self.filename, self.etc)
File "/home/user/.buildout/eggs/ZopeSkel-2.21.2-py2.6.egg/zopeskel/__init__.py", line 2, in <module>
from zopeskel.basic_namespace import BasicNamespace
ImportError: cannot import name BasicNamespace
What could be wrong?
This usually happens you have ZopeSkel / Paster installed both locally (buildout) and in the global Python installation. Due to failures in Python process of managing site packages you end up with an incompatible combiation.
Solution:
http://docs.plone.org/manage/troubleshooting/exceptions.html#from-zopeskel-basic-namespace-import-basicnamespace

Resources