Why isn't Juypter notebook working on my raspberry pi - raspberry-pi

I have installed Jupyter notebook on a fresh install of debian for pi. I had it working perfectly on a previous install. I do not understand why it is not working on this install. Kernal will not start.
#raspberrypi:~ $ jupyter notebook
[I 14:14:54.030 NotebookApp] Serving notebooks from local directory: /home/pi
[I 14:14:54.031 NotebookApp] The Jupyter Notebook is running at:
[I 14:14:54.031 NotebookApp] http://localhost:8888/?token=3d0f751a532a4e1a3744a1a49701fbde9a17d1d95fda43ca
[I 14:14:54.032 NotebookApp] or http://127.0.0.1:8888/?token=3d0f751a532a4e1a3744a1a49701fbde9a17d1d95fda43ca
[I 14:14:54.033 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 14:14:54.249 NotebookApp]
To access the notebook, open this file in a browser:
file:///home/pi/.local/share/jupyter/runtime/nbserver-837-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=3d0f751a532a4e1a3744a1a49701fbde9a17d1d95fda43ca
or http://127.0.0.1:8888/?token=3d0f751a532a4e1a3744a1a49701fbde9a17d1d95fda43ca
[I 14:15:26.196 NotebookApp] Kernel started: 9c892a78-7ef2-4d36-9649-d46392e26bb7
Traceback (most recent call last):
File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib/python3/dist-packages/ipykernel_launcher.py", line 15, in <module>
from ipykernel import kernelapp as app
File "/usr/lib/python3/dist-packages/ipykernel/__init__.py", line 2, in <module>
from .connect import *
File "/usr/lib/python3/dist-packages/ipykernel/connect.py", line 13, in <module>
from IPython.core.profiledir import ProfileDir
File "/usr/lib/python3/dist-packages/IPython/__init__.py", line 49, in <module>
from .terminal.embed import embed
File "/usr/lib/python3/dist-packages/IPython/terminal/embed.py", line 18, in <module>
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File "/usr/lib/python3/dist-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' from 'prompt_toolkit.shortcuts' (/usr/local/lib/python3.7/dist-packages/prompt_toolkit/shortcuts/__init__.py)
[I 14:15:32.162 NotebookApp] KernelRestarter: restarting kernel (1/5), keep random ports
Traceback (most recent call last):
File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib/python3/dist-packages/ipykernel_launcher.py", line 15, in <module>
from ipykernel import kernelapp as app
File "/usr/lib/python3/dist-packages/ipykernel/__init__.py", line 2, in <module>
from .connect import *
File "/usr/lib/python3/dist-packages/ipykernel/connect.py", line 13, in <module>
from IPython.core.profiledir import ProfileDir
File "/usr/lib/python3/dist-packages/IPython/__init__.py", line 49, in <module>
from .terminal.embed import embed
File "/usr/lib/python3/dist-packages/IPython/terminal/embed.py", line 18, in <module>
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File "/usr/lib/python3/dist-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' from 'prompt_toolkit.shortcuts' (/usr/local/lib/python3.7/dist-packages/prompt_toolkit/shortcuts/__init__.py)
[I 14:15:35.190 NotebookApp] KernelRestarter: restarting kernel (2/5), keep random ports
$
Is anyone able to shine some light on my situation?

change the ownership of the ~/.local/share/jupyter directory from root to pi using below cmd:
sudo chown -R pi:pi ~/.local/share/jupyter

Please Run this command if your kernel does not start or shows any issue it worked for me
"pip3 install --force-reinstall --upgrade jupyter"

Related

Import Error of IBM Watson Natural Language Understanding API

