Application Spyder launch error in Anaconda - anaconda

I'm trying to launch spyder 5.2.2 on anaconda but I get this error saying "Application spyder launch may have produced errors." I am a beginner in coding and tried a few fixes from other answers. I previosly ran
conda update --all
and tried to fix it with this
conda remove spyder-kernels
conda install spyder-kernels=0.*
but it didn't help. I also tried uninstalling and reinstalling anaconda multiple times but it did not help. How can I fix this? Below is the content of the error.
Traceback (most recent call last):
File "C:\Users\abern\anaconda3\Scripts\spyder-script.py", line 10, in
sys.exit(main())
File "C:\Users\abern\anaconda3\lib\site-packages\spyder\app\start.py", line 237, in main
mainwindow.main(options, args)
File "C:\Users\abern\anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 2016, in main
mainwindow = create_window(MainWindow, app, splash, options, args)
File "C:\Users\abern\anaconda3\lib\site-packages\spyder\app\utils.py", line 289, in create_window
main.setup()
File "C:\Users\abern\anaconda3\lib\site-packages\spyder\app\mainwindow.py", line 848, in setup
internal_plugins = find_internal_plugins()
File "C:\Users\abern\anaconda3\lib\site-packages\spyder\app\find_plugins.py", line 92, in find_internal_plugins
mod = importlib.import_module(entry_point.module_name)
File "C:\Users\abern\anaconda3\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "C:\Users\abern\anaconda3\lib\site-packages\spyder\plugins\application\plugin.py", line 30, in
from spyder.plugins.application.container import (
File "C:\Users\abern\anaconda3\lib\site-packages\spyder\plugins\application\container.py", line 31, in
from spyder.plugins.console.api import ConsoleActions
File "C:\Users\abern\anaconda3\lib\site-packages\spyder\plugins\console\api.py", line 12, in
from spyder.plugins.console.widgets.main_widget import (
File "C:\Users\abern\anaconda3\lib\site-packages\spyder\plugins\console\widgets\main_widget.py", line 35, in
from spyder.plugins.console.widgets.internalshell import InternalShell
File "C:\Users\abern\anaconda3\lib\site-packages\spyder\plugins\console\widgets\internalshell.py", line 38, in
from spyder.plugins.variableexplorer.widgets.objecteditor import oedit
File "C:\Users\abern\anaconda3\lib\site-packages\spyder\plugins\variableexplorer\widgets\objecteditor.py", line 16, in
from spyder_kernels.utils.lazymodules import (
File "C:\Users\abern\anaconda3\lib\site-packages\spyder_kernels\utils\lazymodules.py", line 15, in
from spyder_kernels.utils.misc import is_module_installed
ImportError: cannot import name 'is_module_installed' from 'spyder_kernels.utils.misc' (C:\Users\abern\anaconda3\lib\site-packages\spyder_kernels\utils\misc.py)

Related

Visual Studio, install extension pylint failing with: AttributeError: 'HTMLParser' object has no attribute unescape

Not possible to install some Extensions, like pylint or rope, ending always with
AttributeError: 'HTMLParser' object has no attribute 'unescape'
Plattform Context:
$ lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 18.04.5 LTS
Release: 18.04
Codename: bionic
$ python --version
Python 3.8.3
$ code #visual studio
1.53.0
8490d3dde47c57ba65ec40dd192d014fd2113496
x64
While using visual studio 'popUp' hint option to install i.e. pylint, in terminal initiated comand says:
$ /home/harry/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/pyvsc-run-isolated.py pip install -U pylint --user
starting well, but terminating with exception ("no attribute"):
harry#harry-ThinkPad-X220:~/.../MICROSERVICES$ /usr/bin/python
/home/harry/.vscoy pip install -U pylint
--user-2021.1.502429796/pythonFiles/pyvsc-run-isolated.py
Collecting pylint Using cached
https://files.pythonhosted.org/packages/fb/13/519c1264a134beab2be4bac8dd3e64948980a5ca7833b31cf0255b21f20a/pylint-2.6.0-py3-none-any.whl
Collecting toml>=0.7.1 (from pylint) Using cached
https://files.pythonhosted.org/packages/44/6f/7120676b6d73228c96e17f1f794d8ab046fc910d781c8d151120c3f1569e/toml-0.10.2-py2.py3-none-any.whl
Collecting astroid<=2.5,>=2.4.0 (from pylint) Using cached
https://files.pythonhosted.org/packages/24/a8/5133f51967fb21e46ee50831c3f5dda49e976b7f915408d670b1603d41d6/astroid-2.4.2-py3-none-any.whl
Collecting isort<6,>=4.2.5 (from pylint) Using cached
https://files.pythonhosted.org/packages/cc/89/6888f573886e9dc0906ec98f1b15888de20919a142c355d7f57ebd977d36/isort-5.7.0-py3-none-any.whl
Collecting mccabe<0.7,>=0.6 (from pylint) Using cached
https://files.pythonhosted.org/packages/87/89/479dc97e18549e21354893e4ee4ef36db1d237534982482c3681ee6e7b57/mccabe-0.6.1-py2.py3-none-any.whl
Collecting six~=1.12 (from astroid<=2.5,>=2.4.0->pylint) Using
cached
https://files.pythonhosted.org/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl
Collecting wrapt~=1.11 (from astroid<=2.5,>=2.4.0->pylint) Using
cached
https://files.pythonhosted.org/packages/82/f7/e43cefbe88c5fd371f4cf0cf5eb3feccd07515af9fd6cf7dbf1d1793a797/wrapt-1.12.1.tar.gz
Exception: Traceback (most recent call last): File
"/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args) File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 353, in
run
wb.build(autobuilding=True) File "/usr/lib/python3/dist-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder) File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 376, in
prepare_files
discovered_reqs.extend(self._prepare_file( File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 634, in
_prepare_file
abstract_dist.prep_for_dist() File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 129, in
prep_for_dist
self.req_to_install.run_egg_info() File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 412, in
run_egg_info
self.setup_py, self.name, File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 387, in
setup_py
import setuptools # noqa File "", line 1007, in _find_and_load File "",
line 986, in _find_and_load_unlocked File "", line 664, in _load_unlocked File "", line 627, in _load_backward_compatible File
"", line 259, in load_module File
"/usr/share/python-wheels/setuptools-39.0.1-py2.py3-none-any.whl/setuptools/init.py",
line 14, in
from setuptools.dist import Distribution, Feature File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File
"", line 664, in _load_unlocked File
"", line 627, in
_load_backward_compatible File "", line 259, in load_module File
"/usr/share/python-wheels/setuptools-39.0.1-py2.py3-none-any.whl/setuptools/dist.py",
line 24, in
from setuptools.depends import Require File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File
"", line 664, in _load_unlocked File
"", line 627, in
_load_backward_compatible File "", line 259, in load_module File
"/usr/share/python-wheels/setuptools-39.0.1-py2.py3-none-any.whl/setuptools/depends.py", line 7, in
from .py33compat import Bytecode File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File
"", line 664, in _load_unlocked File
"", line 627, in
_load_backward_compatible File "", line 259, in load_module File
"/usr/share/python-wheels/setuptools-39.0.1-py2.py3-none-any.whl/setuptools/py33compat.py",
line 54, in
unescape = getattr(html, 'unescape', html_parser.HTMLParser().unescape) AttributeError: 'HTMLParser' object
has no attribute 'unescape'
VS was embedded in Python 3.9 and dependencies. After switch to Python 3.8.3, problem is gone, lint installed and working as expected.

Spyder latest version

Did any one face this issue while downloading the latest Anaconda3 and opened spyder?
An error ocurred while starting the kernel
The error is:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site‑packages\spyder\plugins\ipythonconsole\plugin.py", line 1173, in create_kernel_manager_and_kernel_client
kernel_manager.start_kernel(stderr=stderr_handle, **kwargs)
File "C:\Users\user\AppData\Roaming\Python\Python37\site‑packages\jupyter_client\manager.py", line 301, in start_kernel
kernel_cmd, kw = self.pre_start_kernel(**kw)
File "C:\Users\user\AppData\Roaming\Python\Python37\site‑packages\jupyter_client\manager.py", line 248, in pre_start_kernel
self.write_connection_file()
File "C:\Users\user\AppData\Roaming\Python\Python37\site‑packages\jupyter_client\connect.py", line 474, in write_connection_file
kernel_name=self.kernel_name
File "C:\Users\user\AppData\Roaming\Python\Python37\site‑packages\jupyter_client\connect.py", line 138, in write_connection_file
with secure_write(fname) as f:
File "C:\ProgramData\Anaconda3\lib\contextlib.py", line 112, in __enter__
return next(self.gen)
File "C:\Users\user\AppData\Roaming\Python\Python37\site‑packages\jupyter_core\paths.py", line 435, in secure_write
win32_restrict_file_to_user(fname)
File "C:\Users\user\AppData\Roaming\Python\Python37\site‑packages\jupyter_core\paths.py", line 361, in win32_restrict_file_to_user
import win32api
ImportError: DLL load failed: %1 is not a valid Win32 application.
Any help will be appreciated !!

Python 3.4 pyximport error

I have two files named as experiment.py and low_dim_cython.pyx. I am using python 3.4 in PyCharm. In experiment.py, I tried to import low_dim_cython.pyx as:
import numpy
import pyximport
pyximport.install(pyximport.install(setup_args={'include_dirs':[numpy.get_include()]}))
import low_dim_cython
It throws these errors given below.
Traceback (most recent call last):
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview3.4\lib\site-packages\pyximport\pyximport.py", line 216, in load_module
inplace=build_inplace, language_level=language_level)
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview3.4\lib\site-packages\pyximport\pyximport.py", line 192, in build_module
reload_support=pyxargs.reload_support)
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview3.4\lib\site-packages\pyximport\pyxbuild.py", line 102, in pyx_to_dll
dist.run_commands()
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview3.4\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview3.4\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview3.4\lib\site-packages\Cython\Distutils\old_build_ext.py", line 185, in run
_build_ext.build_ext.run(self)
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview3.4\lib\distutils\command\build_ext.py", line 339, in run
self.build_extensions()
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview3.4\lib\site-packages\Cython\Distutils\old_build_ext.py", line 193, in build_extensions
self.build_extension(ext)
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview3.4\lib\distutils\command\build_ext.py", line 503, in build_extension
depends=ext.depends)
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview3.4\lib\distutils\msvc9compiler.py", line 460, in compile
self.initialize()
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview3.4\lib\distutils\msvc9compiler.py", line 371, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview3.4\lib\distutils\msvc9compiler.py", line 259, in query_vcvarsall
raise DistutilsPlatformError("Unable to find vcvarsall.bat")
distutils.errors.DistutilsPlatformError: Unable to find vcvarsall.bat

Failed to pip install georasters in MacOSX

It always failed to pip install georasters in my macbook.
The following is the Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 324, in run
requirement_set.prepare_files(finder)
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 634, in _prepare_file
abstract_dist.prep_for_dist()
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 129, in prep_for_dist
self.req_to_install.run_egg_info()
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 412, in run_egg_info
self.setup_py, self.name,
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 387, in setup_py
import setuptools # noqa
File "build/bdist.macosx-10.12-intel/egg/setuptools/__init__.py", line 12, in <module>
File "build/bdist.macosx-10.12-intel/egg/setuptools/version.py", line 1, in <module>
File "build/bdist.macosx-10.12-intel/egg/pkg_resources/__init__.py", line 72, in <module>
File "build/bdist.macosx-10.12-intel/egg/packaging/requirements.py", line 59, in <module>
TypeError: __call__() takes exactly 2 arguments (1 given)
pip --version:
pip 9.0.1 from /Library/Python/2.7/site-packages (python 2.7)
After many times trying, I resolved the problem.
I used the command:pip install --no-deps georasters
https://pip.pypa.io/en/stable/reference/pip_install/#installation-order[enter image description here][1]

Cannot install pylint on Windows 7 x64, Python 2.7, pip error

I'm trying to install pylint with pip install pylint
But i've got this at the end of installation:
Removing temporary dir c:\users\fixxxer\appdata\local\temp\pip_build_Fixxxer...
Exception:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\pip\basecommand.py", line 122, in main
status = self.run(options, args)
File "C:\Python27\lib\site-packages\pip\commands\install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "C:\Python27\lib\site-packages\pip\req.py", line 1229, in prepare_files
req_to_install.run_egg_info()
File "C:\Python27\lib\site-packages\pip\req.py", line 292, in run_egg_info
logger.notify('Running setup.py (path:%s) egg_info for package %s' % (self.setup_py, self.name))
File "C:\Python27\lib\site-packages\pip\req.py", line 265, in setup_py
import setuptools
File "C:\Python27\lib\site-packages\setuptools\__init__.py", line 12, in <module>
from setuptools.extension import Extension
File "C:\Python27\lib\site-packages\setuptools\extension.py", line 7, in <module>
from setuptools.dist import _get_unpatched
File "C:\Python27\lib\site-packages\setuptools\dist.py", line 16, in <module>
from setuptools.depends import Require
File "C:\Python27\lib\site-packages\setuptools\depends.py", line 6, in <module>
from setuptools import compat
File "C:\Python27\lib\site-packages\setuptools\compat.py", line 19, in <module>
from SimpleHTTPServer import SimpleHTTPRequestHandler
File "C:\Python27\lib\SimpleHTTPServer.py", line 27, in <module>
class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
File "C:\Python27\lib\SimpleHTTPServer.py", line 204, in SimpleHTTPRequestHandler
mimetypes.init() # try to read system mime.types
File "C:\Python27\lib\mimetypes.py", line 355, in init
db.read_windows_registry()
File "C:\Python27\lib\mimetypes.py", line 259, in read_windows_registry
for ctype in enum_types(mimedb):
File "C:\Python27\lib\mimetypes.py", line 249, in enum_types
ctype = ctype.encode(default_encoding) # omit in 3.x!
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in position 0: ordinal not in range(128)
Any ideas how can i fix this or some workarounds?
How can i install it manually?
UPDATE.
replacing
default_encoding = sys.getdefaultencoding()
with
if sys.getdefaultencoding() != 'gbk':
reload(sys)
sys.setdefaultencoding('gbk')
default_encoding = sys.getdefaultencoding()
does this:
Cleaning up...
Removing temporary dir c:\users\fixxxer\appdata\local\temp\pip_build_Fixxxer...
Exception:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\pip\basecommand.py", line 122, in main
status = self.run(options, args)
File "C:\Python27\lib\site-packages\pip\commands\install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "C:\Python27\lib\site-packages\pip\req.py", line 1229, in prepare_files
req_to_install.run_egg_info()
File "C:\Python27\lib\site-packages\pip\req.py", line 292, in run_egg_info
logger.notify('Running setup.py (path:%s) egg_info for package %s' % (self.setup_py, self.name))
File "C:\Python27\lib\site-packages\pip\req.py", line 265, in setup_py
import setuptools
File "C:\Python27\lib\site-packages\setuptools\__init__.py", line 12, in <module>
from setuptools.extension import Extension
File "C:\Python27\lib\site-packages\setuptools\extension.py", line 7, in <module>
from setuptools.dist import _get_unpatched
File "C:\Python27\lib\site-packages\setuptools\dist.py", line 16, in <module>
from setuptools.depends import Require
File "C:\Python27\lib\site-packages\setuptools\depends.py", line 6, in <module>
from setuptools import compat
File "C:\Python27\lib\site-packages\setuptools\compat.py", line 19, in <module>
from SimpleHTTPServer import SimpleHTTPRequestHandler
File "C:\Python27\lib\SimpleHTTPServer.py", line 27, in <module>
class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
File "C:\Python27\lib\SimpleHTTPServer.py", line 204, in SimpleHTTPRequestHandler
mimetypes.init() # try to read system mime.types
File "C:\Python27\lib\mimetypes.py", line 359, in init
db.read_windows_registry()
File "C:\Python27\lib\mimetypes.py", line 263, in read_windows_registry
for ctype in enum_types(mimedb):
File "C:\Python27\lib\mimetypes.py", line 249, in enum_types
ctype = ctype.encode(default_encoding) # omit in 3.x!
UnicodeDecodeError: 'gbk' codec can't decode bytes in position 4-5: illegal multibyte sequence
Found a problem.
There was a few MIME types with Cyrillic names in
HKEY_CLASSES_ROOT\MIME\Database\Content Type
Removed them and problem was solved.
I had the same error and this helped me https://stackoverflow.com/a/23278373/2571607
Basically, open C:\Python27\Lib\mimetypes.py
replace
‘default_encoding = sys.getdefaultencoding()’
with
if sys.getdefaultencoding() != 'gbk':
reload(sys)
sys.setdefaultencoding('gbk')
default_encoding = sys.getdefaultencoding()

Resources