Difficulties with references to pysqlite2 after upgrading Anaconda and Jupyter Notebooks
apdcode opened this issue · 0 comments
My setup:
Windows 7, 64 bit
Anaconda 2018.12 (Upon installation Anaconda is added to PATH)
Jupyter Notebook 5.7.4
Python 3.7.1
IPython 7.2.0
And please note that pysqlite2 has been installed and is available under:
Short story:
-
Running Jupyter notebook from command prompt raises error
pysqlite2 not found.
This does not happen when Jupyter is launched from Anaconda Navigator or Anaconda prompt. -
Installing nbExtensions raises error pysqlite2 not found.
-
Anaconda is addad to path upon installation.
-
pysqlite2 is installed using
conda install -c anaconda sqlite
as described on github -
There are some posts on StackOverflow that discuss similar problems, but none that describe a possible solution:
2x ModuleNotFoundError Jupyter notebook (Ubuntu, not Windows)
Running Jupyter Notebook from cmd raises ModuleNotFoundError: No module named pysqlite2
Jupyter notebook will not open from command prompt
The details:
Problem 1:
I'm experiencing several problems with the latest Anaconda and Jupyter versions on Windows 7. Earlier, I could easily navigate to a folder using a command prompt and fire up Jupyter and get a list of available .ipynb
files using the command jupyter notebook
.
Now, the following command will raise the error below:
Snippet 1:
C:\notebooks>jupyter notebook
Output 1 => Error:
Traceback (most recent call last): File
"C:\Users\USERID\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py",
line 10, in
import sqlite3 File "C:\Users\USERID\AppData\Local\Continuum\anaconda3\lib\sqlite3_init_.py",
line 23, in
from sqlite3.dbapi2 import * File "C:\Users\USERID\AppData\Local\Continuum\anaconda3\lib\sqlite3\dbapi2.py",
line 27, in
from _sqlite3 import * ImportError: DLL load failed:During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"C:\Users\USERID\AppData\Local\Continuum\anaconda3\Scripts\jupyter-notebook-script.py",
line 6, in
from notebook.notebookapp import main File "C:\Users\USERID\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\notebookapp.py",
line 86, in
from .services.sessions.sessionmanager import SessionManager File
"C:\Users\USERID\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py",
line 13, in
from pysqlite2 import dbapi2 as sqlite3 ModuleNotFoundError: No module named 'pysqlite2'`
This error is not raised when starting Jupyter from the Anaconda Navigator, OR an Anaconda prompt:
Snippet 2 (Anaconda prompt):
C:\notebooks>jupyter notebook
Output 2:
(base) C:\notebooks>jupyter notebook [I 09:40:57.066 NotebookApp]
[nb_conda_kernels] enabled, 1 kernels found [I 09:40:57.426
NotebookApp] The port 8888 is already in use, trying another por t. [I
09:40:57.427 NotebookApp] The port 8889 is already in use, trying
another por t. [I 09:40:57.428 NotebookApp] The port 8890 is already
in use, trying another por t. [I 09:40:57.429 NotebookApp] The port
8891 is already in use, trying another por t. [I 09:40:57.430
NotebookApp] The port 8892 is already in use, trying another por t. [I
09:40:57.477 NotebookApp] [jupyter_nbextensions_configurator] enabled
0.4.1 [I 09:40:57.521 NotebookApp] JupyterLab extension loaded from C:\Users\USERID\Ap
pData\Local\Continuum\anaconda3\lib\site-packages\jupyterlab [I
09:40:57.521 NotebookApp] JupyterLab application directory is
C:\Users\USERID \AppData\Local\Continuum\anaconda3\share\jupyter\lab
[I 09:40:57.893 NotebookApp] [nb_conda] enabled [I 09:40:57.893
NotebookApp] Serving notebooks from local directory: C:\notebooks\ [I
09:40:57.894 NotebookApp] The Jupyter Notebook is running at: [I
09:40:57.894 NotebookApp]
http://localhost:8928/?token=6c1d1fb9b1b9427e4341d6
f2a8d2b0c29f1399c13777870a [I 09:40:57.895 NotebookApp] Use Control-C
to stop this server and shut down all kernels (twice to skip
confirmation). [C 09:40:58.143 NotebookApp]To access the notebook, open this file in a browser:
file:///C:/Users/USERID/AppData/Roaming/jupyter/runtime/nbserver-20984-o
pen.html
Or copy and paste one of these URLs:
http://localhost:8928/?token=6c1d1fb9b1b9427e4341d6f2a8d2b0c29f1399c1377
7870a
Copying and pasting that link to a web browser launches a Jupyter Notebbok and all seems to be OK, apart from the fact that I'm no longer able to launch Jupyter using a simple command batch that I used to earlier.
Problem 1 is something I could live with, but the same issue causes other problems as well.
Problem 2:
I've been using Jupyer Notebook Extensions for some time, and really like the enhanced toolbox this provides. But reinstalling these tools now raises an error related to pysqlite2.
Snippet 3:
Output 3:
Traceback (most recent call last): File
"c:\users\USERID\appdata\local\continuum\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py",
line 10, in
import sqlite3 File "c:\users\USERID\appdata\local\continuum\anaconda3\lib\sqlite3_init_.py",
line 23, in
from sqlite3.dbapi2 import * File "c:\users\USERID\appdata\local\continuum\anaconda3\lib\sqlite3\dbapi2.py",
line 27, in
from _sqlite3 import * ImportError: DLL load failed:During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"c:\users\USERID\appdata\local\continuum\anaconda3\lib\runpy.py", line
193, in _run_module_as_main
"main", mod_spec) File "c:\users\USERID\appdata\local\continuum\anaconda3\lib\runpy.py", line
85, in run_code
exec(code, run_globals) File "C:\Users\USERID\AppData\Local\Continuum\anaconda3\Scripts\jupyter-contrib.EXE_main.py",
line 9, in File
"c:\users\USERID\appdata\local\continuum\anaconda3\lib\site-packages\jupyter_core\application.py",
line 266, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs) File
"c:\users\USERID\appdata\local\continuum\anaconda3\lib\site-packages\traitlets\config\application.py",
line 656, in launch_instance
app = cls.instance(**kwargs) File "c:\users\USERID\appdata\local\continuum\anaconda3\lib\site-packages\traitlets\config\configurable.py",
line 412, in instance
inst = cls(*args, **kwargs) File "c:\users\USERID\appdata\local\continuum\anaconda3\lib\site-packages\jupyter_contrib_core\application.py",
line 27, in init
self.refresh_subcommands() File "c:\users\USERID\appdata\local\continuum\anaconda3\lib\site-packages\jupyter_contrib_core\application.py",
line 43, in refresh_subcommands
get_subcommands_dict = entrypoint.load() File "c:\users\USERID\appdata\local\continuum\anaconda3\lib\site-packages\pkg_resources_init.py",
line 2346, in load
return self.resolve() File "c:\users\USERID\appdata\local\continuum\anaconda3\lib\site-packages\pkg_resources_init.py",
line 2352, in resolve
module = import(self.module_name, fromlist=['name'], level=0) File
"c:\users\USERID\appdata\local\continuum\anaconda3\lib\site-packages\jupyter_contrib_nbextensions\application.py",
line 15, in
from jupyter_contrib_nbextensions.install import ( File "c:\users\USERID\appdata\local\continuum\anaconda3\lib\site-packages\jupyter_contrib_nbextensions\install.py",
line 17, in
from notebook.notebookapp import list_running_servers File "c:\users\USERID\appdata\local\continuum\anaconda3\lib\site-packages\notebook\notebookapp.py",
line 86, in
from .services.sessions.sessionmanager import SessionManager File
"c:\users\USERID\appdata\local\continuum\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py",
line 13, in
from pysqlite2 import dbapi2 as sqlite3 ModuleNotFoundError: No module named 'pysqlite2'
This also seems to be caused by the issues with pysqlite2. I hope some of you are able to make sense of all this.