Cant import pynput on macos Monterey 12.1 - python

When I try to run, I keep getting this error. I've tried downgrading to pyobjc 7.3 and it still gives me the same error. What could be the problem?
Traceback (most recent call last):
File "/Users/jeremyparker/PycharmProjects/pythonProject/main.py", line 4, in <module>
import pynput
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pynput/__init__.py", line 40, in <module>
from . import keyboard
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pynput/keyboard/__init__.py", line 31, in <module>
backend = backend(__name__)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pynput/_util/__init__.py", line 70, in backend
return importlib.import_module('._' + module, package)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pynput/keyboard/_darwin.py", line 51, in <module>
from pynput._util.darwin import (
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pynput/_util/darwin.py", line 60, in <module>
OBJC.PyObjCObject_New.restype = ctypes.py_object
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 387, in __getattr__
func = self.__getitem__(name)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 392, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(0x2055dbc80, PyObjCObject_New): symbol not found

Related

How to load pandas package in an Anki addon?

I want to use a numpy function in an Anki addon that I am forking, but it returns an error when I run Anki (error below). I guess it is because I am using import numpy. So how I can use a numpy function when the package is not in the original code in the addon. Should I install the package first? If yes, how? Because pip install doesn't work in the code and I should probably install package in an environment.
Caught exception:
Traceback (most recent call last):
File "aqt\progress.py", line 54, in handler
File "aqt\main.py", line 149, in on_window_init
File "aqt\main.py", line 197, in setupProfileAfterWebviewsLoaded
File "aqt\main.py", line 244, in setupProfile
File "aqt\main.py", line 425, in loadProfile
File "aqt\hooks_gen.py", line 2985, in __call__
File "anki\hooks.py", line 34, in runHook
File "C:\Users\saeed\AppData\Roaming\Anki2\addons21\1807206748\__init__.py", line 37, in start_here
from . import common as fastwq
File "C:\Users\saeed\AppData\Roaming\Anki2\addons21\1807206748\common.py", line 29, in <module>
from .gui import show_about_dialog, show_options # , check_updates
File "C:\Users\saeed\AppData\Roaming\Anki2\addons21\1807206748\gui\__init__.py", line 3, in <module>
from .common import *
File "C:\Users\saeed\AppData\Roaming\Anki2\addons21\1807206748\gui\common.py", line 28, in <module>
from ..service import service_manager, service_pool
File "C:\Users\saeed\AppData\Roaming\Anki2\addons21\1807206748\service\__init__.py", line 24, in <module>
service_manager = ServiceManager() # Service Manager
File "C:\Users\saeed\AppData\Roaming\Anki2\addons21\1807206748\service\manager.py", line 35, in __init__
self.update_services()
File "C:\Users\saeed\AppData\Roaming\Anki2\addons21\1807206748\service\manager.py", line 43, in update_services
self.web_services, self.local_custom_services = self._get_services_from_files()
File "C:\Users\saeed\AppData\Roaming\Anki2\addons21\1807206748\service\manager.py", line 78, in _get_services_from_files
module = importlib.import_module(
File "C:\Users\saeed\AppData\Roaming\Anki2\addons21\1807206748\utils\importlib.py", line 43, in import_module
__import__(name)
File "C:\Users\saeed\AppData\Roaming\Anki2\addons21\1807206748\service\dict\frdic.py", line 8, in <module>
import numpy
ModuleNotFoundError: No module named 'numpy'

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.

Tensorflow Kubernetes Integration Tutorial fails on Ubuntu Xenial

I am following the "Serving Inception Model with TensorFlow Serving and Kubernetes" tutorial from the tensorflow.org website. When I get to loading and exporting the model using
root#ecf82ac60c6b:/serving# bazel-bin/tensorflow_serving/example/inception_saved_model --checkpoint_dir=inception-v3 --output_dir=/tmp/inception-export
I get following error.
Traceback (most recent call last):
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/tf_serving/tensorflow_serving/example/inception_saved_model.py", line 202, in <module>
tf.app.run()
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/org_tensorflow/tensorflow/python/platform/app.py", line 124, in run
_sys.exit(main(argv))
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/tf_serving/tensorflow_serving/example/inception_saved_model.py", line 198, in main
export()
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/tf_serving/tensorflow_serving/example/inception_saved_model.py", line 91, in export
table = tf.contrib.lookup.index_to_string_table_from_tensor(class_tensor)
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/org_tensorflow/tensorflow/python/util/lazy_loader.py", line 53, in __getattr__
module = self._load()
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/org_tensorflow/tensorflow/python/util/lazy_loader.py", line 42, in _load
module = importlib.import_module(self.__name__)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/org_tensorflow/tensorflow/contrib/__init__.py", line 82, in <module>
from tensorflow.contrib.eager.python import tfe as eager
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/org_tensorflow/tensorflow/contrib/eager/python/tfe.py", line 76, in <module>
from tensorflow.contrib.eager.python.datasets import Iterator
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/org_tensorflow/tensorflow/contrib/eager/python/datasets.py", line 23, in <module>
from tensorflow.contrib.data.python.ops import prefetching_ops
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/org_tensorflow/tensorflow/contrib/data/python/ops/prefetching_ops.py", line 25, in <module>
resource_loader.get_path_to_datafile("../../_prefetching_ops.so"))
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/org_tensorflow/tensorflow/contrib/util/loader.py", line 55, in load_op_library
ret = load_library.load_op_library(path)
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/org_tensorflow/tensorflow/python/framework/load_library.py", line 56, in load_op_library
lib_handle = py_tf.TF_LoadLibrary(library_filename, status)
File "/serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/org_tensorflow/tensorflow/python/framework/errors_impl.py", line 473, in __exit__
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.NotFoundError: /serving/bazel-bin/tensorflow_serving/example/inception_saved_model.runfiles/org_tensorflow/tensorflow/contrib/data/python/ops/../../_prefetching_ops.so: undefined symbol: _ZN6google8protobuf8internal9ArenaImpl10AddCleanupEPvPFvS3_E
I tried the solution on How to troubleshoot deployment of Inception serving running in kubernetes, but it does not apply to this problem. Has anyone encountered the same problem and maybe figured out how to solve it?

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

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

Can't install Tensorflow, receiving both numpy and a TypeError: unsupported callable errors

I recently tried to install Tensorflow, following the instructions in their tutorial. While the installation itself worked fine, when I tried to import it, I got this:
>>> import tensorflow as tf
Traceback (most recent call last):
File "/usr/lib/python3.4/inspect.py", line 977, in getfullargspec
skip_bound_arg=False)
File "/usr/lib/python3.4/inspect.py", line 1957, in _signature_internal
skip_bound_arg=skip_bound_arg)
File "/usr/lib/python3.4/inspect.py", line 1890, in _signature_from_builtin
raise ValueError("no signature found for builtin {!r}".format(func))
ValueError: no signature found for builtin <method 'max' of 'numpy.ndarray' objects>
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/dist-packages/tensorflow/__init__.py", line 23, in <module>
from tensorflow.python import *
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/__init__.py", line 62, in <module>
import tensorflow.contrib as contrib
File "/usr/local/lib/python3.4/dist-packages/tensorflow/contrib/__init__.py", line 26, in <module>
from tensorflow.contrib import learn
File "/usr/local/lib/python3.4/dist-packages/tensorflow/contrib/learn/__init__.py", line 20, in <module>
from tensorflow.contrib.learn.python.learn import *
File "/usr/local/lib/python3.4/dist-packages/tensorflow/contrib/learn/python/__init__.py", line 20, in <module>
from tensorflow.contrib.learn.python.learn import *
File "/usr/local/lib/python3.4/dist-packages/tensorflow/contrib/learn/python/learn/__init__.py", line 22, in <module>
from tensorflow.contrib.learn.python.learn.io import *
File "/usr/local/lib/python3.4/dist-packages/tensorflow/contrib/learn/python/learn/io/__init__.py", line 20, in <module>
from tensorflow.contrib.learn.python.learn.io.dask_io import *
File "/usr/local/lib/python3.4/dist-packages/tensorflow/contrib/learn/python/learn/io/dask_io.py", line 23, in <module>
import dask.dataframe as dd
File "/usr/local/lib/python3.4/dist-packages/dask/dataframe/__init__.py", line 1, in <module>
from .core import (DataFrame, Series, Index, _Frame, map_partitions,
File "/usr/local/lib/python3.4/dist-packages/dask/dataframe/core.py", line 1252, in <module>
class Index(Series):
File "/usr/local/lib/python3.4/dist-packages/dask/dataframe/core.py", line 1284, in Index
#derived_from(pd.Index)
File "/usr/local/lib/python3.4/dist-packages/dask/utils.py", line 530, in wrapper
original_args = getargspec(original_method).args
File "/usr/local/lib/python3.4/dist-packages/dask/compatibility.py", line 222, in getargspec
return _getargspec(func)
File "/usr/local/lib/python3.4/dist-packages/dask/compatibility.py", line 44, in _getargspec
return inspect.getfullargspec(func)
File "/usr/lib/python3.4/inspect.py", line 983, in getfullargspec
raise TypeError('unsupported callable') from ex
TypeError: unsupported callable
And after uninstalling it, updating Protobuf and pip, and re-installing multiple times, I still get this same error. What could be the problem?

Categories

Resources