How to Completely uninstall jupyter - pip

I am unable to open jupyter notebook .ipynb files (i can open jupyter notebook, but when i click on a .ipynb it exits with unkown error)
Therefore i want to completely get rid of jupyter and ipython.
I deinstalled jupyter and ipython with sudo pip uninstall, also with pip2 and pip3, but still i am able to find jupyter at /usr/local/bin/jupyter and i am also able to start it with jupyter.
If i now reinstall jupyter with pip, i get the same errors as before, so i guess it always starts the same that i still installed.
So how can i deinstall this? just remove the binary?
Edit1:
i am using python 2.7 and Ubuntu 16.04 if that matters
Edit2:
i got basically the same problem as this pip uninstall jupyter does not work but which jupyter returns
Edit3:
The complete error output when i try to open a jupyter-notebook:
[E 14:59:58.222 NotebookApp] Uncaught exception GET /api/contents/workspace/Mobile_Mask_RCNN/samples/demo.ipynb?type=notebook&_=1523883598008 (127.0.0.1)
HTTPServerRequest(protocol='http', host='localhost:8888', method='GET', uri='/api/contents/workspace/Mobile_Mask_RCNN/samples/demo.ipynb?type=notebook&_=1523883598008', version='HTTP/1.1', remote_ip='127.0.0.1', headers={'Accept-Language': 'de-DE,en-US;q=0.5', 'Accept-Encoding': 'gzip, deflate', 'X-Xsrftoken': '2|ef5ec4f7|efb210b548db14e572dec5fa47cd9d4c|1523879395', 'X-Requested-With': 'XMLHttpRequest', 'Host': 'localhost:8888', 'Accept': 'application/json, text/javascript, */*; q=0.01', 'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0', 'Connection': 'keep-alive', 'Referer': 'http://localhost:8888/notebooks/workspace/Mobile_Mask_RCNN/samples/demo.ipynb', 'Cookie': '_xsrf=2|ef5ec4f7|efb210b548db14e572dec5fa47cd9d4c|1523879395; username-localhost-8888="2|1:0|10:1523883578|23:username-localhost-8888|44:YjJhYjc1MjI4Y2UwNDBlMDg1ZGJkN2QyMTkzZmM5ZGU=|c9400d948f07d89cf10b581a1251394138f0f7180395bdcffd5df47bd396c189"'})
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line 1512, in _execute
result = yield result
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 1055, in run
value = future.result()
File "/usr/local/lib/python2.7/dist-packages/tornado/concurrent.py", line 238, in result
raise_exc_info(self._exc_info)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 307, in wrapper
yielded = next(result)
File "/usr/local/lib/python2.7/dist-packages/notebook/services/contents/handlers.py", line 112, in get
path=path, type=type, format=format, content=content,
File "/usr/local/lib/python2.7/dist-packages/notebook/services/contents/filemanager.py", line 418, in get
model = self._notebook_model(path, content=content)
File "/usr/local/lib/python2.7/dist-packages/notebook/services/contents/filemanager.py", line 378, in _notebook_model
self.mark_trusted_cells(nb, path)
File "/usr/local/lib/python2.7/dist-packages/notebook/services/contents/manager.py", line 502, in mark_trusted_cells
trusted = self.notary.check_signature(nb)
File "/usr/local/lib/python2.7/dist-packages/nbformat/sign.py", line 438, in check_signature
signature = self.compute_signature(nb)
File "/usr/local/lib/python2.7/dist-packages/nbformat/sign.py", line 413, in compute_signature
hmac = HMAC(self.secret, digestmod=self.digestmod)
File "/usr/local/lib/python2.7/dist-packages/traitlets/traitlets.py", line 556, in __get__
return self.get(obj, cls)
File "/usr/local/lib/python2.7/dist-packages/traitlets/traitlets.py", line 535, in get
value = self._validate(obj, dynamic_default())
File "/usr/local/lib/python2.7/dist-packages/nbformat/sign.py", line 387, in _secret_default
self._write_secret_file(secret)
File "/usr/local/lib/python2.7/dist-packages/nbformat/sign.py", line 397, in _write_secret_file
with io.open(self.secret_file, 'wb') as f:
IOError: [Errno 13] Permission denied: '/home/gustav/.local/share/jupyter/notebook_secret'
[W 14:59:58.223 NotebookApp] Unhandled error
[E 14:59:58.223 NotebookApp] {
"Accept-Language": "de-DE,en-US;q=0.5",
"Accept-Encoding": "gzip, deflate",
"X-Xsrftoken": "2|ef5ec4f7|efb210b548db14e572dec5fa47cd9d4c|1523879395",
"X-Requested-With": "XMLHttpRequest",
"Host": "localhost:8888",
"Accept": "application/json, text/javascript, */*; q=0.01",
"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0",
"Connection": "keep-alive",
"Referer": "http://localhost:8888/notebooks/workspace/Mobile_Mask_RCNN/samples/demo.ipynb",
"Cookie": "_xsrf=2|ef5ec4f7|efb210b548db14e572dec5fa47cd9d4c|1523879395; username-localhost-8888=\"2|1:0|10:1523883578|23:username-localhost-8888|44:YjJhYjc1MjI4Y2UwNDBlMDg1ZGJkN2QyMTkzZmM5ZGU=|c9400d948f07d89cf10b581a1251394138f0f7180395bdcffd5df47bd396c189\""
}
[E 14:59:58.223 NotebookApp] 500 GET /api/contents/workspace/Mobile_Mask_RCNN/samples/demo.ipynb?type=notebook&_=1523883598008 (127.0.0.1) 37.67ms referer=http://localhost:8888/notebooks/workspace/Mobile_Mask_RCNN/samples/demo.ipynb

