AttributeError: 'module' object has no attribute 'openssl_md_meth_names' - python

I am calling a python script from another python script,irrespective of the output the python script I am calling I get the following error in stderr,I googled but couldn't find anything concrete,am clueless as to why am getting this error?does anyone have any idea on how to fix it?
Traceback (most recent call last):
File "C:\Python27\lib\runpy.py", line 151, in _run_module_as_main
mod_name, loader, code, fname = _get_module_details(mod_name)
File "C:\Python27\lib\runpy.py", line 109, in _get_module_details
return _get_module_details(pkg_main_name)
File "C:\Python27\lib\runpy.py", line 101, in _get_module_details
loader = get_loader(mod_name)
File "C:\Python27\lib\pkgutil.py", line 464, in get_loader
return find_loader(fullname)
File "C:\Python27\lib\pkgutil.py", line 474, in find_loader
for importer in iter_importers(fullname):
File "C:\Python27\lib\pkgutil.py", line 430, in iter_importers
__import__(pkg)
File "C:\Python27\lib\site-packages\pip\__init__.py", line 14, in <module>
from pip.utils import get_installed_distributions, get_prog
File "C:\Python27\lib\site-packages\pip\utils\__init__.py", line 27, in <module>
from pip._vendor import pkg_resources
File "C:\Python27\lib\site-packages\pip\_vendor\pkg_resources\__init__.py", line 35,
import email.parser
File "C:\Python27\lib\email\parser.py", line 12, in <module>
from email.feedparser import FeedParser
File "C:\Python27\lib\email\feedparser.py", line 27, in <module>
from email import message
File "C:\Python27\lib\email\message.py", line 16, in <module>
import email.charset
File "C:\Python27\lib\email\charset.py", line 13, in <module>
import email.base64mime
File "C:\Python27\lib\email\base64mime.py", line 40, in <module>
from email.utils import fix_eols
File "C:\Python27\lib\email\utils.py", line 27, in <module>
import random
File "C:\Python27\lib\random.py", line 49, in <module>
import hashlib as _hashlib
File "C:\Python27\lib\hashlib.py", line 138, in <module>
_hashlib.openssl_md_meth_names)
AttributeError: 'module' object has no attribute 'openssl_md_meth_names'

Try to run brew cleanup and after that brew postinstall python.
For more info see this thread

Related

"TypeError" after running "brownie --version" command

