Anaconda launch spyder error (ModuleNotFoundError) - python

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

Related

am getting this error while starting spyder

I updated spyder to 4.0.1 and received this error and i also downgraded spyder to 3.7 but still it's not working
Traceback (most recent call last):
File "C:\Users\Lazxy\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3285, *in main*
mainwindow = run_spyder(app, options, args)
File "C:\Users\Lazxy\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 3140, in run_spyder
main.setup()
File "C:\Users\Lazxy\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 914, in setup
from spyder.plugins.ipythonconsole import IPythonConsole
File "C:\Users\Lazxy\Anaconda3\lib\site-packages\spyder\plugins\ipythonconsole.py", line 25, in
from jupyter_client.connect import find_connection_file
File "C:\Users\Lazxy\Anaconda3\lib\site-packages\jupyter_client\__init__.py", line 4, in
from .connect import *
File "C:\Users\Lazxy\Anaconda3\lib\site-packages\jupyter_client\connect.py", line 35, *in
from jupyter_core.paths import jupyter_data_dir, jupyter_runtime_dir, secure_write*
ImportError: cannot import name 'secure_write' from 'jupyter_core.paths'
(C:\Users\Lazxy\Anaconda3\lib\site-packages\jupyter_core\paths.py)
Try this
conda update jupyter_core

ImportError: cannot import name 'HTTPSHandler' from 'urllib.request' for windows

I found 0 topics about this issue for Windows, only for Ubuntu, MAc etc.
When I try to install any package via Pycharm, e.g. urllib, matplotlib, heidi, I get the exact same error message as below.
Project interpreter is Anaconda Python 3.7.
Any idea how this can solved?
Error: Traceback (most recent call last):
File "E:\Download\PROGIK\Charm Community Edition 2018.3.5\helpers\packaging_tool.py", line 73, in run_pip
runpy.run_module(module_name, run_name='__main__', alter_sys=True)
File "E:\Download\PROGIK\Anaconda\lib\runpy.py", line 201, in run_module
mod_name, mod_spec, code = _get_module_details(mod_name)
File "E:\Download\PROGIK\Anaconda\lib\runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "E:\Download\PROGIK\Anaconda\lib\runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "E:\Download\PROGIK\Anaconda\lib\site-packages\pip\__init__.py", line 15, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "E:\Download\PROGIK\Anaconda\lib\site-packages\pip\vcs\subversion.py", line 9, in <module>
from pip.index import Link
File "E:\Download\PROGIK\Anaconda\lib\site-packages\pip\index.py", line 30, in <module>
from pip.wheel import Wheel, wheel_ext
File "E:\Download\PROGIK\Anaconda\lib\site-packages\pip\wheel.py", line 35, in <module>
from pip._vendor.distlib.scripts import ScriptMaker
File "E:\Download\PROGIK\Anaconda\lib\site-packages\pip\_vendor\distlib\scripts.py", line 14, in <module>
from .compat import sysconfig, detect_encoding, ZipFile
File "E:\Download\PROGIK\Anaconda\lib\site-packages\pip\_vendor\distlib\compat.py", line 66, in <module>
from urllib.request import (urlopen, urlretrieve, Request, url2pathname,
ImportError: cannot import name 'HTTPSHandler' from 'urllib.request' (E:\Download\PROGIK\Anaconda\lib\urllib\request.py)
Edit: with pip I have only problem with matplotlib, which is another topic:
Cannot install matplotlib. Fatal error LNK1181, Visual Studio fail
Simply went into packages folder and deleted matplotlib package manually because could not make it display graphs in Jupyter (didnt try in Pycharm). Trying to reinstall it now, hopefully it will fix the issue.
To install packages whithin anaconda environment under Windows10, you should use "Anaconda prompt" (find it in win menu)
It starts (Base) venv by default and installs packages in it. Therefore using Python interpreter distributed with Anaconda you will be able to import them with no side actions.
Besides matplotlib is installed there by default

Anaconda navigator not launching windows 10 (Spyder as well)

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"

How can I start spyder python 3.5

I am having trouble starting spyder (I have installed Anaconda 64 bit version python 3.5). When I run spyder or spyder.exe in cmd I see the green logo of spyder but nothing happens afterwards, except that I get an error msg:
(C:\Program Files\Anaconda3) C:\WINDOWS\system32>spyder
Traceback (most recent call last):
File "C:\Program Files\Anaconda3\Scripts\spyder-script.py", line 5, in <module>
sys.exit(spyder.app.start.main())
File "C:\Program Files\Anaconda3\lib\site-packages\spyder\app\start.py", line 103, in main
from spyder.app import mainwindow
File "C:\Program Files\Anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 154, in <module>
from spyder.utils.environ import WinUserEnvDialog
File "C:\Program Files\Anaconda3\lib\site-packages\spyder\utils\environ.py", line 20, in <module>
from spyder.widgets.variableexplorer.collectionseditor import CollectionsEditor
File "C:\Program Files\Anaconda3\lib\site-packages\spyder\widgets\variableexplorer\collectionseditor.py", line 45, in <module>
from spyder.widgets.variableexplorer.importwizard import ImportWizard
File "C:\Program Files\Anaconda3\lib\site-packages\spyder\widgets\variableexplorer\importwizard.py", line 26, in <module>
import pandas as pd
File "C:\Program Files\Anaconda3\lib\site-packages\pandas\__init__.py", line 37, in <module>
import pandas.core.config_init
File "C:\Program Files\Anaconda3\lib\site-packages\pandas\core\config_init.py", line 14, in <module>
import pandas.core.config as cf
AttributeError: module 'pandas' has no attribute 'core'
I am running Win 10 Pro 64bit
If you want to install Spyder directly, you need to follow these steps:
Install the essential requirements:
Python2.7+ or 3.4+
PyQt5 (recommended) or PyQt4
Install Spyder and its dependencies by running this command:
pip install spyder
For more read this :https://docs.continuum.io/anaconda/ide_integration

No module named prompt_toolkit.enums

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!

Categories