Fixing the jupyter error
You have a permissions issue:
IOError: [Errno 13] Permission denied: '/home/gustav/.local/share/jupyter/notebook_secret'
Uninstalling is not going to help, at least not directly. You might be able to fix it by entering this command in a terminal:
mkdir -p ${HOME}/.local/share/jupyter
This will fix the error if it was due to the .local/share/jupyter directory not existing.
Completely uninstalling jupyter
If you can't fix the permission issue, here's the simplest set of commands for nuking jupyter from space:
pip install pip-autoremove
pip-autoremove jupyter -y
From a little bit of testing I just did, you might also have to run at the end:
pip-autoremove jupyter-core -y
Opening .ipynb files with a doubleclick
You can't open .ipynb with just vanilla Jupyter by double clicking. This is by design (also arguably a design flaw, but eh). You can add this functionality with the nbopen project.
To install on Ubuntu, just run the following in a terminal:
python3 -m pip install nbopen
python3 -m nbopen.install_xdg
I haven't tested this though since I'm not running Linux.
How to open .ipynb files the "normal" way
You can't open .ipynb with just vanilla Jupyter by double clicking. This is by design (also arguably a design flaw, but eh).
Instead, you have to open files in the Jupyter file manager, which you run like this:
Open a new terminal window (in Ubuntu you can just enter Ctrl+Alt+T).
Start up the notebook server by running jupyter notebook
This should automatically open a new window in your internet browser that's pointing to the Jupyter file manager. If it doesn't, there'll be a line in your terminal that says something like
Copy/paste this URL into your browser when you connect for the first time, to login with a token:
In that case, just copy the following URL into the address bar of a browser window and hit enter.
You should now have a browser window showing the Jupyter file manager. Use the file manager to navigate to the .ipynb you want to open, and then just click on it.
Admittedly a bit convoluted, especially at first. I believe the reason Jupyter is set up this way goes back to its server-based architecture, and the fact that the design team wanted it to be easily/seamlessly deployed on remote computers.

Related

PermissionError while starting the kernel in Spyder's IPython console

When I launch spyder, this error appears :
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site‑packages\spyder\plugins\ipythonconsole.py", line 1572, in create_kernel_manager_and_kernel_client
kernel_manager.start_kernel(stderr=stderr_handle)
File "C:\ProgramData\Anaconda3\lib\site‑packages\jupyter_client\manager.py", line 240, in start_kernel
self.write_connection_file()
File "C:\ProgramData\Anaconda3\lib\site‑packages\jupyter_client\connect.py", line 547, in write_connection_file
kernel_name=self.kernel_name
File "C:\ProgramData\Anaconda3\lib\site‑packages\jupyter_client\connect.py", line 212, in write_connection_file
with secure_write(fname) as f:
File "C:\ProgramData\Anaconda3\lib\contextlib.py", line 112, in __enter__
return next(self.gen)
File "C:\ProgramData\Anaconda3\lib\site‑packages\jupyter_client\connect.py", line 102, in secure_write
with os.fdopen(os.open(fname, open_flag, 0o600), mode) as f:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\Sébastien\\AppData\\Roaming\\jupyter\\runtime\\kernel‑e1f2b044843b.json'
I am not experienced at all in programming but I tried to enter commands in the Anaconda prompt but none of this worked ("conda update jupyter_client" and "conda update --all")
I also tried to install and uninstall but I still get the same error.
This seems a permissions issue. Running Spyder as administrator (right click on it-> run as administrator) solves the problem.
UPDATE:
As per #CarlosCordoba: "To fix this the OP needs to run conda update anaconda and then conda update jupyter_client in the Anaconda Prompt"
Note that the original workaround worked as well in this case.
What did help for me was to allow insecure writes:
yourPythonPath\scripts\activate.bat
set JUPYTER_ALLOW_INSECURE_WRITES=1
spyder
Alternatively you could also set JUPYTER_ALLOW_INSECURE_WRITES to 1 in your global Windows environment variables.

