I'm trying to import PyGreSQL in Python. I've successfully installed it with pip, and also have GLFW3 installed, but I run into the following error when I import
>>> import pg
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "//anaconda/lib/py
thon3.5/site-packages/pg/__init__.py", line 1, in <module>
from .core import (
File "//anaconda/lib/python3.5/site-packages/pg/core.py", line 6, in <module>
from . import glfw
File "//anaconda/lib/python3.5/site-packages/pg/glfw.py", line 138, in <module>
['', '/usr/lib', '/usr/local/lib'], _glfw_get_version)
File "//anaconda/lib/python3.5/site-packages/pg/glfw.py", line 74, in _load_library
version = version_check_callback(filename)
File "//anaconda/lib/python3.5/site-packages/pg/glfw.py", line 130, in _glfw_get_version
out = process.communicate(_to_char_p(filename))[0]
File "//anaconda/lib/python3.5/subprocess.py", line 801, in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
File "//anaconda/lib/python3.5/subprocess.py", line 1428, in _communicate
self._save_input(input)
File "//anaconda/lib/python3.5/subprocess.py", line 1501, in _save_input
self._input = self._input.encode(self.stdin.encoding)
AttributeError: 'bytes' object has no attribute 'encode'>>> import pg
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "//anaconda/lib/python3.5/site-packages/pg/__init__.py", line 1, in <module>
from .core import (
File "//anaconda/lib/python3.5/site-packages/pg/core.py", line 6, in <module>
from . import glfw
File "//anaconda/lib/python3.5/site-packages/pg/glfw.py", line 138, in <module>
['', '/usr/lib', '/usr/local/lib'], _glfw_get_version)
File "//anaconda/lib/python3.5/site-packages/pg/glfw.py", line 74, in _load_library
version = version_check_callback(filename)
File "//anaconda/lib/python3.5/site-packages/pg/glfw.py", line 130, in _glfw_get_version
out = process.communicate(_to_char_p(filename))[0]
File "//anaconda/lib/python3.5/subprocess.py", line 801, in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
File "//anaconda/lib/python3.5/subprocess.py", line 1428, in _communicate
self._save_input(input)
File "//anaconda/lib/python3.5/subprocess.py", line 1501, in _save_input
self._input = self._input.encode(self.stdin.encoding)
AttributeError: 'bytes' object has no attribute 'encode'
What can I do to fix this and get PyGreSQL working?
Related
This is the error I get
Traceback (most recent call last):
File "/opt/anaconda3/bin/spyder", line 11, in
sys.exit(main())
File "/opt/anaconda3/lib/python3.9/site-packages/spyder/app/start.py", line 233, in main
from spyder.app import mainwindow
File "/opt/anaconda3/lib/python3.9/site-packages/spyder/app/mainwindow.py", line 42, in
requirements.check_qt()
File "/opt/anaconda3/lib/python3.9/site-packages/spyder/requirements.py", line 47, in check_qt
if parse_version(actual_ver) File "/opt/anaconda3/lib/python3.9/site-packages/pkg_resources/__init__.py", line 121, in parse_version
return packaging.version.Version(v)
File "/opt/anaconda3/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/version.py", line 264, in __init__
match = self._regex.search(version)
TypeError: expected string or bytes-like object
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 ☹️☹️☹️☹️☹️☹️
Can someone help me resolve the following error message when trying to import the pmdarima.arima library for Python?
ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.
Traceback (most recent call last):
File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 3326, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-1-6858fadc5169>", line 1, in <module>
from pmdarima.arima import auto_arima
File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/pmdarima/__init__.py", line 45, in <module>
from .arima import auto_arima, ARIMA, AutoARIMA
File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/pmdarima/arima/__init__.py", line 6, in <module>
from .arima import *
File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/pmdarima/arima/arima.py", line 10, in <module>
from sklearn.metrics import mean_absolute_error, mean_squared_error
File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/sklearn/metrics/__init__.py", line 7, in <module>
from .ranking import auc
File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/sklearn/metrics/ranking.py", line 35, in <module>
from ..preprocessing import label_binarize
File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/sklearn/preprocessing/__init__.py", line 6, in <module>
from ._function_transformer import FunctionTransformer
File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/sklearn/preprocessing/_function_transformer.py", line 5, in <module>
from ..utils.testing import assert_allclose_dense_sparse
File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/sklearn/utils/testing.py", line 718, in <module>
import pytest
File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/pytest.py", line 13, in <module>
from _pytest.fixtures import fixture, yield_fixture
File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/_pytest/fixtures.py", line 842, in <module>
class FixtureFunctionMarker(object):
File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/_pytest/fixtures.py", line 844, in FixtureFunctionMarker
params = attr.ib(convert=attr.converters.optional(tuple))
TypeError: attrib() got an unexpected keyword argument 'convert'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2040, in showtraceback
stb = value._render_traceback_()
AttributeError: 'TypeError' object has no attribute '_render_traceback_'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/IPython/core/ultratb.py", line 1101, in get_records
return _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)
File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/IPython/core/ultratb.py", line 319, in wrapped
return f(*args, **kwargs)
File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/IPython/core/ultratb.py", line 353, in _fixed_getinnerframes
records = fix_frame_records_filenames(inspect.getinnerframes(etb, context))
File "/Users/jdoe/anaconda3/lib/python3.6/inspect.py", line 1490, in getinnerframes
frameinfo = (tb.tb_frame,) + getframeinfo(tb, context)
File "/Users/jdoe/anaconda3/lib/python3.6/inspect.py", line 1448, in getframeinfo
filename = getsourcefile(frame) or getfile(frame)
File "/Users/jdoe/anaconda3/lib/python3.6/inspect.py", line 696, in getsourcefile
if getattr(getmodule(object, filename), '__loader__', None) is not None:
File "/Users/jdoe/anaconda3/lib/python3.6/inspect.py", line 733, in getmodule
if ismodule(module) and hasattr(module, '__file__'):
File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/py/_vendored_packages/apipkg.py", line 195, in __getattribute__
return getattr(getmod(), name)
File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/py/_vendored_packages/apipkg.py", line 179, in getmod
x = importobj(modpath, None)
File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/py/_vendored_packages/apipkg.py", line 69, in importobj
module = __import__(modpath, None, None, ['__doc__'])
File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/pytest.py", line 13, in <module>
from _pytest.fixtures import fixture, yield_fixture
File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/_pytest/fixtures.py", line 842, in <module>
class FixtureFunctionMarker(object):
File "/Users/jdoe/anaconda3/lib/python3.6/site-packages/_pytest/fixtures.py", line 844, in FixtureFunctionMarker
params = attr.ib(convert=attr.converters.optional(tuple))
TypeError: attrib() got an unexpected keyword argument 'convert'
I searched up the type error that appears at the end, which led me to a related StackOverflow question whose answer suggested an outdated version of pytest would cause issues. I've since upgraded my version of pytest which resolved my issue.
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
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?