I am trying to launch Jupyter notebook through my command line and run a python script. At first I was able to launch it via the terminal and run the script, but now the kernel does not launch and it gives me this error - "No module named prompt_toolkit.enums"
This is teh whole message from the terminal -
[I 20:33:38.256 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel 151cba82-fb9a-4cfc-ba38-3df3f6f5bb61 restarted
Traceback (most recent call last):
File "/Users/aparihar/anaconda2/lib/python2.7/runpy.py", line 163, in _run_module_as_main
mod_name, _Error)
File "/Users/aparihar/anaconda2/lib/python2.7/runpy.py", line 111, in _get_module_details
__import__(mod_name) # Do not catch exceptions initializing package
File "/Users/aparihar/anaconda2/lib/python2.7/site-packages/ipykernel/__init__.py", line 2, in <module>
from .connect import *
File "/Users/aparihar/anaconda2/lib/python2.7/site-packages/ipykernel/connect.py", line 13, in <module>
from IPython.core.profiledir import ProfileDir
File "/Users/aparihar/anaconda2/lib/python2.7/site-packages/IPython/__init__.py", line 49, in <module>
from .terminal.embed import embed
File "/Users/aparihar/anaconda2/lib/python2.7/site-packages/IPython/terminal/embed.py", line 17, in <module>
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File "/Users/aparihar/anaconda2/lib/python2.7/site-packages/IPython/terminal/interactiveshell.py", line 16, in <module>
from prompt_toolkit.enums import DEFAULT_BUFFER, EditingMode
ImportError: No module named prompt_toolkit.enums
I read a lot of questions posted here and on github but i am just not able to resolve this. I even shutdown all the sessions, used pip to install enums and relaunched the Chrome and terminal. Can someone please help?
Thanks!
Related
I am trying to use cx_freeze to freeze an app that uses Feedparser. The app works perfectly if I launch it from the command line using python. However, when I try to freeze it using cx_freeze, I don't get an error until I try to launch the app. Then I get:
Traceback (most recent call last):
File "/home/ricky/.local/lib/python3.9/site-packages/cx_Freeze/initscripts/__startup__.py", line 66, in run
module.run()
File "/home/ricky/.local/lib/python3.9/site-packages/cx_Freeze/initscripts/Console.py", line 36, in run
exec(code, m.__dict__)
File "main.py", line 8, in <module>
File "/home/ricky/.local/lib/python3.9/site-packages/feedparser/__init__.py", line 28, in <module>
from .api import parse
File "/home/ricky/.local/lib/python3.9/site-packages/feedparser/api.py", line 36, in <module>
from .html import _BaseHTMLProcessor
File "/home/ricky/.local/lib/python3.9/site-packages/feedparser/html.py", line 31, in <module>
from .sgml import *
File "/home/ricky/.local/lib/python3.9/site-packages/feedparser/sgml.py", line 30, in <module>
import sgmllib
ModuleNotFoundError: No module named 'sgmllib'
I know sgmllib is no longer used in Python 3, but since I don't get this error when I launch it from the command line it doesn't seem to be a feedparser issue. Any thoughts?
The cx_Freeze developer helped me with this same issue on Github. Here's the thread.
I am getting the following error message on launching Jupyter Notebook. I did conda update all already, but to no avail.
Traceback (most recent call last):
File "/Users/sparshbohra/opt/anaconda3/bin/jupyter-Notebook", line 7, in <module>
from notebook.notebookapp import main
File "/Users/sparshbohra/opt/anaconda3/lib/python3.7/site-packages/notebook/notebookapp.py", line 81, in <module>
from .services.kernels.kernelmanager import MappingKernelManager, AsyncMappingKernelManager
File "/Users/sparshbohra/opt/anaconda3/lib/python3.7/site-packages/notebook/services/kernels/kernelmanager.py", line 18, in <module>
from jupyter_client.session import Session
File "/Users/sparshbohra/opt/anaconda3/lib/python3.7/site-packages/jupyter_client/session.py", line 41, in <module>
from jupyter_client.jsonutil import extract_dates, squash_dates, date_default
File "/Users/sparshbohra/opt/anaconda3/lib/python3.7/site-packages/jupyter_client/jsonutil.py", line 10, in <module>
from dateutil.parser import parse as _dateutil_parse
File "/Users/sparshbohra/opt/anaconda3/lib/python3.7/site-packages/dateutil/parser.py", line 158
l.append("%s=%s" % (attr, `value`))
^
SyntaxError: invalid syntax
Would probably need a little mote information on how you're trying to launch it, on what system and what program etc. But assuming you have conda installed and the environment activated via conda activate my_env_path_name, you should be able to launch jupyter notebooks by typing jupyter notebook
REVISED: now I get another timeit error!
I was working on coding in spyder launched from anaconda and suddenly I got this error: Timer not found in timeit, which had been working for me a second before. Then I restarted anaconda and reinstalled spyder but when I tried to launch spyder again I got the below error. Can anyone help? I am using MacOS and the newest version of spyder.
Application launch error: Application spyder may have produced following errors.
Traceback (most recent call last):
File "/Users/___/opt/anaconda3/bin/spyder", line 11, in
sys.exit(main())
File "/Users/___/opt/anaconda3/lib/python3.8/site-packages/spyder/app/start.py", line 205, in main
mainwindow.main()
File "/Users/___/opt/anaconda3/lib/python3.8/site-packages/spyder/app/mainwindow.py", line 3651, in main
mainwindow = run_spyder(app, options, args)
File "/Users/___/opt/anaconda3/lib/python3.8/site-packages/spyder/app/mainwindow.py", line 3526, in run_spyder
main.setup()
File "/Users/___/opt/anaconda3/lib/python3.8/site-packages/spyder/app/mainwindow.py", line 945, in setup
from spyder.plugins.ipythonconsole.plugin import IPythonConsole
File "/Users/___m/opt/anaconda3/lib/python3.8/site-packages/spyder/plugins/ipythonconsole/plugin.py", line 46, in
from spyder.plugins.ipythonconsole.widgets import (ClientWidget,
File "/Users/___/opt/anaconda3/lib/python3.8/site-packages/spyder/plugins/ipythonconsole/widgets/__init__.py", line 16, in
from .debugging import DebuggingWidget
File "/Users/___/opt/anaconda3/lib/python3.8/site-packages/spyder/plugins/ipythonconsole/widgets/debugging.py", line 15, in
from IPython.core.history import HistoryManager
File "/Users/___/opt/anaconda3/lib/python3.8/site-packages/IPython/__init__.py", line 56, in
from .terminal.embed import embed
File "/Users/___/opt/anaconda3/lib/python3.8/site-packages/IPython/terminal/embed.py", line 17, in
from IPython.terminal.ipapp import load_default_config
File "/Users/___/opt/anaconda3/lib/python3.8/site-packages/IPython/terminal/ipapp.py", line 28, in
from IPython.core.magics import (
File "/Users/___/opt/anaconda3/lib/python3.8/site-packages/IPython/core/magics/__init__.py", line 21, in
from .execution import ExecutionMagics
File "/Users/___/opt/anaconda3/lib/python3.8/site-packages/IPython/core/magics/execution.py", line 148, in
class Timer(timeit.Timer):
AttributeError: module 'timeit' has no attribute 'Timer'
You have to install NumPy library
conda install numpy
I installed the anaconda 64 bit on windows 10. I can launch the prompt but when I try to open navigator thru the icon or thru prompt, I'm getting the error below. Can someone help me?
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\Scripts\anaconda-navigator-script.py", line 10, in <module>
sys.exit(main())
File "C:\ProgramData\Anaconda3\lib\site-packages\anaconda_navigator\app\main.py", line 103, in main
from anaconda_navigator.app.start import start_app
File "C:\ProgramData\Anaconda3\lib\site-packages\anaconda_navigator\app\start.py", line 34, in <module>
from anaconda_navigator.widgets.main_window import MainWindow
File "C:\ProgramData\Anaconda3\lib\site-packages\anaconda_navigator\widgets\main_window.py", line 37, in <module>
from anaconda_navigator.utils.analytics import GATracker
File "C:\ProgramData\Anaconda3\lib\site-packages\anaconda_navigator\utils\analytics.py", line 44, in <module>
from anaconda_navigator.external.UniversalAnalytics import Tracker
File "C:\ProgramData\Anaconda3\lib\site-packages\anaconda_navigator\external\UniversalAnalytics\Tracker.py", line 28, in <module>
from six.moves.urllib.request import (HTTPSHandler, Request, build_opener,
ImportError: cannot import name 'HTTPSHandler' from 'six.moves.urllib.request' (unknown location)
Also, Spyder is also not launching. I can launch Jupyter and prompt.
I tried to install the Anaconda (Python 3.7 version) on Windows 10 and I was facing the following error:
(base) C:\Users\***>anaconda-navigator Traceback (most recent call last): File "C:\Users\***\anaconda3\Scripts\anaconda-navigator-script.py", line 10, in <module>
sys.exit(main()) File "C:\Users\***\anaconda3\lib\site-packages\anaconda_navigator\app\main.py", line 103, in main
from anaconda_navigator.app.start import start_app File "C:\Users\***\anaconda3\lib\site-packages\anaconda_navigator\app\start.py", line 34, in <module>
from anaconda_navigator.widgets.main_window import MainWindow File "C:\Users\***\anaconda3\lib\site-packages\anaconda_navigator\widgets\main_window.py", line 39, in <module>
from anaconda_navigator.utils.analytics import GATracker File "C:\Users\***\anaconda3\lib\site-packages\anaconda_navigator\utils\analytics.py", line 44, in <module>
from anaconda_navigator.external.UniversalAnalytics import Tracker File "C:\Users\***\anaconda3\lib\site-packages\anaconda_navigator\external\UniversalAnalytics\Tracker.py", line 28, in <module>
from six.moves.urllib.request import (HTTPSHandler, Request, build_opener, ImportError: cannot import name 'HTTPSHandler' from 'six.moves.urllib.request' (unknown location)
I did the solution explained here and it worked.
Error printed is related to ssl library and its natural for people to go and try reinstalling openssl library. But to fix this below steps have to be followed. Just now tried and confirmed this is working.
Copy the following files:
libcrypto-1_1-x64.* (.dll and .pdb files)
libssl-1_1-x64.* (.dll and .pdb files)
From D:\Anaconda3\Library\bin to D:\Anaconda3\DLLs.
Same issue is described in anacondas github page.
For me it works after installing "Win64 OpenSSL v1.1.1d Light"
I just cannot use jupyter notebook. I have updated to the most recent version by ananota, and it still does not work.
The error message is listed below:
C:\Users\willian>jupyter notebook
Traceback (most recent call last):
File "C:\Anaconda3\Scripts\jupyter-notebook-script.py", line 3, in <module>
import notebook.notebookapp
File "C:\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 40, in <module>
ioloop.install()
File "C:\Anaconda3\lib\site-packages\zmq\eventloop\ioloop.py", line 207, in install
from tornado import ioloop
File "C:\Anaconda3\lib\site-packages\tornado\ioloop.py", line 47, in <module>
from tornado.concurrent import TracebackFuture, is_future
File "C:\Anaconda3\lib\site-packages\tornado\concurrent.py", line 34, in <module>
from tornado.util import raise_exc_info, ArgReplacer, is_finalizing
ImportError: cannot import name 'is_finalizing'
From your error it looks like the tornado package is not installed in your environment. Installing tornado with the command below should fix your problem.
pip install tornado