python seaborn lib throwing error on import - python

I am loading missingno lib on python as provided below.
while loading , it throws error at seaborn/rcmod.py.
following are the versions,-
missingno-0.3.8
numpy-1.9.0
matplotlib-1.5.0
seaborn==0.8.1
Python 2.6.6 (r266:84292, Jul 23 2015, 05:13:40)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import missingno as mn
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/site-packages/missingno/__init__.py", line 1, in
<module>
from .missingno import matrix
File "/usr/lib/python2.6/site-packages/missingno/missingno.py", line 6, in
<module>
import seaborn as sns
File "/usr/lib/python2.6/site-packages/seaborn/__init__.py", line 6, in
<module>
from .rcmod import *
File "/usr/lib/python2.6/site-packages/seaborn/rcmod.py", line 161
style_dict = {k: mpl.rcParams[k] for k in _style_keys}
^
SyntaxError: invalid syntax

seaborn doesn't support Python 2.6: https://github.com/mwaskom/seaborn/blob/88c49ef6c14ca69def8195f03d467915b3b0597c/setup.py#L82
You need to update your Python to at least Python 2.7 to use seaborn.

Related

ImportError: cannot import name '_has_torch_function' from 'torch._C'

When I import torch, I get the following error:
I dont know if it has something to do with the fact i just install cuda11.6.
I tried to unintalled and install pytorch , it didn't work.
Python 3.7.12 | packaged by conda-forge | (default, Oct 26 2021, 06:08:21)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/zengyunzi1/.conda/envs/yz/lib/python3.7/site-packages/torch/__init__.py", line 603, in <module>
from ._tensor import Tensor
File "/home/zengyunzi1/.conda/envs/yz/lib/python3.7/site-packages/torch/_tensor.py", line 15, in <module>
from torch.overrides import (
File "/home/zengyunzi1/.conda/envs/yz/lib/python3.7/site-packages/torch/overrides.py", line 33, in <module>
from torch._C import (
ImportError: cannot import name '_has_torch_function' from 'torch._C' (/home/zengyunzi1/.conda/envs/yz/lib/python3.7/site-packages/torch/_C.cpython-37m-x86_64-linux-gnu.so)
>>>

Can import elements from tensorflow.python.keras, but not the module as a whole

How does the following python session make sense?
(ctlearn) jsevillamol#jsevillamol-N551JK:~/Documentos/ctlearn_keras$ python
Python 3.6.5 | packaged by conda-forge | (default, Apr 6 2018, 13:39:56)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-15)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from tensorflow.python.keras.models import Model
>>> import tensorflow.python.keras as K
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'tensorflow' has no attribute 'python'
I can import tensorflow.python.keras.models, but not import tensorflow.python.keras.
What. I don't even.

Macports Installed Python 2.7 Inccorectly Imports Python 3.5 Numpy

I have a macports installed python however, whenever I try to import numpy after launching python I get the following error message:
Python 2.7.11 (default, Mar 1 2016, 18:40:10)
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
import numpy
Traceback (most recent call last):
File "", line 1, in
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/numpy/init.py", line 180, in
from . import add_newdocs
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/numpy/add_newdocs.py", line 13, in
from numpy.lib import add_newdoc
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/numpy/lib/init.py", line 8, in
from .type_check import *
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/numpy/lib/type_check.py", line 11, in
import numpy.core.numeric as _nx
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/numpy/core/init.py", line 14, in
from . import multiarray
ImportError: cannot import name multiarray
I should also add that I have py27-numpy installed.. however python27 always seems to look for py35-numpy.

Python ImportError: cannot import name itemgetter

Python 2.7.5 (default, Sep 12 2013, 12:43:04)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/urllib.py", line 33, in <module>
from urlparse import urljoin as basejoin
File "/usr/local/lib/python2.7/urlparse.py", line 118, in <module>
from collections import namedtuple
File "/usr/local/lib/python2.7/collections.py", line 9, in <module>
from operator import itemgetter as _itemgetter, eq as _eq
ImportError: cannot import name itemgetter
This issue occurs when I run import urllib. Python version is 2.7. Is this a Python's version problem? Could someone tell me how to fix it?
You have a file called operator.py in the current directory, so import operator is picking up your module and not the Python standard library module operator.
You should rename your file to not conflict with Python's standard library.

Python xml parsing problem

could you please explain me the error below, and give me a workaround?
Thanks in advance!
Python 2.4.3 (#1, Apr 14 2011, 20:41:59)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from xml.sax import make_parser
>>> p = make_parser()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib64/python2.4/site-packages/_xmlplus/sax/sax2exts.py", line 37, in make_parser
return XMLParserFactory.make_parser(parser_list)
File "/usr/lib64/python2.4/site-packages/_xmlplus/sax/saxexts.py", line 75, in make_parser
sys.modules[parser_name].create_parser = _create_parser
KeyError: 'xml.sax.drivers2.drv_pyexpat'
>>>
Problem seems to be with your python version and python library.
Have a look here

Categories