Here I get an error when I run script with Jupyter notebook and I try many approaches to solve it, but not succesful.
When I followed Failed to start the kernel on jupyter notebook to configue my jupyter file, but inefficient. And then I followed Failed to start the Kernel - Jupyter in VS Code, Jupyter - failed to start the kernel and vscode jupyter failed to start kernel aslo inefficient. Indeed, I am troubled by this question two days and I can't tolerate this. Who can help me?
here is a piuture about this question reminder information
Failed to start the Kernel.
Traceback (most recent call last):
File "/home/bio_kang/software/anaconda3/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/bio_kang/software/anaconda3/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/bio_kang/software/anaconda3/lib/python3.9/site-packages/ipykernel_launcher.py", line 15, in <module>
from ipykernel import kernelapp as app
File "/home/bio_kang/software/anaconda3/lib/python3.9/site-packages/ipykernel/__init__.py", line 2, in <module>
from .connect import *
File "/home/bio_kang/software/anaconda3/lib/python3.9/site-packages/ipykernel/connect.py", line 10, in <module>
import jupyter_client
File "/home/bio_kang/software/anaconda3/lib/python3.9/site-packages/jupyter_client/__init__.py", line 4, in <module>
from .connect import *
File "/home/bio_kang/software/anaconda3/lib/python3.9/site-packages/jupyter_client/connect.py", line 16, in <module>
import tempfile
File "/home/bio_kang/software/anaconda3/lib/python3.9/tempfile.py", line 45, in <module>
from random import Random as _Random
File "/home/bio_kang/Learning/Python/random.py", line 2, in <module>
import pandas as pd
File "/home/bio_kang/software/anaconda3/lib/python3.9/site-packages/pandas/__init__.py", line 16, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
numpy: cannot import name SystemRandom.
View Jupyter log for further details.
Related
I try to activate my env to Jupyter notebook by using:
python -m ipykernel install --user --name native --display-name "python-gpu"
But error message:
Traceback (most recent call last):
File "/Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/site-packages/ipykernel/__main__.py", line 2, in <module>
from ipykernel import kernelapp as app
File "/Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/site-packages/ipykernel/kernelapp.py", line 18, in <module>
from IPython.core.application import (
File "/Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/site-packages/IPython/__init__.py", line 53, in <module>
from .terminal.embed import embed
File "/Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/site-packages/IPython/terminal/embed.py", line 15, in <module>
from IPython.core.interactiveshell import DummyMod, InteractiveShell
File "/Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 73, in <module>
from IPython.core.history import HistoryManager
File "/Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/site-packages/IPython/core/history.py", line 11, in <module>
import sqlite3
File "/Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/sqlite3/__init__.py", line 57, in <module>
from sqlite3.dbapi2 import *
File "/Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: dlopen(/Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/lib-dynload/_sqlite3.cpython-310-darwin.so, 0x0002): Symbol not found: _sqlite3_enable_load_extension
Referenced from: /Users/nianhua/opt/anaconda3/envs/native/lib/python3.10/lib-dynload/_sqlite3.cpython-310-darwin.so
Expected in: /usr/lib/libsqlite3.dylib
It seems like something is wrong with my libsqlite3, but it goes well in my terminal.
My laptop is a Macbook pro with M1Pro. And I'm building an arm64 python environment in M1 version Anaconda.
Does anyone know how I can get around this?
I had the same problem and I solved by installing a newer version:
mamba install sqlite=3.40.0
always checking that the new library is coming from conda-forge/osx-arm64.
Jupyter notebook was installed with conda.
When notebook file is run, I have this "KernelRestarter: restart failed" error.
All error messages are as follows.
KernelRestarter: restarting kernel (4/5), new random ports
Traceback (most recent call last):
File "/home/itc/anaconda3/envs/fastai/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/home/itc/anaconda3/envs/fastai/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/itc/anaconda3/envs/fastai/lib/python3.6/site-packages/ipykernel_launcher.py", line 15, in <module>
from ipykernel import kernelapp as app
File "/home/itc/anaconda3/envs/fastai/lib/python3.6/site-packages/ipykernel/__init__.py", line 2, in <module>
from .connect import *
File "/home/itc/anaconda3/envs/fastai/lib/python3.6/site-packages/ipykernel/connect.py", line 13, in <module>
from IPython.core.profiledir import ProfileDir
File "/home/itc/anaconda3/envs/fastai/lib/python3.6/site-packages/IPython/__init__.py", line 49, in <module>
from .terminal.embed import embed
File "/home/itc/anaconda3/envs/fastai/lib/python3.6/site-packages/IPython/terminal/embed.py", line 18, in <module>
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File "/home/itc/anaconda3/envs/fastai/lib/python3.6/site-packages/IPython/terminal/interactiveshell.py", line 20, in <module>
from prompt_toolkit.shortcuts import create_prompt_application, create_eventloop, create_prompt_layout, create_output
ImportError: cannot import name 'create_prompt_application'
Looking at the same problem as me. The ipykernel of my virtual environment cannot be started because of the wrong version of the component.
now fixed it.
pip3 install -U ipykernel
I try opening Spyder and I get the following error regarding the Kernel, I have just tried many solutions that were posted in similar threads but I still cannot fix the problem. I also removed Anaconda, and Spyder, and re-installed everything, with no success.
Please help.
Thank you !
An error ocurred while starting the kernel
Traceback (most recent call last):
File "C:\Users\7265\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\7265\Anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\7265\Anaconda3\lib\site‑packages\spyder_kernels\console\__main__.py", line 11, in
start.main()
File "C:\Users\7265\Anaconda3\lib\site‑packages\spyder_kernels\console\start.py", line 289, in main
import_spydercustomize()
File "C:\Users\7265\Anaconda3\lib\site‑packages\spyder_kernels\console\start.py", line 39, in import_spydercustomize
import spydercustomize
File "C:\Users\7265\Anaconda3\lib\site‑packages\spyder_kernels\customize\spydercustomize.py", line 24, in
from IPython.core.getipython import get_ipython
File "C:\Users\7265\Anaconda3\lib\site‑packages\IPython\__init__.py", line 56, in
from .terminal.embed import embed
File "C:\Users\7265\Anaconda3\lib\site‑packages\IPython\terminal\embed.py", line 14, in
from IPython.core.magic import Magics, magics_class, line_magic
File "C:\Users\7265\Anaconda3\lib\site‑packages\IPython\core\magic.py", line 20, in
from . import oinspect
File "C:\Users\7265\Anaconda3\lib\site‑packages\IPython\core\oinspect.py", line 30, in
from IPython.lib.pretty import pretty
File "C:\Users\7265\Anaconda3\lib\site‑packages\IPython\lib\pretty.py", line 82, in
import datetime
File "C:\Users\7265\datetime.py", line 8,
in
from datetime import timedelta as delta
ImportError: cannot import name 'timedelta' from 'datetime' (C:\Users\7265\datetime.py)
I installed Anaconda3 on ubuntu and changed the path to ~/anaconda/bin in .bashrc file then I'm trying to install keras It's throwing this error.
hemanth#specter:~$ python3 -m pip install keras
Traceback (most recent call last):
File "/home/hemanth/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/home/hemanth/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/hemanth/anaconda3/lib/python3.7/site-packages/pip/__main__.py", line 16, in <module>
from pip._internal import main as _main # isort:skip # noqa
File "/home/hemanth/anaconda3/lib/python3.7/site-packages/pip/_internal/__init__.py", line 19, in <module>
from pip._vendor.urllib3.exceptions import DependencyWarning
File "/home/hemanth/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/home/hemanth/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/connectionpool.py", line 7, in <module>
from socket import error as SocketError, timeout as SocketTimeout
File "/home/hemanth/anaconda3/lib/python3.7/socket.py", line 49, in <module>
import _socket
ModuleNotFoundError: No module named '_socket'
I tried this command and it is working fine.
however, try to install socket using pip install sockets and then again try installing keras.
I am trying to launch Jupyter notebook through my command line and run a python script. At first I was able to launch it via the terminal and run the script, but now the kernel does not launch and it gives me this error - "No module named prompt_toolkit.enums"
This is teh whole message from the terminal -
[I 20:33:38.256 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel 151cba82-fb9a-4cfc-ba38-3df3f6f5bb61 restarted
Traceback (most recent call last):
File "/Users/aparihar/anaconda2/lib/python2.7/runpy.py", line 163, in _run_module_as_main
mod_name, _Error)
File "/Users/aparihar/anaconda2/lib/python2.7/runpy.py", line 111, in _get_module_details
__import__(mod_name) # Do not catch exceptions initializing package
File "/Users/aparihar/anaconda2/lib/python2.7/site-packages/ipykernel/__init__.py", line 2, in <module>
from .connect import *
File "/Users/aparihar/anaconda2/lib/python2.7/site-packages/ipykernel/connect.py", line 13, in <module>
from IPython.core.profiledir import ProfileDir
File "/Users/aparihar/anaconda2/lib/python2.7/site-packages/IPython/__init__.py", line 49, in <module>
from .terminal.embed import embed
File "/Users/aparihar/anaconda2/lib/python2.7/site-packages/IPython/terminal/embed.py", line 17, in <module>
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File "/Users/aparihar/anaconda2/lib/python2.7/site-packages/IPython/terminal/interactiveshell.py", line 16, in <module>
from prompt_toolkit.enums import DEFAULT_BUFFER, EditingMode
ImportError: No module named prompt_toolkit.enums
I read a lot of questions posted here and on github but i am just not able to resolve this. I even shutdown all the sessions, used pip to install enums and relaunched the Chrome and terminal. Can someone please help?
Thanks!