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.
Related
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.
After I tried to install and register a new virtual environment so I can use it in Jupyter notebook, I ended up with the following problem: any notebook I open or create it displays the error message: "Could not find a kernel matching Python 3. Please select a kernel:"
but there are no kernels registered anymore ...
I couldn't find a good answer although I noticed that many others faced the same problem in the past. Anyone could help?
I am using Ubuntu and pip.
It seems to be a configuration problem with Jupyter.
$ jupyter --paths --debug
JUPYTER_PREFER_ENV_PATH is not set, making the user-level path preferred over the environment-level path for data and config
JUPYTER_NO_CONFIG is not set, so we use the full path list for config
JUPYTER_CONFIG_PATH is not set, so we do not prepend anything to the config paths
JUPYTER_CONFIG_DIR is not set, so we use the default user-level config directory
JUPYTER_PATH is not set, so we do not prepend anything to the data paths
JUPYTER_DATA_DIR is not set, so we use the default user-level data directory
JUPYTER_RUNTIME_DIR is not set, so we use the default runtime directory
config:
/home/florian/.jupyter
/home/florian/..../OCR/ocr_env/etc/jupyter
/usr/local/etc/jupyter
/etc/jupyter
data:
/home/florian/.local/share/jupyter
jupyter kernelspec list
Available kernels:
ocr_env /home/florian/.local/share/jupyter/kernels/ocr_env
python3 /home/florian/.local/share/jupyter/kernels/python3
spark_env /home/florian/.local/share/jupyter/kernels/spark_env
tensorflow /home/florian/.local/share/jupyter/kernels/tensorflow
Another error trying to upgrade pip:
python -m pip install --upgrade pip
Traceback (most recent call last):
File "/home/florian/anaconda3/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/florian/anaconda3/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/__main__.py", line 23, in <module>
from pip._internal.cli.main import main as _main # isort:skip # noqa
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py", line 23, in <module>
from pip._internal.cli.progress_bars import BAR_TYPES
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/cli/progress_bars.py", line 12, in <module>
from pip._internal.utils.logging import get_indentation
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/utils/logging.py", line 18, in <module>
from pip._internal.utils.misc import ensure_dir
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/utils/misc.py", line 33, in <module>
from pip._internal.locations import (
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/locations/__init__.py", line 9, in <module>
from . import _distutils, _sysconfig
File "/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/locations/_sysconfig.py", line 8, in <module>
from pip._internal.exceptions import InvalidSchemeCombination, UserInstallationInvalid
ImportError: cannot import name 'InvalidSchemeCombination' from 'pip._internal.exceptions' (/home/florian/anaconda3/lib/python3.8/site-packages/pip/_internal/exceptions.py)
Seems I found a solution like this below:
pip3 install --force-reinstall jupyter_client
julia> import Pkg; Pkg.add("IJulia")
julia> using IJulia
julia> IJulia.notebook
💚 ❤️ 💜
Reference:
julia> is running julia.app on macOS
https://github.com/JuliaLang/IJulia.jl/issues/968#issuecomment-739800974
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 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 have a relatively fresh installation of anaconda, in which I installed rpy2 using "conda install rpy2". However, when I try running it, I get this error, e.g.:
> /[dir]/anaconda/bin/python -m 'rpy2.tests'
Traceback (most recent call last):
File "/[dir]/anaconda/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/[dir]/anaconda/lib/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "[dir]/anaconda/lib/python2.7/site-packages/rpy2/tests.py", line 23, in <module>
import rpy2.tests_rpy_classic
File "/[dir]/anaconda/lib/python2.7/site-packages/rpy2/tests_rpy_classic.py", line 3, in <module>
import rpy2.rpy_classic as rpy
File "/[dir]/anaconda/lib/python2.7/site-packages/rpy2/rpy_classic.py", line 5, in <module>
import rpy2.rinterface as ri
File "/[dir]/anaconda/lib/python2.7/site-packages/rpy2/rinterface/__init__.py", line 92, in <module>
from rpy2.rinterface._rinterface import (baseenv,
ImportError: libiconv.so.2: cannot open shared object file: No such file or directory
What is this libiconv.so.2, and why doesn't it work straight from the box?
I think you need to conda install -c r libiconv or perhaps install r-essentials, which contains libiconv.