pkg_resources.DistributionNotFound: The 'wheel>=0.26; python_version >= "3"' distribution was not found and is required by tensorboard - unity3d

When I was installing the ml-agents from unity,i encountered a problem. i was not able to fix it at this moment.
I am running an env through anaconda. i entered the command:
mlagents-learn to verify the installation
(unity_envIAJ) C:\Users\Rui\Documents\GitHub\ml-agents-release_10>mlagents-learn
Traceback (most recent call last):
File "D:\Conda\envs\unity_envIAJ\lib\site-packages\pkg_resources\__init__.py", line 567, in _build_master
ws.require(__requires__)
File "D:\Conda\envs\unity_envIAJ\lib\site-packages\pkg_resources\__init__.py", line 884, in require
needed = self.resolve(parse_requirements(requirements))
File "D:\Conda\envs\unity_envIAJ\lib\site-packages\pkg_resources\__init__.py", line 775, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (numpy 1.19.2 (d:\conda\envs\unity_enviaj\lib\site-packages), Requirement.parse('numpy<1.19.0,>=1.14.1'), {'mlagents-envs'})
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Conda\envs\unity_envIAJ\Scripts\mlagents-learn-script.py", line 33, in <module>
sys.exit(load_entry_point('mlagents', 'console_scripts', 'mlagents-learn')())
File "D:\Conda\envs\unity_envIAJ\Scripts\mlagents-learn-script.py", line 25, in importlib_load_entry_point
return next(matches).load()
File "D:\Conda\envs\unity_envIAJ\lib\importlib\metadata.py", line 75, in load
module = import_module(match.group('module'))
File "D:\Conda\envs\unity_envIAJ\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "c:\users\rui\documents\github\ml-agents-release_10\ml-agents\mlagents\trainers\learn.py", line 2, in <module>
from mlagents import torch_utils
File "c:\users\rui\documents\github\ml-agents-release_10\ml-agents\mlagents\torch_utils\__init__.py", line 1, in <module>
from mlagents.torch_utils.torch import torch as torch # noqa
File "c:\users\rui\documents\github\ml-agents-release_10\ml-agents\mlagents\torch_utils\torch.py", line 4, in <module>
import pkg_resources
File "D:\Conda\envs\unity_envIAJ\lib\site-packages\pkg_resources\__init__.py", line 3239, in <module>
def _initialize_master_working_set():
File "D:\Conda\envs\unity_envIAJ\lib\site-packages\pkg_resources\__init__.py", line 3222, in _call_aside
f(*args, **kwargs)
File "D:\Conda\envs\unity_envIAJ\lib\site-packages\pkg_resources\__init__.py", line 3251, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "D:\Conda\envs\unity_envIAJ\lib\site-packages\pkg_resources\__init__.py", line 569, in _build_master
return cls._build_from_requirements(__requires__)
File "D:\Conda\envs\unity_envIAJ\lib\site-packages\pkg_resources\__init__.py", line 582, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "D:\Conda\envs\unity_envIAJ\lib\site-packages\pkg_resources\__init__.py", line 770, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'wheel>=0.26; python_version >= "3"' distribution was not found and is required by tensorboard
python version: 3.8.0
tensorboard: 2.4.0
wheel: 0.36.2

I had to change the numpy for the correct version and proceeded to uninstall any tensorboard and tensorflow related packages and only install through conda tensorboard.

Related

Issue Registering Keras model / mlflow.artifacts