Anaconda Navigator won't launch, download_api error (Windows 10)

Last night I ran a Windows update and this morning Anaconda Navigator hangs when I try to launch it. After googling I ran some updates in Anaconda prompt:
conda update
conda update anaconda-navigator
And then when I try to launch anaconda navigator from the prompt I get this error:
2019-03-01 09:23:00,212 - ERROR download_api._get_url:416
Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "C:\Users\xxxx\Anaconda3\lib\site-packages\anaconda_navigator\widgets\main_window.py", line 539, in setup
self.post_setup(conda_data=conda_data)
File "C:\Users\xxxx\Anaconda3\lib\site-packages\anaconda_navigator\widgets\main_window.py", line 576, in post_setup
self.tab_home.setup(conda_data)
File "C:\Users\xxxx\Anaconda3\lib\site-packages\anaconda_navigator\widgets\tabs\home.py", line 169, in setup
self.set_applications(applications, packages)
File "C:\Users\xxxx\Anaconda3\lib\site-packages\anaconda_navigator\widgets\tabs\home.py", line 204, in set_applications
apps = self.api.process_apps(applications, prefix=self.current_prefix)
File "C:\Users\xxxx\Anaconda3\lib\site-packages\anaconda_navigator\api\anaconda_api.py", line 888, in process_apps
versions=[vsdata.get('productVersion')],
AttributeError: 'str' object has no attribute 'get'
I use Jupyter Notebook and Spyder and this is causing me a major headache. Thanks in advance!
There's another solution (not the best, but it works). Anaconda can't retrieve vscode version for any reason.
You need to replace line 888 in file "C:\Users\xxxx\Anaconda3\lib\site-packages\anaconda_navigator\api\anaconda_api.py"
from versions=[vsdata.get('productVersion')], to versions=["1b8e8302e405050205e69b59abb3559592bb9e60"],
After lots of restarts and lots of googling I found a simple fix:
conda update navigator-updater
It works...for now
For me it worked only when I'm connected to the internet. Offline, it fails to start.

Application launch error in Jupyter notebook

