Jupyter suddenly won't start without (already-installed) packages - python

I was having issues installing a package. I cancelled the install mid-solving environment.
Now, when I try to open Jupyter notebook, I receive the following error:
Traceback (most recent call last):
File "/Users/Me/opt/anaconda3/bin/jupyter-notebook", line 7, in <module>
from notebook.notebookapp import main
File "/Users/Me/opt/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 80, in <module>
from .services.contents.manager import ContentsManager
File "/Users/Me/opt/anaconda3/lib/python3.7/site-packages/notebook/services/contents/manager.py", line 17, in <module>
from nbformat import sign, validate as validate_nb, ValidationError
File "/Users/Me/opt/anaconda3/lib/python3.7/site-packages/nbformat/__init__.py", line 32, in <module>
from .validator import validate, ValidationError
File "/Users/Me/opt/anaconda3/lib/python3.7/site-packages/nbformat/validator.py", line 23, in <module>
raise ImportError(str(e) + verbose_msg)
ImportError: No module named 'importlib_metadata'
Jupyter notebook format depends on the jsonschema package:
https://pypi.python.org/pypi/jsonschema
Please install it first.
I tried installing jsonschema and importlib_metadata via conda install. When I do that, I receive this (for both):
# All requested packages already installed.
I tried turning it off and on again; I tried removing and reinstalling Jupyter. Neither worked. This is abhorrently frustrating. What the heck is going on, and why is Jupyter suddenly deciding to not work when it worked perfectly before the weekend? And more importantly, how do I fix this?

Related

Python Anaconda ImportError: menuinst.knownfolders

I am trying to work with my Jupyter notebook. I have done so for the last 6 six years or so. Now I am getting the following error message:
Python Anaconda ImportError No module named menuinst.knownfolders
I checked several posts on the internet but nothing has helped: “conda install menuinst”. see here:
Python Anaconda ImportError No module named menuinst.knownfolders
I now have uninstalled and re-installed it three times but did not solve the issue.
When I go to my anaconda prompt and type in “jupyter notebook”, these are the error message I am getting:
C:\Users\User\anaconda3\lib\site-packages\setuptools\distutils_patch.py:25: UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools' objects directly or at least import Setuptools first.
warnings.warn(
_cffi_ext.c
AppData\Roaming\Python\Python38\site-packages\zmq\backend\cffi\__pycache__\_cffi_ext.c(268): fatal error C1083:
Cannot open include file: 'zmq.h': No such file or directory
Traceback (most recent call last):
File "C:\Users\User\anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
from notebook.notebookapp import main
File "C:\Users\User\anaconda3\lib\site-packages\notebook\notebookapp.py", line 49, in <module>
from zmq.eventloop import ioloop
File "C:\Users\User\AppData\Roaming\Python\Python38\site-packages\zmq\__init__.py", line 50, in <module>
from zmq import backend
File "C:\Users\User\AppData\Roaming\Python\Python38\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "C:\Users\User\AppData\Roaming\Python\Python38\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\User\AppData\Roaming\Python\Python38\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "C:\Users\User\AppData\Roaming\Python\Python38\site-packages\zmq\backend\select.py", line 28, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\User\AppData\Roaming\Python\Python38\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: cannot import name 'constants' from partially initialized module 'zmq.backend.cython' (most likely due to a circular import) (C:\Users\User\AppData\Roaming\Python\Python38\site-packages\zmq\backend\cython\__init__.py)
Just another piece of information, my anaconda prompt starts with (base) before it says C:\user\user>. Is that relevant or this issue?
You should try
conda remove zeromq
conda install zeromq
Solution-1
Please try to reinstall jupyter notebook from anaconda navigator it will definitely work
Solution-2
Please update jupyter notebook from anaconda prompt with below commands.
pip install notebook --upgrade
conda update notebook
I face the same issue..
1)Open anaconda prompt and type
conda list
2)Check terminado and
terminado 0.8.3
zeromq 4.3.2
3)In same anaconda prompt and check if python is working, type below code
python
if yes then
quit()
5)if no update python accordingly.
6)Type,
anaconda-navigator
This will open navigator and try to install jupyter notebook.

Unable to launch jupyter notebook supposedly due to jsonschema