I'm first registering a keras model using mlflow.keras.log_model().
Once it is registered, I get code : null in the description of the MLModel in Mlflow ui.
It seems like this prevents me from using it later in pyfunc that uses this model, as I have tried to do it for already deployed model and the only difference is this code : null thing, that prevents from deploying.
When trying to use the pyfunc, last error is ModuleNotFoundError: No module named 'mlflow.artifacts'
[ERROR] Exception in worker process
Traceback (most recent call last):
File "/opt/conda/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/opt/conda/lib/python3.6/site-packages/gunicorn/workers/base.py", line 119, in init_process
self.load_wsgi()
File "/opt/conda/lib/python3.6/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
self.wsgi = self.app.wsgi()
File "/opt/conda/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/opt/conda/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
return self.load_wsgiapp()
File "/opt/conda/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
return util.import_app(self.app_uri)
File "/opt/conda/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
mod = importlib.import_module(module)
File "/opt/conda/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/opt/conda/lib/python3.6/site-packages/mlflow/pyfunc/scoring_server/wsgi.py", line 6, in <module>
app = scoring_server.init(load_model(os.environ[scoring_server._SERVER_MODEL_PATH]))
File "/opt/conda/lib/python3.6/site-packages/mlflow/pyfunc/__init__.py", line 483, in load_model
model_impl = importlib.import_module(conf[MAIN])._load_pyfunc(data_path)
File "/opt/conda/lib/python3.6/site-packages/mlflow/pyfunc/model.py", line 223, in _load_pyfunc
python_model = cloudpickle.load(f)
File "/opt/conda/lib/python3.6/site-packages/cloudpickle/cloudpickle.py", line 562, in subimport
__import__(name)
ModuleNotFoundError: No module named 'mlflow.artifacts'
[2022-07-26 10:43:32 +0000] [60] [INFO] Worker exiting (pid: 60)
[2022-07-26 10:43:32 +0000] [57] [INFO] Shutting down: Master
[2022-07-26 10:43:32 +0000] [57] [INFO] Reason: Worker failed to boot.
Any idea making this work ?

Airflow db init ERROR - Failed to add operation for GET /api/v1/connections