I am now trying to extract keywords by using IBM Watson Natural Language Understanding API. I follow the instruction and have installed the watson_developer_cloud. However, I met an error when import the NaturalLanguageUnderstandingV1. Could you help me with it? Thank you!
from watson_developer_cloud import NaturalLanguageUnderstandingV1
Traceback (most recent call last):
File "<ipython-input-11-ab5aa6f014f4>", line 1, in <module>
from watson_developer_cloud import NaturalLanguageUnderstandingV1
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-
packages\watson_developer_cloud\__init__.py", line 30, in <module>
rom .speech_to_text_v1 import SpeechToTextV1
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-
packages\watson_developer_cloud\speech_to_text_v1.py", line 74, in <module>
from watson_developer_cloud.websocket import RecognizeCallback, RecognizeListener
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-packages\watson_developer_cloud\websocket\__init__.py", line 18, in <module>
from .speech_to_text_websocket_listener import RecognizeListener
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-packages\watson_developer_cloud\websocket\speech_to_text_websocket_listener.py", line 21, in <module>
from twisted.internet import ssl, reactor
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-packages\twisted\internet\ssl.py", line 59, in <module>
from OpenSSL import SSL
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-packages\OpenSSL\__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-packages\OpenSSL\crypto.py", line 16, in <module>
from OpenSSL._util import (
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-packages\OpenSSL\_util.py", line 6, in <module>
from cryptography.hazmat.bindings.openssl.binding import Binding
File "C:\Users\yipin\Anaconda3\envs\tensorflow\lib\site-packages\cryptography\hazmat\bindings\openssl\binding.py", line 13, in <module>
from cryptography.hazmat.bindings._openssl import ffi, lib
ImportError: DLL load failed: The operating system cannot run %1.
After reinstalling the watson-cloud-developer as an administrator. I solve the problem. It seems that if we do not run the pip install command as an administrator, then the package cannot be installed correctly.

Docker-compose ps error

I am new to docker-compose and getting the following error when I type in docker-compose ps.
Traceback (most recent call last):
File "/usr/local/bin/docker-compose", line 7, in <module>
from compose.cli.main import main
File "/Library/Python/2.7/site-packages/compose/cli/main.py", line 20, in <module>
from ..bundle import get_image_digests
File "/Library/Python/2.7/site-packages/compose/bundle.py", line 14, in <module>
from .service import format_environment
File "/Library/Python/2.7/site-packages/compose/service.py", line 37, in <module>
from .parallel import parallel_execute
File "/Library/Python/2.7/site-packages/compose/parallel.py", line 10, in <module>
from six.moves import _thread as thread
ImportError: cannot import name _thread
Docker-compose is written by python. It seems that you miss some python packages. You can refer to the following page of how to fix the python lib issue.
Matplotlib issue on OS X ("ImportError: cannot import name _thread")
Alternatively, you can try to install docker-compose as a container, the docker container contains appropriate environment for docker-compose.
https://docs.docker.com/compose/install/#install-as-a-container

pylint errors when using liclipse

PyLint: Executing command line: /usr/local/bin/pylint --rcfile=/Users/amansehgal/.rcfile --include-ids=y /Users/amansehgal/Documents/cis519/hw3_skeleton/boostedDT.py
PyLint: The stdout of the command line is:
PyLint: The stderr of the command line is: Traceback (most recent call last):
File "/usr/local/bin/pylint", line 11, in <module>
sys.exit(run_pylint())
File "/Library/Python/2.7/site-packages/pylint/__init__.py", line 12, in run_pylint
from pylint.lint import Run
File "/Library/Python/2.7/site-packages/pylint/lint.py", line 34, in <module>
import astroid
File "/Library/Python/2.7/site-packages/astroid/__init__.py", line 54, in <module>
from astroid.nodes import *
File "/Library/Python/2.7/site-packages/astroid/nodes.py", line 54, in <module>
from astroid.scoped_nodes import (
File "/Library/Python/2.7/site-packages/astroid/scoped_nodes.py", line 25, in <module>
import io
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
Expected in: flat namespace
in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
PyLint: Executing command line: /usr/local/bin/pylint --rcfile=/Users/amansehgal/.rcfile --include-ids=y /Users/amansehgal/Documents/cis519/hw3_skeleton/boostedDT.py
PyLint: The stdout of the command line is:
PyLint: The stderr of the command line is: Traceback (most recent call last):
File "/usr/local/bin/pylint", line 11, in <module>
sys.exit(run_pylint())
File "/Library/Python/2.7/site-packages/pylint/__init__.py", line 12, in run_pylint
from pylint.lint import Run
File "/Library/Python/2.7/site-packages/pylint/lint.py", line 34, in <module>
import astroid
File "/Library/Python/2.7/site-packages/astroid/__init__.py", line 54, in <module>
from astroid.nodes import *
File "/Library/Python/2.7/site-packages/astroid/nodes.py", line 54, in <module>
from astroid.scoped_nodes import (
File "/Library/Python/2.7/site-packages/astroid/scoped_nodes.py", line 25, in <module>
import io
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
Expected in: flat namespace
in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
I get this error when trying to run pyLint in LiClipse and using the option redirect messages to console. I ran the line on a command prompt without any errors. So the issue is with LiClipse no redirecting output properly. Any ideas ?
/usr/local/bin/pylint --rcfile=/Users/amansehgal/.rcfile --include-ids=y /Users/amansehgal/Documents/cis519/hw3_skeleton/boostedDT.py
This usually means that the console env is different from the LiClipse env.
To fix it, print the environment variables from inside LiClipse and from the shell.
You can do that by creating a python script such as:
for key, val in sorted(os.environ.items()):
print('%s:\n %s' % (key, '\n '.join(sorted(val.split(os.pathsep)))))
And then comparing the values you have in either case.
The most common issue would be in the PATH, PYTHONPATH, DYLD_LIBRARY_PATH (on mac) or LD_LIBRARY_PATH (on linux) env variables.
You can also try to start LiClipse from the same shell where you started your command so that it inherits the env variables you have from the shell.

google-cloud-storage library from nosetests using testbed

I have google-cloud-storage pip installed into a lib directory and vendored in. It's running just fine locally during development of my python appengine app. However, when trying to run unit tests via nose and testbed I'm getting "The 'google-cloud-core' distribution was not found and is required by the application". Here is the stack:
Traceback (most recent call last):
File "/Users/jason/dev/gain-data/venv/lib/python2.7/site-packages/nose/loader.py", line 418, in loadTestsFromName
addr.filename, addr.module)
File "/Users/jason/dev/gain-data/venv/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/Users/jason/dev/gain-data/venv/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/Users/jason/dev/gain-data/data/storage/__init__.py", line 4, in <module>
from google.cloud.storage import Blob, Client
File "/Users/jason/dev/gain-data/lib/google/cloud/storage/__init__.py", line 42, in <module>
from google.cloud.storage.batch import Batch
File "/Users/jason/dev/gain-data/lib/google/cloud/storage/batch.py", line 30, in <module>
from google.cloud.storage.connection import Connection
File "/Users/jason/dev/gain-data/lib/google/cloud/storage/connection.py", line 17, in <module>
from google.cloud import connection as base_connection
File "/Users/jason/dev/gain-data/lib/google/cloud/connection.py", line 31, in <module>
get_distribution('google-cloud-core').version)
File "/Users/jason/dev/gain-data/venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 557, in get_distribution
dist = get_provider(dist)
File "/Users/jason/dev/gain-data/venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 431, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "/Users/jason/dev/gain-data/venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 968, in require
needed = self.resolve(parse_requirements(requirements))
File "/Users/jason/dev/gain-data/venv/lib/python2.7/site-packages/pkg_resources/__init__.py", line 854, in resolve
raise DistributionNotFound(req, requirers)
DistributionNotFound: The 'google-cloud-core' distribution was not found and is required by the application
Any thoughts?
I had the same issue with google-cloud-translate, I was forced to also install the package "globally", i.e. pip install google-cloud-translate.
After struggling a lot with this same issue I found out that the error was because the vendor pip lib wasn't in the PYTHONPATH before calling the nosetests.
Try adding the vendor lib to the PYTHONPATH and then run the tests.
export PYTHONPATH="$(HOME)/Projects/myproject/pip_lib:$$PYTHONPATH"; \
nosetests .

I am using jupyter notebook, ipython 3 on windows. Whenever i am starting my python 3, i get the "Kernel Dead" message

Dead kernel
The kernel has died, and the automatic restart has failed. It is possible the kernel cannot be restarted.
If you are not able to restart the kernel, you will still be able to save the notebook, but running code will no longer work until the notebook is reopened.
the above message is shown in notebook dashboard after i start python3.
[I 23:07:08.365 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel 9938cea3-6528-4a27-b4c3-ee906d748bfb restarted
Traceback (most recent call last):
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\runpy.py"
, line 170, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\runpy.py"
, line 85, in _run_code
exec(code, run_globals)
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\site-pack
ages\ipykernel\__main__.py", line 3, in <module>
app.launch_new_instance()
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\site-pack
ages\traitlets\config\application.py", line 588, in launch_instance
app.initialize(argv)
File "<decorator-gen-123>", line 2, in initialize
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\site-pack
ages\traitlets\config\application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\site-pack
ages\ipykernel\kernelapp.py", line 417, in initialize
self.init_io()
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\site-pack
ages\ipykernel\kernelapp.py", line 316, in init_io
self.patch_io()
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\site-pack
ages\ipykernel\kernelapp.py", line 326, in patch_io
faulthandler_register = faulthandler.register
AttributeError: module 'faulthandler' has no attribute 'register'
[W 23:07:11.369 NotebookApp] KernelRestarter: restart failed
[W 23:07:11.369 NotebookApp] Kernel 9938cea3-6528-4a27-b4c3-ee906d748bfb died, r
emoving from map.
ERROR:root:kernel 9938cea3-6528-4a27-b4c3-ee906d748bfb restarted failed!
[W 23:07:11.390 NotebookApp] Kernel deleted before session
[W 23:07:11.392 NotebookApp] 410 DELETE /api/sessions/1cca4919-305f-4b4f-acdd-b2
a614fd2638 (::1) 3.00ms referer=http://localhost:8888/notebooks/Untitled.ipynb?k
ernel_name=python3
In command prompt i get the above shown message. What is the problem in the faulthandler module. How should I rectify it? I installed jupyter notebook by using "pip". I am new to python programming and also jupyter. please help me resolve this.
We accidentally made a release of the ipykernel package which doesn't work on Python 3.5 on Windows. Once we realised this, we made a new release (version 4.3.1) to fix it.
You can upgrade by running:
pip install --upgrade ipykernel
If you had installed ipykernel using conda, the command would be:
conda update ipykernel