I started facing this error after installing keras via - conda install -c conda-forge keras.
Now when I try to launch Jupiter notebook I am prompted with the following:
Traceback (most recent call last):
File "C:\Users\srish\Anaconda3\lib\site-packages\jsonschema\__init__.py", line 31, in <module>
from importlib import metadata
ImportError: cannot import name 'metadata' from 'importlib' (C:\Users\srish\Anaconda3\lib\importlib\__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\srish\Anaconda3\lib\site-packages\nbformat\validator.py", line 12, in <module>
from jsonschema import ValidationError
File "C:\Users\srish\Anaconda3\lib\site-packages\jsonschema\__init__.py", line 33, in <module>
import importlib_metadata as metadata
ModuleNotFoundError: No module named 'importlib_metadata'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\srish\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
from notebook.notebookapp import main
File "C:\Users\srish\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 80, in <module>
from .services.contents.manager import ContentsManager
File "C:\Users\srish\Anaconda3\lib\site-packages\notebook\services\contents\manager.py", line 17, in <module>
from nbformat import sign, validate as validate_nb, ValidationError
File "C:\Users\srish\Anaconda3\lib\site-packages\nbformat\__init__.py", line 32, in <module>
from .validator import validate, ValidationError
File "C:\Users\srish\Anaconda3\lib\site-packages\nbformat\validator.py", line 23, in <module>
raise ImportError(str(e) + verbose_msg)
ImportError: No module named 'importlib_metadata'
Jupyter notebook format depends on the jsonschema package:
https://pypi.python.org/pypi/jsonschema
Please install it first.
The solution of the following link seems to be outdated, and is for python 2.7 only: Can't use Jupyter Notebook: jsonschema apparently missing.
Your Solution Worked for me. I had originally upgraded to jsonschema 3.20. I then downgraded to version jsonschema 3.02 and now my Jupyter notebook opens. Don't know why the higher version 3.20 creates the problem.
Well I also felt the same problem and my notebook or lab was also not opening. I found an answer in an website. I used the command conda install jsonschema==3.0.2 in the Anaconda Prompt and after installing my notebook and lab works fine again.
If you don't mind what version of anaconda you're using, downgrading anaconda to the 2020.02 version solved it for me (using conda install anaconda=2020.02).
This happend to me when I updated anaconda to the 2020.07 version using conda install anaconda=2020.07. I tried conda install jsonschema==3.0.2 as #user14080268 mentioned, but this caused the solving environment to fail and it went to look for incompatible packages, which then took for ever. Downgrading anaconda back to the version I initially had fixed the issue for me!
(of course, if you had a specific reason to update anaconda this might not be the best solution for you)

Problem displaying widgets / ipywidgets install unsuccessful

I'm implementing widgets in my jupyter notebook (via anaconda). I tried first by using an old code from a professor of mine, but it's not displaying widgets.
I tried installing:
jupyter labextension install #jupyter-widgets/jupyterlab-manager
But it was unsuccessful
This was presented when I attempted installation of the package via windows command prompt:
C:\Users\davio>jupyter labextension install #jupyter-widgets/jupyterlab-manager
Traceback (most recent call last): File
"C:\Users\davio\Anaconda3\lib\site-packages\jupyterlab_server\server.py",
line 14, in
from notebook.base.handlers import ( File "C:\Users\davio\Anaconda3\lib\site-packages\notebook\base\handlers.py",
line 30, in
from tornado import web, gen, escape, httputil File "C:\Users\davio\Anaconda3\lib\site-packages\tornado\web.py", line 87,
in
from tornado.httpserver import HTTPServer File "C:\Users\davio\Anaconda3\lib\site-packages\tornado\httpserver.py",
line 29, in
import ssl File "C:\Users\davio\Anaconda3\lib\ssl.py", line 98, in
import _ssl # if we can't import it, let the error propagate ImportError: DLL load failed: The specified procedure could
not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"C:\Users\davio\Anaconda3\Scripts\jupyter-labextension-script.py",
line 6, in
from jupyterlab.labextensions import main File "C:\Users\davio\Anaconda3\lib\site-packages\jupyterlab\labextensions.py",
line 16, in
from .commands import ( File "C:\Users\davio\Anaconda3\lib\site-packages\jupyterlab\commands.py",
line 27, in
from jupyterlab_server.process import which, Process, WatchHelper File
"C:\Users\davio\Anaconda3\lib\site-packages\jupyterlab_server__init__.py",
line 4, in
from .app import LabServerApp File "C:\Users\davio\Anaconda3\lib\site-packages\jupyterlab_server\app.py",
line 9, in
from .server import ServerApp File "C:\Users\davio\Anaconda3\lib\site-packages\jupyterlab_server\server.py",
line 26, in
from jupyter_server.base.handlers import ( # noqa ModuleNotFoundError: No module named 'jupyter_server'
I expect to:
i) Be able to install all the required ipy packages in order to display widgets properly
ii) View and manipulate widgets properly
Thank you!!!!
Maybe if you had alredy python installed before installing anaconda, that's the problem. Try uninstalling python and only working with anaconda's python, that worked for me.
(Sorry for bad english)

"No module named zlib" error anytime I use pip

I'm using terminal on mac, and anytime I attempt to use pip, I get the following error message telling me that it cannot find a module named zlib:
$ pip --version
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/__init__.py", line 27, in <module>
from . import urllib3
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 42, in <module>
from .response import HTTPResponse
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 3, in <module>
import zlib
ModuleNotFoundError: No module named 'zlib'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/bin/pip", line 7, in <module>
from pip import main
File "/usr/local/lib/python3.6/site-packages/pip/__init__.py", line 21, in <module>
from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/__init__.py", line 62, in <module>
from .packages.urllib3.exceptions import DependencyWarning
File "/usr/local/lib/python3.6/site-packages/pip/_vendor/requests/packages/__init__.py", line 29, in <module>
import urllib3
File "/usr/local/lib/python3.6/site-packages/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/usr/local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 36, in <module>
from .response import HTTPResponse
File "/usr/local/lib/python3.6/site-packages/urllib3/response.py", line 3, in <module>
import zlib
ModuleNotFoundError: No module named 'zlib'
I've read several SO posts with the same error message, and have tried their solutions, including attempting to install zlib using homebrew, which fails, and updating my Xcode developer tools. I also installed pip earlier using python get-pip.py, and it said it installed successfully.
The reason I need pip is to install a package for use on python 2.7, but doing $ pip install "package-name" produces the same error as above. I have both Python 2 and 3 installed on my machine, if that helps. I'm kind of new to pip and using the command line in general, and I'm super confused; if anyone could help me out I'd really appreciate it.
This is the OP. I was able to fix the issue, and wanted to post my solution here in case it would help others.
Essentially I believe it occurred because Python2 is default on my machine, but pip is by default pointing to resources pertaining to Python3, or something like that. Doing pip2 --version instead provided the expected response.

IPython suddenly broken in conda environment: cannot import uniq_stable

I'm doing work in a conda environment. Today when I entered the environment, IPython failed to run, with the following error:
Traceback (most recent call last):
File "/home/d04/jayat/miniconda3/envs/umiopy/bin/ipython", line 4, in <module>
import IPython
File "/home/d04/jayat/miniconda3/envs/umiopy/lib/python2.7/site-packages/IPython/__init__.py", line 48, in <module>
from .core.application import Application
File "/home/d04/jayat/miniconda3/envs/umiopy/lib/python2.7/site-packages/IPython/core/application.py", line 25, in <module>
from IPython.core import release, crashhandler
File "/home/d04/jayat/miniconda3/envs/umiopy/lib/python2.7/site-packages/IPython/core/crashhandler.py", line 28, in <module>
from IPython.core import ultratb
File "/home/d04/jayat/miniconda3/envs/umiopy/lib/python2.7/site-packages/IPython/core/ultratb.py", line 127, in <module>
from IPython.utils.data import uniq_stable
ImportError: cannot import name uniq_stable
IPython is up to date:
ipython 5.3.0 py27_0
It seems to be searching in the right place:
$ which ipython
~/miniconda3/envs/umiopy/bin/ipython
I'm using conda 4.3.14.
I've not changed anything in the environment but it's possible something has been updated by the system administrators (though it's hard to understand how that could affect my environment). What could be causing this problem? For similar errors on StackOverflow it seems like I'll need to update some module through conda.
If anyone ever experiences this issue, after some period of time, reinstalling iPython resulted in it working. I have no idea what broke it in the first place, and why reinstalling didn't help previously. Some sort of conda-related problem I suppose.
It's this simple:
conda remove ipython
conda install ipython

Categories

Resources