Please I am getting this error after installing brownie using pipx. I tried running "brownie --version" and I got the error below. can someone assist in resolving this pls? The python version on my system is upto date but I observed when I installed brownie, it showed an old version.
C:\Users\OGIDAN TOLU>brownie --version
INFO: Could not find files for the given pattern(s).
Traceback (most recent call last):
File "C:\Users\OGIDAN TOLU\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "C:\Users\OGIDAN TOLU\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "c:\users\ogidan tolu\.local\bin\brownie.exe\__main__.py", line 4, in <module>
File "C:\Users\OGIDAN TOLU\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\__init__.py", line 6, in <module>
from brownie.project import compile_source, run
File "C:\Users\OGIDAN TOLU\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\project\__init__.py", line 3, in <module>
from .main import ( # NOQA 401
File "C:\Users\OGIDAN TOLU\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\project\main.py", line 41, in <module>
from brownie.network import web3
File "C:\Users\OGIDAN TOLU\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\__init__.py", line 4, in <module>
from .account import Accounts
File "C:\Users\OGIDAN TOLU\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\account.py", line 29, in <module>
from .gas.bases import GasABC
File "C:\Users\OGIDAN TOLU\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\gas\bases.py", line 7, in <module>
from brownie.network.web3 import web3
File "C:\Users\OGIDAN TOLU\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\web3.py", line 208, in <module>
web3 = Web3()
File "C:\Users\OGIDAN TOLU\.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\web3.py", line 30, in __init__
self.enable_unstable_package_management_api()
File "C:\Users\OGIDAN TOLU\.local\pipx\venvs\eth-brownie\lib\site-packages\web3\main.py", line 289, in enable_unstable_package_management_api
from web3.pm import PM # noqa: F811
File "C:\Users\OGIDAN TOLU\.local\pipx\venvs\eth-brownie\lib\site-packages\web3\pm.py", line 36, in <module>
from ethpm import (
File "C:\Users\OGIDAN TOLU\.local\pipx\venvs\eth-brownie\lib\site-packages\ethpm\__init__.py", line 8, in <module>
from .package import Package # noqa: F401
File "C:\Users\OGIDAN TOLU\.local\pipx\venvs\eth-brownie\lib\site-packages\ethpm\package.py", line 60, in <module>
from ethpm.uri import (
File "C:\Users\OGIDAN TOLU\.local\pipx\venvs\eth-brownie\lib\site-packages\ethpm\uri.py", line 15, in <module>
from ethpm._utils.backend import (
File "C:\Users\OGIDAN TOLU\.local\pipx\venvs\eth-brownie\lib\site-packages\ethpm\_utils\backend.py", line 13, in <module>
from ipfshttpclient.exceptions import (
File "C:\Users\OGIDAN TOLU\.local\pipx\venvs\eth-brownie\lib\site-packages\ipfshttpclient\__init__.py", line 11, in <module>
from .client import DEFAULT_ADDR, DEFAULT_BASE
File "C:\Users\OGIDAN TOLU\.local\pipx\venvs\eth-brownie\lib\site-packages\ipfshttpclient\client\__init__.py", line 21, in <module>
from . import bitswap
File "C:\Users\OGIDAN TOLU\.local\pipx\venvs\eth-brownie\lib\site-packages\ipfshttpclient\client\bitswap.py", line 3, in <module>
from . import base
File "C:\Users\OGIDAN TOLU\.local\pipx\venvs\eth-brownie\lib\site-packages\ipfshttpclient\client\base.py", line 274, in <module>
def returns_no_item(func: _inner_func_t[ty.NoReturn]) -> _returns_single_wrapper_t:
File "C:\Users\OGIDAN TOLU\AppData\Local\Programs\Python\Python37\lib\typing.py", line 251, in inner
return func(*args, **kwds)
File "C:\Users\OGIDAN TOLU\AppData\Local\Programs\Python\Python37\lib\typing.py", line 824, in __class_getitem__
params = tuple(_type_check(p, msg) for p in params)
File "C:\Users\OGIDAN TOLU\AppData\Local\Programs\Python\Python37\lib\typing.py", line 824, in <genexpr>
params = tuple(_type_check(p, msg) for p in params)
File "C:\Users\OGIDAN TOLU\AppData\Local\Programs\Python\Python37\lib\typing.py", line 135, in _type_check
raise TypeError(f"Plain {arg} is not valid as type argument")
TypeError: Plain typing.NoReturn is not valid as type argument

Python throwing error around API when using requests

I'm new to APIs and am following the exact instructions of every website explaining how one is supposed to get help of the APIs in Python using the requests module. However, no matter what API link I define (of course I went for many free API samples just to test if they work), I get this error: ImportError: cannot import name 'b64encode' from 'base64'
I have no idea what the problem is, or what I'm not getting right.
Here's my snippet, just as a sample:
import requests
words = 30
paragraphs = 1
formats = 'text'
response = requests.get(f"https://v2.jokeapi.dev/")
print(response.text)
The complete error I get is like so:
Traceback (most recent call last):
File "/home/liana/Desktop/testing.py", line 1, in <module>
import requests
File "/usr/lib/python3/dist-packages/requests/__init__.py", line 43, in <module>
import urllib3
File "/usr/lib/python3/dist-packages/urllib3/__init__.py", line 11, in <module>
from . import exceptions
File "/usr/lib/python3/dist-packages/urllib3/exceptions.py", line 3, in <module>
from six.moves.http_client import IncompleteRead as httplib_IncompleteRead
File "/usr/lib/python3/dist-packages/six.py", line 203, in load_module
mod = mod._resolve()
File "/usr/lib/python3/dist-packages/six.py", line 115, in _resolve
return _import_module(self.mod)
File "/usr/lib/python3/dist-packages/six.py", line 82, in _import_module
__import__(name)
File "/usr/lib/python3.9/http/client.py", line 71, in <module>
import email.parser
File "/usr/lib/python3.9/email/parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "/usr/lib/python3.9/email/feedparser.py", line 27, in <module>
from email._policybase import compat32
File "/usr/lib/python3.9/email/_policybase.py", line 7, in <module>
from email import header
File "/usr/lib/python3.9/email/header.py", line 17, in <module>
import email.base64mime
File "/usr/lib/python3.9/email/base64mime.py", line 37, in <module>
from base64 import b64encode
ImportError: cannot import name 'b64encode' from 'base64' (/home/liana/Desktop/base64.py)
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 72, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 21, in <module>
from urllib.request import urlopen
File "/usr/lib/python3.9/urllib/request.py", line 88, in <module>
import http.client
File "/usr/lib/python3.9/http/client.py", line 71, in <module>
import email.parser
File "/usr/lib/python3.9/email/parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "/usr/lib/python3.9/email/feedparser.py", line 27, in <module>
from email._policybase import compat32
File "/usr/lib/python3.9/email/_policybase.py", line 7, in <module>
from email import header
File "/usr/lib/python3.9/email/header.py", line 17, in <module>
import email.base64mime
File "/usr/lib/python3.9/email/base64mime.py", line 37, in <module>
from base64 import b64encode
ImportError: cannot import name 'b64encode' from 'base64' (/home/liana/Desktop/base64.py)
Original exception was:
Traceback (most recent call last):
File "/home/liana/Desktop/testing.py", line 1, in <module>
import requests
File "/usr/lib/python3/dist-packages/requests/__init__.py", line 43, in <module>
import urllib3
File "/usr/lib/python3/dist-packages/urllib3/__init__.py", line 11, in <module>
from . import exceptions
File "/usr/lib/python3/dist-packages/urllib3/exceptions.py", line 3, in <module>
from six.moves.http_client import IncompleteRead as httplib_IncompleteRead
File "/usr/lib/python3/dist-packages/six.py", line 203, in load_module
mod = mod._resolve()
File "/usr/lib/python3/dist-packages/six.py", line 115, in _resolve
return _import_module(self.mod)
File "/usr/lib/python3/dist-packages/six.py", line 82, in _import_module
__import__(name)
File "/usr/lib/python3.9/http/client.py", line 71, in <module>
import email.parser
File "/usr/lib/python3.9/email/parser.py", line 12, in <module>
from email.feedparser import FeedParser, BytesFeedParser
File "/usr/lib/python3.9/email/feedparser.py", line 27, in <module>
from email._policybase import compat32
File "/usr/lib/python3.9/email/_policybase.py", line 7, in <module>
from email import header
File "/usr/lib/python3.9/email/header.py", line 17, in <module>
import email.base64mime
File "/usr/lib/python3.9/email/base64mime.py", line 37, in <module>
from base64 import b64encode
ImportError: cannot import name 'b64encode' from 'base64' (/home/liana/Desktop/base64.py)
Any help is appreciated.
If you look carefully at the traceback, you will see that it starts with your script, "/home/liana/Desktop/testing.py", goes through a chain of imports, and ends up crashing trying to import b64encode from base64.py.
The file /home/liana/Desktop/base64.py is something you either created or downloaded. Since it's in the current directory, it supersedes the real base64.py that "/usr/lib/python3.9/email/base64mime.py" is looking for. The file in your current directory clearly does not define the name b64encode, which is the immediate cause of the error.
To fix the problem, make sure the names of the files in your current directory don't conflict with the names of other top level modules. So either rename it delete /home/liana/Desktop/base64.py.

I can't run a script python in Ubuntu

I want to install this script( https://github.com/SpEcHiDe/AnyDLBot)
on my server, but I was surprised that I cannot run any Python script and this error message appears to me every time I run the Python script :
(VENV) root#Hermania:/datadrive/AnyDLBot# python3 -m anydlbot Traceback (most recent call last):
File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/datadrive/AnyDLBot/anydlbot/__main__.py", line 8, in <module>
from pyrogram import Client
File "/datadrive/AnyDLBot/VENV/lib/python3.5/site-packages/pyrogram/__init__.py", line 23, in <module>
from .client import *
File "/datadrive/AnyDLBot/VENV/lib/python3.5/site-packages/pyrogram/client/__init__.py", line 19, in <module>
from .client import Client
File "/datadrive/AnyDLBot/VENV/lib/python3.5/site-packages/pyrogram/client/client.py", line 40, in <module>
from pyrogram.client.methods.password.utils import compute_check
File "/datadrive/AnyDLBot/VENV/lib/python3.5/site-packages/pyrogram/client/methods/__init__.py", line 19, in <module>
from .bots import Bots
File "/datadrive/AnyDLBot/VENV/lib/python3.5/site-packages/pyrogram/client/methods/bots/__init__.py", line 19, in <module>
from .answer_callback_query import AnswerCallbackQuery
File "/datadrive/AnyDLBot/VENV/lib/python3.5/site-packages/pyrogram/client/methods/bots/answer_callback_query.py", line 20, in <module>
from pyrogram.client.ext import BaseClient
File "/datadrive/AnyDLBot/VENV/lib/python3.5/site-packages/pyrogram/client/ext/__init__.py", line 19, in <module>
from .base_client import BaseClient
File "/datadrive/AnyDLBot/VENV/lib/python3.5/site-packages/pyrogram/client/ext/base_client.py", line 28, in <module>
from ..parser import Parser
File "/datadrive/AnyDLBot/VENV/lib/python3.5/site-packages/pyrogram/client/parser/__init__.py", line 19, in <module>
from .parser import Parser
File "/datadrive/AnyDLBot/VENV/lib/python3.5/site-packages/pyrogram/client/parser/parser.py", line 23, in <module>
from .html import HTML
File "/datadrive/AnyDLBot/VENV/lib/python3.5/site-packages/pyrogram/client/parser/html.py", line 109, in <module>
class HTML:
File "/datadrive/AnyDLBot/VENV/lib/python3.5/site-packages/pyrogram/client/parser/html.py", line 110, in HTML
def __init__(self, client: Union["pyrogram.BaseClient", None]):
File "/usr/lib/python3.5/typing.py", line 552, in __getitem__
dict(self.__dict__), parameters, _root=True)
File "/usr/lib/python3.5/typing.py", line 512, in __new__
for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
File "/usr/lib/python3.5/typing.py", line 512, in <genexpr>
for t2 in all_params - {t1} if not isinstance(t2, TypeVar)):
File "/usr/lib/python3.5/typing.py", line 190, in __subclasscheck__
self._eval_type(globalns, localns)
File "/usr/lib/python3.5/typing.py", line 177, in _eval_type
eval(self.__forward_code__, globalns, localns),
File "<string>", line 1, in <module>
AttributeError: module 'pyrogram' has no attribute 'BaseClient'
For your information, I changed versions of Python, but I faced the same problem ☹️☹️☹️☹️☹️☹️

Python import error even though relevant module is installed

I'm trying to run Python behave tests but get the following error:
[moadmin#modevvm12 e2e-tests]$ behave -i features/tests/connmgr_2_scan_management_container.feature
Exception ImportError: No module named request
Traceback (most recent call last):
File "/usr/bin/behave", line 11, in <module>
sys.exit(main())
File "/usr/lib/python2.7/site-packages/behave/__main__.py", line 183, in main
return run_behave(config)
File "/usr/lib/python2.7/site-packages/behave/__main__.py", line 127, in run_behave
failed = runner.run()
File "/usr/lib/python2.7/site-packages/behave/runner.py", line 804, in run
return self.run_with_paths()
File "/usr/lib/python2.7/site-packages/behave/runner.py", line 808, in run_with_paths
self.load_hooks()
File "/usr/lib/python2.7/site-packages/behave/runner.py", line 784, in load_hooks
exec_file(hooks_path, self.hooks)
File "/usr/lib/python2.7/site-packages/behave/runner_util.py", line 386, in exec_file
exec(code, globals_, locals_)
File "features/environment.py", line 20, in <module>
from framework.sd.api.auth_rbac import AuthRBAC
File "/tmp/e2e-tests/framework/sd/api/auth_rbac.py", line 10, in <module>
from framework.sd.api.sd_endpoint import SDEndpoint
File "/tmp/e2e-tests/framework/sd/api/sd_endpoint.py", line 12, in <module>
import urllib.request, urllib.parse, urllib.error
ImportError: No module named request
urllib is installed so I can't understand why I get this error.

Spyder :An error ocurred while starting the kernel

I am still getting this error: An error occurred while starting the kernel
Things I tried:
setuptools command
updating spyder
Uninstalled everything that had word python in it from Uninstall or change progam panel
Uninstalling and reinstalling anaconda
Reading people's response on how they tried to fix it
Tried not to get frustrated.
This started occurring after I updated the spyder which I shouldn't have, but now I am stuck with the issue. I will share the complete message that's coming up on my IPhython Console screen.
Traceback (most recent call last):
File "C:\Users\afsan\Anaconda3\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 245, in
main()
File "C:\Users\afsan\Anaconda3\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 213, in main
from ipykernel.kernelapp import IPKernelApp
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\ipykernel\__init__.py", line 2, in
from .connect import *
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\ipykernel\connect.py", line 18, in
import jupyter_client
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\jupyter_client\__init__.py", line 4, in
from .connect import *
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\jupyter_client\connect.py", line 22, in
import zmq
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\__init__.py", line 34, in
from zmq import backend
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\backend\__init__.py", line 40, in
reraise(*exc_info)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\backend\__init__.py", line 27, in
_ns = select_backend(first)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\backend\select.py", line 26, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\backend\cython\__init__.py", line 6, in
from . import (constants, error, message, context,
ImportError: cannot import name 'constants'
Traceback (most recent call last):
File "C:\Users\afsan\Anaconda3\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 245, in
main()
File "C:\Users\afsan\Anaconda3\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 213, in main
from ipykernel.kernelapp import IPKernelApp
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\ipykernel\__init__.py", line 2, in
from .connect import *
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\ipykernel\connect.py", line 18, in
import jupyter_client
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\jupyter_client\__init__.py", line 4, in
from .connect import *
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\jupyter_client\connect.py", line 22, in
import zmq
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\__init__.py", line 34, in
from zmq import backend
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\backend\__init__.py", line 40, in
reraise(*exc_info)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\backend\__init__.py", line 27, in
_ns = select_backend(first)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\backend\select.py", line 26, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\backend\cython\__init__.py", line 6, in
from . import (constants, error, message, context,
ImportError: cannot import name 'constants'
Traceback (most recent call last):
File "C:\Users\afsan\Anaconda3\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 245, in
main()
File "C:\Users\afsan\Anaconda3\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 213, in main
from ipykernel.kernelapp import IPKernelApp
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\ipykernel\__init__.py", line 2, in
from .connect import *
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\ipykernel\connect.py", line 18, in
import jupyter_client
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\jupyter_client\__init__.py", line 4, in
from .connect import *
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\jupyter_client\connect.py", line 22, in
import zmq
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\__init__.py", line 34, in
from zmq import backend
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\backend\__init__.py", line 40, in
reraise(*exc_info)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\backend\__init__.py", line 27, in
_ns = select_backend(first)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\backend\select.py", line 26, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\backend\cython\__init__.py", line 6, in
from . import (constants, error, message, context,
ImportError: cannot import name 'constants'
Traceback (most recent call last):
File "C:\Users\afsan\Anaconda3\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 245, in
main()
File "C:\Users\afsan\Anaconda3\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 213, in main
from ipykernel.kernelapp import IPKernelApp
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\ipykernel\__init__.py", line 2, in
from .connect import *
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\ipykernel\connect.py", line 18, in
import jupyter_client
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\jupyter_client\__init__.py", line 4, in
from .connect import *
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\jupyter_client\connect.py", line 22, in
import zmq
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\__init__.py", line 34, in
from zmq import backend
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\backend\__init__.py", line 40, in
reraise(*exc_info)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\backend\__init__.py", line 27, in
_ns = select_backend(first)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\backend\select.py", line 26, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\backend\cython\__init__.py", line 6, in
from . import (constants, error, message, context,
ImportError: cannot import name 'constants'
Traceback (most recent call last):
File "C:\Users\afsan\Anaconda3\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 245, in
main()
File "C:\Users\afsan\Anaconda3\lib\site‑packages\spyder\utils\ipython\start_kernel.py", line 213, in main
from ipykernel.kernelapp import IPKernelApp
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\ipykernel\__init__.py", line 2, in
from .connect import *
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\ipykernel\connect.py", line 18, in
import jupyter_client
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\jupyter_client\__init__.py", line 4, in
from .connect import *
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\jupyter_client\connect.py", line 22, in
import zmq
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\__init__.py", line 34, in
from zmq import backend
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\backend\__init__.py", line 40, in
reraise(*exc_info)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\backend\__init__.py", line 27, in
_ns = select_backend(first)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\backend\select.py", line 26, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\afsan\AppData\Local\Programs\Python\Python36󈛄\Lib\site‑packages\zmq\backend\cython\__init__.py", line 6, in
from . import (constants, error, message, context,
ImportError: cannot import name 'constants'
The problem is that you have two Python versions installed:
C:\Users\afsan\Anaconda3\
C:\Users\afsan\AppData\Local\Programs\Python\Python36
Given that it seems you want to use Spyder with Anaconda, please remove your second Python version (manually, if necessary). That should fix your problem.

Categories

Resources