Sorry for the second post , but I wanted to include the errors I'm getting.
"import matplotlib" works.
get_backend() retuns "TkAgg"( change made in RC file)
but "import matplotlib.pyplot as plt returns:
Python 3.4.2 (default, Oct 19 2014, 13:31:11)
[GCC 4.9.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
import matplotlib.pyplot as plt
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.4/dist-packages/matplotlib-1.5.0-py3.4-linux-armv7l.egg/matplotlib/pyplot.py", line 114, in
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/usr/local/lib/python3.4/dist-packages/matplotlib-1.5.0-py3.4-linux-armv7l.egg/matplotlib/backends/init.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "/usr/local/lib/python3.4/dist-packages/matplotlib-1.5.0-py3.4-linux-armv7l.egg/matplotlib/backends/backend_tkagg.py", line 13, in
import matplotlib.backends.tkagg as tkagg
File "/usr/local/lib/python3.4/dist-packages/matplotlib-1.5.0-py3.4-linux-armv7l.egg/matplotlib/backends/tkagg.py", line 9, in
from matplotlib.backends import _tkagg
ImportError: cannot import name '_tkagg'
Related
python3.9.x
python3
Python 3.9.2 (default, Mar 12 2021, 04:06:34)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>> import pandas
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pi/.local/lib/python3.9/site-packages/pandas/__init__.py", line 22, in <module>
from pandas.compat import (
File "/home/pi/.local/lib/python3.9/site-packages/pandas/compat/__init__.py", line 15, in <module>
from pandas.compat.numpy import (
File "/home/pi/.local/lib/python3.9/site-packages/pandas/compat/numpy/__init__.py", line 7, in <module>
from pandas.util.version import Version
File "/home/pi/.local/lib/python3.9/site-packages/pandas/util/__init__.py", line 1, in <module>
from pandas.util._decorators import ( # noqa
File "/home/pi/.local/lib/python3.9/site-packages/pandas/util/_decorators.py", line 14, in <module>
from pandas._libs.properties import cache_readonly # noqa
File "/home/pi/.local/lib/python3.9/site-packages/pandas/_libs/__init__.py", line 13, in <module>
from pandas._libs.interval import Interval
File "pandas/_libs/interval.pyx", line 1, in init pandas._libs.interval
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 48 from C header, got 40 from PyObject
the when I update numpy it said that it needs verson 3.9 ++
For the Python version you are using pandas is officially not supported. I would advise to uninstall 3.9 and install 3.7.
Before update or installing the new packages/libraries, always make sure that it is compatible with whatever version you are using.
I am using pyrogram in a program but when i run the program it gives import error
i uninstalled and reinstalled it but the problem is still there.
I am not able to fix it i have tried the previous version as well as the new version but the problem is the same.
Here is the output:
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyrogram
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/__init__.py", line 40, in <module>
from . import raw, types, filters, handlers, emoji
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/types/__init__.py", line 22, in <module>
from .input_media import *
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/types/input_media/__init__.py", line 25, in <module>
from .input_phone_contact import InputPhoneContact
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/types/input_media/input_phone_contact.py", line 20, in <module>
from pyrogram.session.internals import MsgId
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/session/__init__.py", line 19, in <module>
from .auth import Auth
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/session/auth.py", line 29, in <module>
from pyrogram.crypto import aes, rsa, prime
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/crypto/prime.py", line 19, in <module>
from random import randint
File "/home/ak/Desktop/development/bots/pyrogramplugins/multiuserbot/final/random.py", line 1, in <module>
from pyrogram import Client, filters, idle
File "/home/ak/.local/lib/python3.9/site-packages/pyrogram/filters.py", line 24, in <module>
from pyrogram.types import Message, CallbackQuery, InlineQuery, InlineKeyboardMarkup, ReplyKeyboardMarkup, Update
ImportError: cannot import name 'Message' from partially initialized module 'pyrogram.types' (most likely due to a circular import) (/home/ak/.local/lib/python3.9/site-packages/pyrogram/types/__init__.py)
>>>
I am stuck here i have tried everything i know but not able to fix it
It is because the file name is same as the module name which I am using in code.
Change the file name and never give file a name which is the name of a module
Spark version 2.4.5, python version 3.8.2
Got the below error:
VirtualBox:~/spark-2.4.5-bin-hadoop2.7/python$ python3
Python 3.8.2 (default, Apr 27 2020, 15:53:34)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyspark
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/prasanth/spark-2.4.5-bin-hadoop2.7/python/pyspark/__init__.py", line 51, in <module>
from pyspark.context import SparkContext
File "/home/prasanth/spark-2.4.5-bin-hadoop2.7/python/pyspark/context.py", line 31, in <module>
from pyspark import accumulators
File "/home/prasanth/spark-2.4.5-bin-hadoop2.7/python/pyspark/accumulators.py", line 97, in <module>
from pyspark.serializers import read_int, PickleSerializer
File "/home/prasanth/spark-2.4.5-bin-hadoop2.7/python/pyspark/serializers.py", line 72, in <module>
from pyspark import cloudpickle
File "/home/prasanth/spark-2.4.5-bin-hadoop2.7/python/pyspark/cloudpickle.py", line 145, in <module>
_cell_set_template_code = _make_cell_set_template_code()
File "/home/prasanth/spark-2.4.5-bin-hadoop2.7/python/pyspark/cloudpickle.py", line 126, in _make_cell_set_template_code
return types.CodeType(
TypeError: an integer is required (got type bytes)
This issue happens because of spark doesn't compatible with python 3.8.x! please use python3.7. you can do it with this command:
PYSPARK_PYTHON=python3.7 pyspark
I am getting the below error while installing python 3 in SUSE SLES 12SP3, how do i get rid(skip) of the import readline error, I am i missing some step
:/tmp/Python-3.6.4> ./configure
./configure --prefix=/usr/local
make altinstall
: /usr/local/lib64> sudo ln -s /usr/local/lib/python3.6/lib-dynload/
/usr/local/lib> python3
Python 3.6.3 (default, Jan 8 2018, 10:26:56)
[GCC 4.8.5] on linux
Type "help", "copyright", "credits" or "license" for more information.
Failed calling sys.__interactivehook__
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site.py", line 387, in register_readline
import readline
File "/usr/local/lib/python3.6/site-packages/readline.py", line 6, in <module>
from pyreadline.rlmain import Readline
File "/usr/local/lib/python3.6/site-packages/pyreadline/__init__.py", line 12, in <module>
from . import logger, clipboard, lineeditor, modes, console
File "/usr/local/lib/python3.6/site-packages/pyreadline/clipboard/__init__.py", line 13, in <module>
from .win32_clipboard import GetClipboardText, SetClipboardText
File "/usr/local/lib/python3.6/site-packages/pyreadline/clipboard/win32_clipboard.py", line 37, in <module>
import ctypes.wintypes as wintypes
File "/usr/local/lib/python3.6/ctypes/wintypes.py", line 20, in <module>
class VARIANT_BOOL(ctypes._SimpleCData):
ValueError: _type_ 'v' not supported
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 23 2015, 02:52:03)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import sklearn
sklearn.__version__
'0.16.1'
from sklearn.neighbors import NearestNeighbors
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/sklearn/neighbors/__init__.py", line 9, in <module>
from .graph import kneighbors_graph, radius_neighbors_graph File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/sklearn/neighbors/graph.py", line 9, in <module>
from .base import KNeighborsMixin, RadiusNeighborsMixin File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/sklearn/neighbors/base.py", line 18, in <module>
from ..metrics import pairwise_distances File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/sklearn/metrics/__init__.py", line 15, in <module>
from .classification import accuracy_score File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/sklearn/metrics/classification.py", line 31, in <module>
from ..preprocessing import LabelBinarizer, label_binarize File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/sklearn/preprocessing/__init__.py", line 25, in <module>
from ._weights import balance_weights ImportError: cannot import name 'balance_weights'