Fedora 21, default Python is 2.7, 3.x installed, originally installed iPython, now have also installed Jupyter
When I try to use the Python3 kernel from Jupyter notebook, I get a message saying the kernel has died, attempting restart. Naturally restart never succeeds.
Tried following these 2 terminal commands
ipython kernelspec install-self
ipython3 kernelspec install-self
first command executes without error. second gives this error
ipython3 kernelspec install-self
I used iPython with Python 3 kernel in the past, before installing Jupyter. I don't remember installing ipython3 to do so.
Suggestions how to resolve? I have searched and the above was the only suggestion I found that was not based on using Anaconda.
Also, I do have kernel.json at
~/.ipython/kernels/python3
thank you
UPDATE
last output on terminal when kernel dies
ImportError: No module named 'ptyprocess'
UPDATE2 traceback error
[xxxxx#localhost ~]$ sudo ipython3 kernelspec install-self
Traceback (most recent call last):
File "/bin/ipython3", line 7, in <module>
from IPython import start_ipython
File "/usr/lib/python3.4/site-packages/IPython/__init__.py", line 47, in <module>
from .core.application import Application
File "/usr/lib/python3.4/site-packages/IPython/core/application.py", line 24, in <module>
from IPython.core import release, crashhandler
File "/usr/lib/python3.4/site-packages/IPython/core/crashhandler.py", line 28, in <module>
from IPython.core import ultratb
File "/usr/lib/python3.4/site-packages/IPython/core/ultratb.py", line 116, in <module>
from IPython.utils import path as util_path
File "/usr/lib/python3.4/site-packages/IPython/utils/path.py", line 19, in <module>
from IPython.utils.process import system
File "/usr/lib/python3.4/site-packages/IPython/utils/process.py", line 19, in <module>
from ._process_posix import system, getoutput, arg_split, check_pid
File "/usr/lib/python3.4/site-packages/IPython/utils/_process_posix.py", line 24, in <module>
import pexpect
File "/usr/lib/python3.4/site-packages/pexpect/__init__.py", line 75, in <module>
from .pty_spawn import spawn, spawnu
File "/usr/lib/python3.4/site-packages/pexpect/pty_spawn.py", line 11, in <module>
import ptyprocess
ImportError: No module named 'ptyprocess'
UPDATE3:
after installing ptyprocess with pip3 new error when trying to create notebook with Python 3...No module named 'path'
[I 22:29:26.125 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel 1ae58a7d-096b-4dc1-b29a-bee4385e4e9a restarted
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.4/site-packages/IPython/__init__.py", line 48, in <module>
from .terminal.embed import embed
File "/usr/lib/python3.4/site-packages/IPython/terminal/embed.py", line 16, in <module>
from IPython.core.interactiveshell import DummyMod
File "/usr/lib/python3.4/site-packages/IPython/core/interactiveshell.py", line 31, in <module>
from pickleshare import PickleShareDB
File "/usr/lib/python3.4/site-packages/pickleshare.py", line 41, in <module>
from path import path as Path
ImportError: No module named 'path'
[W 22:29:29.137 NotebookApp] KernelRestarter: restart failed
I've just been installing python, ipython, upyter and pyspark as a kernel. I run into some troubles that seem to be close to what you are having. Many times that I used "sudo ..." I would get the wrong python version. I think somehow sudo run commands without a shell, so if you have any configuration (path, python version,etc), you may not get it applied when using sudo. Something you could do is to run "sudo python", then see if you can import the module path. Also you could try to run "sudo which python" to make sure it's the right version. I found that even if the user had python 2.7 installed, sudo would use python 2.6. For me the best thing to do was to log in as root and do the installation without sudo...
I have just started learning python with the jupyter notebook, and I came across the same problem you did. An associate found the problem - I had crated a python program random.py and saved it into my Python directory. Since random is also the name of a module that I installed, an error message was generated in the Anaconda prompt window. Please check your directories for .py files named after reserved words and modules.
Related
When I try running a Python Interactive Window in VS Code i get the error message:
Jupyter notebook failed to launch.
Error: Traceback (most recent call last):
File "C:\Users\Parker\AppData\Local\Programs\Python\Python37\lib\site-packages\nbformat\validator.py", line 12, in <module>
from jsonschema import ValidationError
File "C:\Users\Parker\AppData\Roaming\Python\Python37\site-packages\jsonschema\__init__.py", line 11, in <module>
from jsonschema.exceptions import (
File "C:\Users\Parker\AppData\Roaming\Python\Python37\site-packages\jsonschema\exceptions.py", line 9, in <module>
import attr
ModuleNotFoundError: No module named 'attr'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\Users\Parker\.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\vscode_datascience_helpers\daemon\daemon_python.py", line 54, in _decorator
return func(self, *args, **kwargs)
File "c:\Users\Parker\.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\vscode_datascience_helpers\jupyter_daemon.py", line 105, in m_exec_module_observable
self._start_notebook(args, cwd, env)
File "c:\Users\Parker\.vscode\extensions\ms-python.python-2020.5.80290\pythonFiles\vscode_datascience_helpers\jupyter_daemon.py", line 147, in _start_notebook
from notebook import notebookapp as app
File "C:\Users\Parker\AppData\Local\Programs\Python\Python37\lib\site-packages\notebook\notebookapp.py", line 83, in <module>
from .services.contents.manager import ContentsManager
File "C:\Users\Parker\AppData\Local\Programs\Python\Python37\lib\site-packages\notebook\services\contents\manager.py", line 17, in <module>
from nbformat import sign, validate as validate_nb, ValidationError
File "C:\Users\Parker\AppData\Local\Programs\Python\Python37\lib\site-packages\nbformat\__init__.py", line 33, in <module>
from .validator import validate, ValidationError
File "C:\Users\Parker\AppData\Local\Programs\Python\Python37\lib\site-packages\nbformat\validator.py", line 23, in <module>
raise ImportError(str(e) + verbose_msg)
ImportError: No module named 'attr'
Jupyter notebook format depends on the jsonschema package:
https://pypi.python.org/pypi/jsonschema
Please install it first.
Failed to run jupyter as observable with args notebook --no-browser --notebook-dir=C:\Users\Parker\AppData\Local\Temp\e74520b3-6a8d-4e0a-8f80-8ddf2a64bf70 --config=C:\Users\Parker\AppData\Local\Temp\e74520b3-6a8d-4e0a-8f80-8ddf2a64bf70\jupyter_notebook_config.py --NotebookApp.iopub_data_rate_limit=10000000000.0
There was another thread about this same problem here: Can't use Jupyter Notebook: jsonschema apparently missing, however, after following all the steps in the solution the error persist. If anyone might be able to provide a possible solution, I'd greatly appreciate it.
You need to install jupyter notebook seperately in code.
description is given: Jupyter notebook
So I ended up uninstalling and reinstalling Anaconda and VS Code and it fixed the problem.
EDIT: Akshat Zala helped me find the underlying problem. I was trying to run the Interactive Window in a brand new Anaconda environment. This means I did not have Jupyter Notebook installed on it yet, therefore, the interactive window would not work. I fixed this issue by activating the conda environment then running the command 'conda install -c conda-forge notebook'.
I am using Macbook and was running the Jupyter server fine in the past. For nearly 3 weeks I didn't use it, and now having trouble as it isn't running.
$ jupyter notebook
Traceback (most recent call last):
File "/usr/local/bin/jupyter-notebook", line 6, in <module>
from notebook.notebookapp import main
File "/usr/local/lib/python3.7/site-packages/notebook/notebookapp.py", line 62, in <module>
from tornado import httpserver
File "/usr/local/lib/python3.7/site-packages/tornado/httpserver.py", line 29, in <module>
import ssl
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 98, in <module>
import _ssl # if we can't import it, let the error propagate
ImportError: dlopen(/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_ssl.cpython-37m-darwin.so, 2): Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Referenced from: /usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_ssl.cpython-37m-darwin.so
Reason: image not found
Uninstall and re-installing jupyter didn't fix it.
MacOS Catalina
Version 10.15.2 (19C57)
Any idea how to fix this?
Looks like a problem with your brew-installed openssl, try this: https://github.com/kelaberetiv/TagUI/issues/86
That being said, I have had issues in the past where homebrew updates my python version and breaks everything, so it might be worth investigating that as well
I installed Anaconda on my machine yesterday and installed the Anaconda Extention Pack in VSC, when I try this:
Code:
import numpy as ny
I get this error:
Traceback (most recent call last):
File "e:/Python/Testing/VSC with Anaconda/packagetest.py", line 1, in <module>
import numpy as ny
File "E:\Anaconda\lib\site-packages\numpy\__init__.py", line 140, in <module>
from . import _distributor_init
File "E:\Anaconda\lib\site-packages\numpy\_distributor_init.py", line 34, in <module>
from . import _mklinit
ImportError: DLL load failed: The specified module could not be found.
Please help me fix this.
A very common reason for this error is that the conda environment hasn't been properly activated. This can be done by either using the "Anaconda prompt" or by e.g. starting the cmd shell and then running C:\users\user_name>conda activate. This will change the prompt to (base) C:\users\user_name> and add serveral Anaconda subfolders to the PATH. Then Python should be started from there via (base) C:\users\user_name> python. Without activation numpy won't find it's DLL's.
I am trying to start Spyder from Anaconda on a Mac, but get the error below. As a result, Spyder does not launch. The same error arises if I try to launch Spyder from the terminal.
Any ideas on the cause of the error and/or how to solve it? There have been similar questions in the past but the errors were different, that's why I am reposting.
Versions:
Spyder - 3.2.8
Anaconda - 1.8.3
Python - 3.6.5
Traceback (most recent call last):
File "/anaconda3/bin/spyder", line 7, in
from spyder.app.start import main
File "/anaconda3/lib/python3.6/site-packages/spyder/app/start.py", line 27, in
from spyder.config.main import CONF
File "/anaconda3/lib/python3.6/site-packages/spyder/config/main.py", line 22, in
from spyder.config.user import UserConfig
File "/anaconda3/lib/python3.6/site-packages/spyder/config/user.py", line 26, in
from spyder.utils.programs import check_version
File "/anaconda3/lib/python3.6/site-packages/spyder/utils/programs.py", line 18, in
import subprocess
File "/anaconda3/lib/python3.6/subprocess.py", line 136, in
import _posixsubprocess
ImportError: dlopen(/anaconda3/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-darwin.so, 2): Symbol not found: __Py_set_inheritable_async_safe
Referenced from: /anaconda3/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-darwin.so
Expected in: flat namespace
in /anaconda3/lib/python3.6/lib-dynload/_posixsubprocess.cpython-36m-darwin.so
you might have to downgrad python to 3.6.4.
or:
run this command:
conda update python python.app
I am on OS X 10.11.2, Anaconda Python 2.7.10.
I was installing some dependencies, and suddenly, my conda command started not working at all. Many people suggest conda install python=2.7.10 but when I try that (or any command, even just conda) I get:
Traceback (most recent call last): File
"/Users/Can/anaconda/bin/conda", line 5, in
sys.exit(main()) File "/Users/Can/anaconda/lib/python2.7/site-packages/conda/cli/main.py",
line 106, in main
from conda.cli import conda_argparse File "/Users/Can/anaconda/lib/python2.7/site-packages/conda/cli/conda_argparse.py",
line 16, in
from conda.cli.find_commands import find_commands, find_executable File
"/Users/Can/anaconda/lib/python2.7/site-packages/conda/cli/find_commands.py",
line 9, in
from conda.utils import memoized File "/Users/Can/anaconda/lib/python2.7/site-packages/conda/utils.py", line
10, in
import tempfile File "/Users/Can/anaconda/lib/python2.7/tempfile.py", line 32, in
import io as _io File "/Users/Can/anaconda/lib/python2.7/io.py", line 51, in
import _io ImportError: dlopen(/Users/Can/anaconda/lib/python2.7/lib-dynload/_io.so, 2):
Symbol not found: __PyCodecInfo_GetIncrementalDecoder Referenced
from: /Users/Can/anaconda/lib/python2.7/lib-dynload/_io.so Expected
in: dynamic lookup
How can I repair conda, without using conda itself (as I can't)?
UPDATE: I've completely uninstalled and reinstalled Anaconda. It still gives the same error. I've tried pip and it also fails with the same error. I verify it's Anaconda's pip as which pip returns /Users/Can/anaconda2/bin/pip. Why is Anaconda broken?
I had the same issue, it is successfully fixed by just replacing the _io.so file.
sudo find / -name _io.so
copy the path of the _io.so file which DOES NOT belong to python-2.7.11. For example, copy the path of _io.so which is under python-2.7.5:
/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
Replace the '/Users/Can/anaconda/lib/python2.7/lib-dynload/_io.so' file with the _io.so that you just found.
cp /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so /Users/Can/anaconda/lib/python2.7/lib-dynload/
Then it will work.