I am trying to install Airflow 2.0.1 with ansible on CentOS8 machine. Python version 3.8.1. I made pip 20.2.4 as suggested in Airflow docs.
I am using postgresql and airflow db check is successful. But the db init task gives the following error. I tried airflow db init manually but the result was the same:
ERROR - Failed to add operation for GET /api/v1/connections
Traceback (most recent call last):
File "/opt/airflow/lib/python3.8/site-packages/connexion/apis/abstract.py", line 209, in add_paths
self.add_operation(path, method)
File "/opt/airflow/lib/python3.8/site-packages/connexion/apis/abstract.py", line 162, in add_operation
operation = make_operation(
File "/opt/airflow/lib/python3.8/site-packages/connexion/operations/__init__.py", line 8, in make_operation
return spec.operation_cls.from_spec(spec, *args, **kwargs)
File "/opt/airflow/lib/python3.8/site-packages/connexion/operations/openapi.py", line 128, in from_spec
return cls(
File "/opt/airflow/lib/python3.8/site-packages/connexion/operations/openapi.py", line 75, in __init__
super(OpenAPIOperation, self).__init__(
File "/opt/airflow/lib/python3.8/site-packages/connexion/operations/abstract.py", line 96, in __init__
self._resolution = resolver.resolve(self)
File "/opt/airflow/lib/python3.8/site-packages/connexion/resolver.py", line 40, in resolve
return Resolution(self.resolve_function_from_operation_id(operation_id), operation_id)
File "/opt/airflow/lib/python3.8/site-packages/connexion/resolver.py", line 66, in resolve_function_from_operation_id
raise ResolverError(str(e), sys.exc_info())
connexion.exceptions.ResolverError: <ResolverError: columns>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/airflow/bin/airflow", line 8, in <module>
sys.exit(main())
File "/opt/airflow/lib/python3.8/site-packages/airflow/__main__.py", line 40, in main
args.func(args)
File "/opt/airflow/lib/python3.8/site-packages/airflow/cli/cli_parser.py", line 48, in command
return func(*args, **kwargs)
File "/opt/airflow/lib/python3.8/site-packages/airflow/cli/commands/db_command.py", line 31, in initdb
db.initdb()
File "/opt/airflow/lib/python3.8/site-packages/airflow/utils/db.py", line 549, in initdb
upgradedb()
File "/opt/airflow/lib/python3.8/site-packages/airflow/utils/db.py", line 684, in upgradedb
command.upgrade(config, 'heads')
File "/opt/airflow/lib/python3.8/site-packages/alembic/command.py", line 294, in upgrade
script.run_env()
File "/opt/airflow/lib/python3.8/site-packages/alembic/script/base.py", line 490, in run_env
util.load_python_file(self.dir, "env.py")
File "/opt/airflow/lib/python3.8/site-packages/alembic/util/pyfiles.py", line 97, in load_python_file
module = load_module_py(module_id, path)
File "/opt/airflow/lib/python3.8/site-packages/alembic/util/compat.py", line 182, in load_module_py
spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/opt/airflow/lib/python3.8/site-packages/airflow/migrations/env.py", line 108, in <module>
run_migrations_online()
File "/opt/airflow/lib/python3.8/site-packages/airflow/migrations/env.py", line 102, in run_migrations_online
context.run_migrations()
File "<string>", line 8, in run_migrations
File "/opt/airflow/lib/python3.8/site-packages/alembic/runtime/environment.py", line 813, in run_migrations
self.get_context().run_migrations(**kw)
File "/opt/airflow/lib/python3.8/site-packages/alembic/runtime/migration.py", line 561, in run_migrations
step.migration_fn(**kw)
File "/opt/airflow/lib/python3.8/site-packages/airflow/migrations/versions/2c6edca13270_resource_based_permissions.py", line 314, in upgrade
remap_permissions()
File "/opt/airflow/lib/python3.8/site-packages/airflow/migrations/versions/2c6edca13270_resource_based_permissions.py", line 289, in remap_permissions
appbuilder = create_app(config={'FAB_UPDATE_PERMS': False}).appbuilder
File "/opt/airflow/lib/python3.8/site-packages/airflow/www/app.py", line 120, in create_app
init_api_connexion(flask_app)
File "/opt/airflow/lib/python3.8/site-packages/airflow/www/extensions/init_views.py", line 171, in init_api_connexion
api_bp = connexion_app.add_api(
File "/opt/airflow/lib/python3.8/site-packages/connexion/apps/flask_app.py", line 57, in add_api
api = super(FlaskApp, self).add_api(specification, **kwargs)
File "/opt/airflow/lib/python3.8/site-packages/connexion/apps/abstract.py", line 144, in add_api
api = self.api_cls(specification,
File "/opt/airflow/lib/python3.8/site-packages/connexion/apis/abstract.py", line 111, in __init__
self.add_paths()
File "/opt/airflow/lib/python3.8/site-packages/connexion/apis/abstract.py", line 216, in add_paths
self._handle_add_operation_error(path, method, err.exc_info)
File "/opt/airflow/lib/python3.8/site-packages/connexion/apis/abstract.py", line 231, in _handle_add_operation_error
raise value.with_traceback(traceback)
File "/opt/airflow/lib/python3.8/site-packages/connexion/resolver.py", line 61, in resolve_function_from_operation_id
return self.function_resolver(operation_id)
File "/opt/airflow/lib/python3.8/site-packages/connexion/utils.py", line 111, in get_function_from_name
module = importlib.import_module(module_name)
File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/opt/airflow/lib/python3.8/site-packages/airflow/api_connexion/endpoints/connection_endpoint.py", line 26, in <module>
from airflow.api_connexion.schemas.connection_schema import (
File "/opt/airflow/lib/python3.8/site-packages/airflow/api_connexion/schemas/connection_schema.py", line 42, in <module>
class ConnectionSchema(ConnectionCollectionItemSchema): # pylint: disable=too-many-ancestors
File "/opt/airflow/lib/python3.8/site-packages/marshmallow/schema.py", line 121, in __new__
klass._declared_fields = mcs.get_declared_fields(
File "/opt/airflow/lib/python3.8/site-packages/marshmallow_sqlalchemy/schema/sqlalchemy_schema.py", line 94, in get_declared_fields
fields.update(mcs.get_auto_fields(fields, converter, opts, dict_cls))
File "/opt/airflow/lib/python3.8/site-packages/marshmallow_sqlalchemy/schema/sqlalchemy_schema.py", line 104, in get_auto_fields
{
File "/opt/airflow/lib/python3.8/site-packages/marshmallow_sqlalchemy/schema/sqlalchemy_schema.py", line 105, in <dictcomp>
field_name: field.create_field(
File "/opt/airflow/lib/python3.8/site-packages/marshmallow_sqlalchemy/schema/sqlalchemy_schema.py", line 28, in create_field
return converter.field_for(model, column_name, **self.field_kwargs)
File "/opt/airflow/lib/python3.8/site-packages/marshmallow_sqlalchemy/convert.py", line 171, in field_for
return self.property2field(prop, **kwargs)
File "/opt/airflow/lib/python3.8/site-packages/marshmallow_sqlalchemy/convert.py", line 146, in property2field
field_class = field_class or self._get_field_class_for_property(prop)
File "/opt/airflow/lib/python3.8/site-packages/marshmallow_sqlalchemy/convert.py", line 210, in _get_field_class_for_property
column = prop.columns[0]
File "/opt/airflow/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 1220, in __getattr__
return self._fallback_getattr(key)
File "/opt/airflow/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 1194, in _fallback_getattr
raise AttributeError(key)
AttributeError: columns
I'm having the same issue, temp fix was to use sqlalchemy < 1.4. Maybe that works for you.
What Worked for me is setting AIRFLOW_HOME and AIRFLOW__CORE__SQL_ALCHEMY_CONN and pip install SQLAlchemy==1.3.24
For me and Airflow 2.3.1 upgrading marshmallow-sqlalchemy helped.
pip install -U marshmallow-sqlalchemy
I set the AIRFLOW_HOME and AIRFLOW__CORE__SQL_ALCHEMY_CONN environment before run airflow db init.
Playbook version
environment:
AIRFLOW_HOME: "{{ airflow_app_home }}"
AIRFLOW__CORE__SQL_ALCHEMY_CONN: "{{ airflow_database_conn }}"

Issue when trying to install "pytest-allure-adaptor" in PyCharm

I am trying to generate XML allure reports through PyCharm on my pytest project. I have installed allure-pytest and required packages for the test cases to run. However when I try to install pytest-allure-adaptor from File -> Settings -> Project Interpreter I get the error as follows :
"error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/"
I have installed Visual C++ Redistributable for Visual Studio 2015 but it doesn't help. Please help me with a solution.
When I use pytest command to run my project I get the below error after install adaptor via pip install pytest-allure-adaptor :
Traceback (most recent call last):
File "c:\users\geeth\appdata\local\programs\python\python38\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\geeth\appdata\local\programs\python\python38\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\geeth\AppData\Local\Programs\Python\Python38\Scripts\pytest.exe\__main__.py", line 9, in <module>
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\_pytest\config\__init__.py", line 105, in main
config = _prepareconfig(args, plugins)
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\_pytest\config\__init__.py", line 257, in _prepareconfig
return pluginmanager.hook.pytest_cmdline_parse(
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\pluggy\hooks.py", line 286, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 84, in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\pluggy\callers.py", line 203, in _multicall
gen.send(outcome)
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\_pytest\helpconfig.py", line 90, in pytest_cmdline_parse
config = outcome.get_result()
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\pluggy\callers.py", line 80, in get_result
raise ex[1].with_traceback(ex[2])
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\pluggy\callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\_pytest\config\__init__.py", line 836, in pytest_cmdline_parse
self.parse(args)
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\_pytest\config\__init__.py", line 1044, in parse
self._preparse(args, addopts=addopts)
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\_pytest\config\__init__.py", line 992, in _preparse
self.pluginmanager.load_setuptools_entrypoints("pytest11")
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\pluggy\manager.py", line 299, in load_setuptools_entrypoints
plugin = ep.load()
File "c:\users\geeth\appdata\local\programs\python\python38\lib\importlib\metadata.py", line 77, in load
module = import_module(match.group('module'))
File "c:\users\geeth\appdata\local\programs\python\python38\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\_pytest\assertion\rewrite.py", line 152, in exec_module
exec(co, module.__dict__)
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\allure_pytest\plugin.py", line 3, in <module>
import allure
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\_pytest\assertion\rewrite.py", line 152, in exec_module
exec(co, module.__dict__)
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\allure\__init__.py", line 1, in <module>
from allure.pytest_plugin import MASTER_HELPER
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\_pytest\assertion\rewrite.py", line 152, in exec_module
exec(co, module.__dict__)
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\allure\pytest_plugin.py", line 9, in <module>
from allure.common import AllureImpl, StepContext
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\_pytest\assertion\rewrite.py", line 152, in exec_module
exec(co, module.__dict__)
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\allure\common.py", line 19, in <module>
from allure.structure import Attach, TestStep, TestCase, TestSuite, Failure, Environment, EnvParameter
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\_pytest\assertion\rewrite.py", line 152, in exec_module
exec(co, module.__dict__)
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\allure\structure.py", line 14, in <module>
class Attach(xmlfied('attachment',
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\allure\rules.py", line 116, in xmlfied
class MyImpl(namedlist('XMLFied', [(item[0], None) for item in items])):
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\namedlist.py", line 381, in namedlist
type_dict = {'__init__': _make_fn('__init__', _nl_init, fields, defaults),
File "c:\users\geeth\appdata\local\programs\python\python38\lib\site-packages\namedlist.py", line 180, in _make_fn
code = compile(module_node, '<string>', 'exec')
TypeError: required field "posonlyargs" missing from arguments

"TypeError: object of type 'map' has no len()" error when adding django_social to INSTALLED_APPS

I am tryging to implement django social auth, and to do that I did pip install social-auth-app-django, then I went on to add social_django to my INSTALLED_APPS. After that when I am running the app, I am getting the following error (I am submitting the entire traceback):
Traceback (most recent call last):
File "c:\users\edgar\appdata\local\programs\python\python35\lib\threading.py", line 914, in _bootstrap_inner
self.run()
File "c:\users\edgar\appdata\local\programs\python\python35\lib\threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\Edgar\venvs\internet-lead\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\Edgar\venvs\internet-lead\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "C:\Users\Edgar\venvs\internet-lead\lib\site-packages\django\utils\autoreload.py", line 77, in raise_last_exception
raise _exception[1]
File "C:\Users\Edgar\venvs\internet-lead\lib\site-packages\django\core\management\__init__.py", line 337, in execute
autoreload.check_errors(django.setup)()
File "C:\Users\Edgar\venvs\internet-lead\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
fn(*args, **kwargs)
File "C:\Users\Edgar\venvs\internet-lead\lib\site-packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Edgar\venvs\internet-lead\lib\site-packages\django\apps\registry.py", line 114, in populate
app_config.import_models()
File "C:\Users\Edgar\venvs\internet-lead\lib\site-packages\django\apps\config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "c:\users\edgar\appdata\local\programs\python\python35\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "C:\Users\Edgar\venvs\internet-lead\lib\site-packages\social_django\models.py", line 11, in <module>
from .storage import DjangoUserMixin, DjangoAssociationMixin, \
File "C:\Users\Edgar\venvs\internet-lead\lib\site-packages\social_django\storage.py", line 9, in <module>
from social_core.storage import UserMixin, AssociationMixin, NonceMixin, \
File "C:\Users\Edgar\venvs\internet-lead\lib\site-packages\social_core\storage.py", line 12, in <module>
from openid.association import Association as OpenIdAssociation
File "C:\Users\Edgar\venvs\internet-lead\lib\site-packages\openid\__init__.py", line 52, in <module>
if len(version_info) != 3:
TypeError: object of type 'map' has no len()
If I comment out the 'social_django' from the INSTALLED_APPS, everything works fine again.
My python version is 3.5.2, and Django 2.2.12. Any ideas ? I am lost...
I faced this error , I fixed it by uninstalling both python-openid and python3-openid :
pip uninstall python-openid
pip uninstall python3-openid
then re-install python3-openid using:
pip install python3-openid

Python Keyerror 'sapi5', cant understand the error

One question of this type is previously asked but is not very helpful. I am using version Python3.8 in Windows 10 OS. I am getting an error, KeyError: 'sapi5'. dont know why this error is occurring. Please have a look at the below code given . My code is-
import pyttsx3
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voices', voices[0].id)
The Error is quite big. can anyone help me?
Traceback (most recent call last):
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\__init__.py", line 20, in init
eng = _activeEngines[driverName]
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\weakref.py", line 131, in __getitem__
o = self.data[key]()
KeyError: 'sapi5'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\drivers\sapi5.py", line 3, in <module>
from comtypes.gen import SpeechLib # comtypes
ImportError: cannot import name 'SpeechLib' from 'comtypes.gen' (C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\gen\__init__.py)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\ctypes\__init__.py", line 123, in WINFUNCTYPE
return _win_functype_cache[(restype, argtypes, flags)]
KeyError: (<class 'ctypes.HRESULT'>, (<class 'ctypes.c_long'>, <class 'comtypes.automation.tagVARIANT'>, <class 'comtypes.automation.tagVARIANT'>, <class 'ctypes.c_long'>, <class 'ctypes.c_long'>), 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "g:/saurav/Assistant/VA/MyAssistant.py", line 9, in <module>
engine = pyttsx3.init('sapi5')
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\__init__.py", line 22, in init
eng = Engine(driverName, debug)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\engine.py", line 30, in __init__
self.proxy = driver.DriverProxy(weakref.proxy(self), driverName, debug)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\driver.py", line 50, in __init__
self._module = importlib.import_module(name)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyttsx3\drivers\sapi5.py", line 6, in <module>
engine = comtypes.client.CreateObject("SAPI.SpVoice")
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\__init__.py", line 250, in CreateObject
return _manage(obj, clsid, interface=interface)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\__init__.py", line 188, in _manage
obj = GetBestInterface(obj)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\__init__.py", line 110, in GetBestInterface
mod = GetModule(tlib)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\_generate.py", line 110, in GetModule
mod = _CreateWrapper(tlib, pathname)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\_generate.py", line 184, in _CreateWrapper
mod = _my_import(fullname)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\client\_generate.py", line 24, in _my_import
return __import__(fullname, globals(), locals(), ['DUMMY'])
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\gen\_C866CA3A_32F7_11D2_9602_00C04F8EE628_0_5_4.py", line 140, in <module>
ISpeechRecoGrammar._methods_ = [
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\__init__.py", line 329, in __setattr__
self._make_methods(value)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\site-packages\comtypes\__init__.py", line 698, in _make_methods
prototype = WINFUNCTYPE(restype, *argtypes)
File "C:\Users\hp\AppData\Local\Programs\Python\Python38-32\lib\ctypes\__init__.py", line 125, in WINFUNCTYPE
class WinFunctionType(_CFuncPtr):
TypeError: item 2 in _argtypes_ passes a union by value, which is unsupported.
first uninstall pyttsx3 using following command
pip uninstall pyttsx3
Then install pyttsx3 version 2.6 using following command
pip install pyttsx3==2.6