An error ocurred while starting the kernel Python in Spyder - python

I updated Python to version 4.2 with Anaconda Navigator. I am kind of new to programming, but I have an error in the console. It says "An error ocurred while starting the kernel" and than the following:
Traceback (most recent call last):
File "C:\Users\anass\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\anass\Anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\anass\Anaconda3\lib\site‑packages\spyder_kernels\console\__main__.py", line 23, in
start.main()
File "C:\Users\anass\Anaconda3\lib\site‑packages\spyder_kernels\console\start.py", line 253, in main
import_spydercustomize()
File "C:\Users\anass\Anaconda3\lib\site‑packages\spyder_kernels\console\start.py", line 43, in import_spydercustomize
import spydercustomize
File "C:\Users\anass\Anaconda3\lib\site‑packages\spyder_kernels\customize\spydercustomize.py", line 31, in
from spyder_kernels.customize.spyderpdb import SpyderPdb
File "C:\Users\anass\Anaconda3\lib\site‑packages\spyder_kernels\customize\spyderpdb.py", line 23, in
from IPython.core.inputtransformer2 import TransformerManager
ModuleNotFoundError: No module named 'IPython.core.inputtransformer2'
What should I do to fix this?
When I open Spyder, it says (Python 3.6). Is that maybe part of the problem? Thanks in advance!

(Spyder maintainer here) Please open the Anaconda Prompt and run there
conda update anaconda
conda install ipython=7.6.0
That should fix your problem.

Related

ModuleNotFoundError and no main_globals

when trying to run and app today, instead of it running I had some errors thrown.
Usually when I've had errors w/ python I can set new PATH or something and it works again. But this time nothing I've tried works.
The app still works on my other computer, running the same OS.
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\User\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts\snscrape.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'snscrape'
Try:
pip3.10 install snscrape
ModuleNotFoundError: No module named 'snscrape' implies one of the following:
You don't have this module installed
Don't have it installed on your specific Python version
It can't be found

Python modulenotfound in cmd

I'm new to python and when I tried to update pip in cmd this appeared:
Traceback (most recent call last):
File "d:\pytong\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "d:\pytong\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "D:\pytong\Scripts\pip.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named
Now it pops up anytime I'm trying to do anything.
I think your best option is to reinstall python or follow this - How to completely remove Python from a Windows machine?
After that restart your PC and install python from python webiste.

How can i resolve a pip install error on windows 10?

I'm running Windows 10 with Python 3.7 and Microsoft Visual Studio Code. I want to install some packages I've downloaded (pysimplegui and psycopg2) but every time I try to install I get an error like this in cmd. Even when I type the pip list command
Traceback (most recent call last):
File "c:\program files\python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\program files\python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Program Files\Python37\Scripts\pip.exe\__main__.py", line 9, in <module>
TypeError: 'module' object is not callable
The files are in my programming folder and I've copied them also on the scripts folder but it's not working. Can you please help me ? thanks in advannce
Try using this code
python3 -m pip install library_you_want

Virtualenvwrapper: module 'pkg_resources' has no attribute 'iter_entry_points'

Every time I open a new shell, I get this error:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/virtualenvwrapper/hook_loader.py", line 223, in <module>
main()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/virtualenvwrapper/hook_loader.py", line 132, in main
run_hooks(hook, options, args)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/virtualenvwrapper/hook_loader.py", line 161, in run_hooks
hook_mgr = ExtensionManager(namespace)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/stevedore/extension.py", line 106, in __init__
verify_requirements)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/stevedore/extension.py", line 179, in _load_plugins
for ep in self.list_entry_points():
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/stevedore/extension.py", line 168, in list_entry_points
eps = list(pkg_resources.iter_entry_points(self.namespace))
AttributeError: module 'pkg_resources' has no attribute 'iter_entry_points'
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3.5 and that PATH is
set properly.
Oddly enough, virtualenvwrapper is still working fine. If I try to activate a virtualenv, it spits out this error again, but the environment does load up. This was after I recently tried to clean up my Python versions on my Mac, but I clearly messed up some path.
Let me know if more info is needed.

An error occurred while starting the kernel

I keep seeing this message.
An error ocurred while starting the kernel
Traceback (most recent call last):
File "C:\Users\Excel\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\Excel\Anaconda3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Excel\Anaconda3\lib\site‑packages\spyder_kernels\console\__main__.py", line 11, in
start.main()
File "C:\Users\Excel\Anaconda3\lib\site‑packages\spyder_kernels\console\start.py", line 279, in main
import_spydercustomize()
File "C:\Users\Excel\Anaconda3\lib\site‑packages\spyder_kernels\console\start.py", line 39, in import_spydercustomize
import spydercustomize
File "C:\Users\Excel\Anaconda3\lib\site‑packages\spyder_kernels\customize\spydercustomize.py", line 5, in
from utilities import visualize_classifier
ModuleNotFoundError: No module named 'utilities'
I tried the following . . .
Try typing these 3 lines from the anaconda command prompt:
conda create -n spyder python=3.7 spyder
activate spyder
spyder
Also . . .
pip install --upgrade spyder
Unfortunately, nothing has worked thus far. Is there some kind of master reset to force this to startup correctly? Thanks a lot.
Try uninstalling spyder and spyder-kernels and run this to reinstall.
conda install spyder-kernels

Categories