I receive an Application launch error whenever I launch Jupyter notebook. I tried to follow the instructions in the last line of the error but the error never goes away. Could it be something with the working directory?
When I check the working directory in Jupyter notebook using %pwd, I get C:\Users\mayerk
However, my Anaconda working directory is C:\Users\mayerk\AppData\Local\Continuum\anaconda3
This is the error that Anaconda Navigator returns each time I launch Jupyter Notebook:
[I 09:30:37.269 NotebookApp] The port 8888 is already in use, trying another port.
[I 09:30:37.269 NotebookApp] The port 8889 is already in use, trying another port.
[I 09:30:37.270 NotebookApp] The port 8890 is already in use, trying another port.
[I 09:30:37.324 NotebookApp] JupyterLab beta preview extension loaded from C:\Users\mayerk\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyterlab
[I 09:30:37.324 NotebookApp] JupyterLab application directory is C:\Users\mayerk\AppData\Local\Continuum\anaconda3\share\jupyter\lab
[W 09:30:37.334 NotebookApp] Error loading server extension jupyterlab
Traceback (most recent call last):
File "C:\Users\mayerk\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyterlab\commands.py", line 321, in __init__
self._run(['node', 'node-version-check.js'], cwd=HERE, quiet=True)
File "C:\Users\mayerk\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyterlab\commands.py", line 1165, in _run
proc = Process(cmd, **kwargs)
File "C:\Users\mayerk\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyterlab\process.py", line 73, in __init__
self.proc = self._create_process(cwd=cwd, env=env)
File "C:\Users\mayerk\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyterlab\process.py", line 131, in _create_process
cmd[0] = which(cmd[0], kwargs.get('env'))
File "C:\Users\mayerk\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyterlab\jlpmapp.py", line 59, in which
raise ValueError(msg)
ValueError: Please install nodejs 5+ and npm before continuing installation. nodejs may be installed using conda or directly from the nodejs website.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\mayerk\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\notebookapp.py", line 1454, in init_server_extensions
func(self)
File "C:\Users\mayerk\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyterlab\extension.py", line 111, in load_jupyter_server_extension
info = get_app_info(app_dir)
File "C:\Users\mayerk\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyterlab\commands.py", line 244, in get_app_info
handler = _AppHandler(app_dir, logger)
File "C:\Users\mayerk\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyterlab\commands.py", line 324, in __init__
raise ValueError(msg)
ValueError: Please install nodejs 5+ and npm before continuing installation. nodejs may be installed using conda or directly from the nodejs website.
[I 09:30:37.410 NotebookApp] Serving notebooks from local directory: C:\Users\mayerk
[I 09:30:37.410 NotebookApp] 0 active kernels
[I 09:30:37.411 NotebookApp] The Jupyter Notebook is running at:
[I 09:30:37.411 NotebookApp] http://localhost:8891/?token=fe440f0ea50e716458013d568b6f94f4a1c498959e39e490
[I 09:30:37.411 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 09:30:37.420 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8891/?token=fe440f0ea50e716458013d568b6f94f4a1c498959e39e490
[I 09:30:37.557 NotebookApp] Accepting one-time-token-authenticated connection from ::1
ValueError: Please install nodejs 5+ and npm before continuing
installation. nodejs may be installed using conda or directly from the
nodejs website.
Try: conda install -y nodejs

Anaconda: An unexpected error ocurred on Navigator start-up

I had installed Anaconda, I had managed to launch it and then use R or python, and today I can no longer launch it and I get this error (I get the same error when I run the software in administrator mode)
An unexpected error ocurred on Navigator start-up
psutil.AccesDenied(pid=5740)
Traceback (most recent call last):
File "C:\Users\user\Anaconda3\lib\site-packages\psutil\_pswindows.py", line 620, in wrapper
return fun(self, *args, **kwargs)
File "C:\Users\user\Anaconda3\lib\site-packages\psutil\_pswindows.py", line 690, in cmdline
ret = cext.proc_cmdline(self.pid)
PermissionError: [WinError 5] Access Denied
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\Anaconda3\lib\site-packages\anaconda_navigator\exceptions.py", line 75, in exception_handler
return_value = func(*args, **kwargs)
File "C:\Users\user\Anaconda3\lib\site-packages\anaconda_navigator\app\start.py", line 108, in start_app
if misc.load_pid() is None: # A stale lock might be around
File "C:\Users\user\Anaconda3\lib\site-packages\anaconda_navigator\utils\misc.py", line 384, in load_pid
cmds = process.cmdline()
File "C:\Users\user\Anaconda3\lib\site-packages\psutil\__init__.py", line 701, in cmdline
return self._proc.cmdline()
File "C:\Users\user\Anaconda3\lib\site-packages\psutil\_pswindows.py", line 623, in wrapper
raise AccessDenied(self.pid, self._name)
psutil.AccessDenied: psutil.AccessDenied (pid=5740)
I follow the suggestions:
https://github.com/ContinuumIO/anaconda-issues/issues/6006
,
https://github.com/ContinuumIO/anaconda-issues/issues/1984
These commands helped me:
conda update anaconda-navigator
conda update navigator-updater
anaconda-navigator --reset
I use the anaconda in win10 x64 (python3.x) and I got this problem this morning as well. All the things had been done in anaconda was that I installed a package called pywinauto, then I turned off the computer and went home.
I follow the suggestion from https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/4hBTDOcDzgo by lan, I update the anaconda by using the command.
conda update anaconda-navigator
However, the error occurred the same.
Then I reboot the computer and restart the anaconda, magic thing happens! the anaconda works fine!
I think maybe some configuration has been changed when I install the new package, and this change is conflicted with the current configuration which you need to reboot the computer to fix it. you should note that turn off computer then restart it is not equal to reboot it.
So, just reboot the computer and it will be fine.
Facing the same error initially, I tried other solutions given here by executing the commands in anaconda terminal but nothing works in my case as I was getting the following error on executing command
Load Error: invalid yaml at position 0
This means .condarc file is either corrupted due to some reason or there may be some changes in it.
The solution that worked for me is to delete .condarc. As the .condarc configuration file follows simple YAML syntax.
.condarc is automatically created in your home directory the time you run anaconda navigator.
Conda will re-create it, again.
Hope it Helps!!
Try removing .condarc from your directory and check if it works. I had the same issue and it worked for me. I hope it works for you.
I had same Problem , when i tried to update the anaconda navigator, there was conda memory error...Finally,Simple Reset Command Worked for me...!!
anaconda-navigator --reset
If the above solutions are not work,just turn off the proxy.
enter image description here
I faced the same issue.I used the v2ray and proxyfier throught the connect internet.Then I exit the proxyfier and v2ray and reopen the anaconda navigator.finally slove the problem.

Configparser error leads to crash of Spyder 3 under Python(x,y)

During its startup, Spyder3 IDE crashes under Python(x,y). I have installed a Python(x,y) distribution (2.7.10.0) of Python2.7 under Windows 7 and after updating the package spyder to the most recent version (with pip: V3.0.x), it does not restart anymore. Resetting the spyder config does not help.
It is reproducible as I checked it on 3 computers and also with the Enthought distribution, it has the same problem. Only under Anaconda, it keeps working properly.
The error message is stored in the contents of file spyder_crash.log:
Traceback (most recent call last):
File "c:\python27\lib\site-packages\spyder\app\mainwindow.py", line 3001, in main
mainwindow = run_spyder(app, options, args)
File "c:\python27\lib\site-packages\spyder\app\mainwindow.py", line 2905, in run_spyder
main.setup()
File "c:\python27\lib\site-packages\spyder\app\mainwindow.py", line 1010, in setup
from xy.config import DOC_PATH as xy_doc_path
File "c:\python27\lib\site-packages\xy\config.py", line 40, in <module>
CONF = UserConfig('xy', defaults=DEFAULTS, version=__version__, subfolder='.xy')
File "c:\python27\lib\site-packages\xy\userconfig.py", line 110, in __init__
if version != self.get_version(version):
File "c:\python27\lib\site-packages\xy\userconfig.py", line 130, in get_version
return self.get(self.DEFAULT_SECTION_NAME, 'version', version)
File "c:\python27\lib\site-packages\xy\userconfig.py", line 269, in get
value = cp.ConfigParser.get(self, section, option, raw=self.raw)
File "c:\python27\lib\site-packages\backports\configparser\__init__.py", line 811, in get
d)
File "c:\python27\lib\site-packages\backports\configparser\__init__.py", line 384, in before_get
self._interpolate_some(parser, option, L, value, section, defaults, 1)
File "c:\python27\lib\site-packages\backports\configparser\__init__.py", line 397, in _interpolate_some
rawval = parser.get(section, option, raw=True, fallback=rest)
TypeError: get() got an unexpected keyword argument 'raw'
PS: I see that I could post an issue directly on Github but there are over 600 issues open. Maybe there is someone who knows a fix directly.
Different causes that Spyder crashes:
Spyder IDE won't start WinPython-64bit- 2.7.10.2
Broken links and probably different cause - Spyder/Pythonxy crashes
Edit:
Installation details:
C:\Users\strpeter>pip install spyder
Successfully installed configparser-3.5.0 jupyter-core-4.2.1 nbformat-4.2.0
setuptools-30.0.0 spyder-3.0.2
When uninstalling configparser, as recommended in the comment below, pythonw.exe stops working during the initialization of spyder3. I have no details at hand to report about the crash.
C:\Users\strpeter>pip uninstall configparser
Uninstalling configparser-3.5.0:
c:\python27\lib\site-packages\backports\configparser\__init__.py
c:\python27\lib\site-packages\backports\configparser\__init__.pyc
c:\python27\lib\site-packages\backports\configparser\helpers.py
c:\python27\lib\site-packages\backports\configparser\helpers.pyc
c:\python27\lib\site-packages\configparser-3.5.0-py2.7-nspkg.pth
c:\python27\lib\site-packages\configparser-3.5.0-py2.7.egg-info
c:\python27\lib\site-packages\configparser.py
c:\python27\lib\site-packages\configparser.pyc
Proceed (y/n)? y
Successfully uninstalled configparser-3.5.0
(Spyder developer here) This is an error between PythonXY and Spyder. I opened an issue about it, which we're going to solve in Spyder 3.1.0 (to be released in mid January/2017).
This might be due to incompatibilities due to different Qt wrappers. To test this in Enthought Python, please open a Canopy Command Prompt (or otherwise ensure that Enthought Python is your default python). Then ensure that PyQt is installed and make it the default Qt wrapper:
enpkg pyqt
set QT_API=pyqt
Now does Spyder 3 run ok?

Resources