ImportError: cannot import name 'animation' from partially initialized module 'matplotlib' - matplotlib

I'm facing the following erro:
ImportError Traceback (most recent call last)
<ipython-input-1-0484cd13f94d> in <module>
----> 1 import matplotlib
~\Anaconda3\lib\site-packages\matplotlib\__init__.py in <module>
105 # cbook must import matplotlib only within function
106 # definitions, so it is safe to import from it here.
--> 107 from . import cbook, rcsetup
108 from matplotlib.cbook import MatplotlibDeprecationWarning, sanitize_sequence
109 from matplotlib.cbook import mplDeprecation # deprecated
~\Anaconda3\lib\site-packages\matplotlib\rcsetup.py in <module>
24 import numpy as np
25
---> 26 from matplotlib import animation, cbook
27 from matplotlib.cbook import ls_mapper
28 from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
ImportError: cannot import name 'animation' from partially initialized module 'matplotlib'
I've removed matplotlib and then reinstalled it. I've also tried to use pip install matplotlib --force-reinstall --user command, but the error persists. The most curious is that matplotlib runs properly when I run Python in Windows Prompt Command, but not in Jupyter or Spider. I cant use admin privileges. Im running python 3.8.5 and matplotlib 3.4.2.

Related

Dropbox ModuleNotFoundError: No module named 'stone'

Im trying to import Dropbox with the line:
import dropbox
on Google Colab but im getting the following error:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-26-fac67f6fa745> in <module>()
28 import math
29 import io
---> 30 import dropbox
31 from keras.models import Sequential
32 from keras.layers import Dense
2 frames
/usr/local/lib/python3.6/dist-packages/dropbox/auth.py in <module>()
5 # pylint: skip-file
6 from __future__ import unicode_literals
----> 7 from stone.backends.python_rsrc import stone_base as bb
8 from stone.backends.python_rsrc import stone_validators as bv
9
ModuleNotFoundError: No module named 'stone'
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------
It was working perfectly normal a day ago
The problem is that a new release of Dropbox API was out today and it has that glitch. Just used the version before today by using
pip install dropbox==10.10.0

pip install PyRQA in Google colab

Hope someone can help me, when I try to install and run PyRQA in colab in the GPU runtime and after run the next code:
pip install PyRQA
from pyrqa.time_series import TimeSeries
from pyrqa.settings import Settings
from pyrqa.analysis_type import Classic
from pyrqa.neighbourhood import FixedRadius
from pyrqa.metric import EuclideanMetric
from pyrqa.computation import RQAComputation
from pyrqa.computation import RPComputation
from pyrqa.image_generator import ImageGenerator
give me the next error.
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-6c56a517e983> in <module>()
4 from pyrqa.neighbourhood import FixedRadius
5 from pyrqa.metric import EuclideanMetric
----> 6 from pyrqa.computation import RQAComputation
7 from pyrqa.computation import RPComputation
8 from pyrqa.image_generator import ImageGenerator
6 frames
/usr/local/lib/python3.6/dist-packages/pyopencl/tools.py in <module>()
35 from decorator import decorator
36 from pytools import memoize, memoize_method
---> 37 from pyopencl._cl import bitlog2 # noqa: F401
38 from pytools.persistent_dict import KeyBuilder as KeyBuilderBase
39
ImportError: /usr/lib64-nvidia/libOpenCL.so.1: version `OPENCL_2.1' not found (required by /usr/local/lib/python3.6/dist-packages/pyopencl/_cl.cpython-36m-x86_64-linux-gnu.so)
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------
Some days ago it works fine, but after yesterday it doesn't work anymore

matplotlib, conda and cycler

I just installed Anaconda 4.3.23 with Python 3 64 bit. I created virtual environment and installed conda install matplotlib. When I execute import matplotlib.pyplot as plt I get back the following error:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-3-2d703b067d13> in <module>()
2 import numpy as np
3 import tensorflow as tf
----> 4 import matplotlib.pyplot as plt
~\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\matplotlib\__init__.py in <module>()
122 from matplotlib.cbook import is_string_like, mplDeprecation, dedent, get_label
123 from matplotlib.compat import subprocess
--> 124 from matplotlib.rcsetup import (defaultParams,
125 validate_backend,
126 cycler)
~\AppData\Local\conda\conda\envs\tensorflow\lib\site-packages\matplotlib\rcsetup.py in <module>()
35
36 # Don't let the original cycler collide with our validating cycler
---> 37 from cycler import Cycler, cycler as ccycler
38
39 # interactive_bk = ['gtk', 'gtkagg', 'gtkcairo', 'qt4agg',
ImportError: No module named 'cycler'
I tried running conda install cycler, but got back:
# All requested packages already installed.
# packages in environment at C:\Users\test\AppData\Local\conda\conda\envs\tensorflow:
#
cycler 0.10.0 py35_0 conda-forge
I ran all above under newly created virtual environment tensorflow. Any thoughts?

Timedelta error; version 0.15.1-=np19py27_0

This problem was asked at:
pandas Timedelta error
However, the solution (to get the latest version of pandas) did not work for me.
I've got the same problem (installed using anaconda, on Windows 7), and trying to do this gets the same problem.
Running from ipython:
In [1]: import pandas as pd
-----------------------------------------
ImportError
<ipython-input-1-af55e7023913> in <module
----> 1 import pandas as pd
C:\Anaconda\lib\site-packages\pandas\__in
45
46 # let init-time option registrati
---> 47 import pandas.core.config_init
48
49 from pandas.core.api import *
C:\Anaconda\lib\site-packages\pandas\core
15 i
16 g
---> 17 from pandas.core.format import de
18
19
C:\Anaconda\lib\site-packages\pandas\core
7 from pandas.core.base import Pand
8 from pandas.core.common import ad
----> 9 from pandas.core.index import Ind
10 from pandas import compat
11 from pandas.compat import(StringI
C:\Anaconda\lib\site-packages\pandas\core
13 import pandas.algos as _algos
14 import pandas.index as _index
---> 15 from pandas.lib import Timestamp,
16 from pandas.core.base import Pand
17 from pandas.util.decorators impor
ImportError: cannot import name Timedelta
I've checked the pandas version, it is 0.15.1-np19py27_0.
nosetests pandas also returns problems:
PS R:\data\python_testing\ipython_notebooks> nosetests pandas
E
======================================================================
ERROR: Failure: ImportError (cannot import name Timedelta)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Anaconda\lib\site-packages\nose\loader.py", line 403, in loadTestsFromName
module = resolve_name(addr.module)
File "C:\Anaconda\lib\site-packages\nose\util.py", line 311, in resolve_name
module = __import__('.'.join(parts_copy))
File "C:\Anaconda\lib\site-packages\pandas\__init__.py", line 47, in <module>
import pandas.core.config_init
File "C:\Anaconda\lib\site-packages\pandas\core\config_init.py", line 17, in <module>
from pandas.core.format import detect_console_encoding
File "C:\Anaconda\lib\site-packages\pandas\core\format.py", line 9, in <module>
from pandas.core.index import Index, MultiIndex, _ensure_index
File "C:\Anaconda\lib\site-packages\pandas\core\index.py", line 15, in <module>
from pandas.lib import Timestamp, Timedelta, is_datetime_array
ImportError: cannot import name Timedelta
----------------------------------------------------------------------
Ran 1 test in 0.000s
FAILED (errors=1)
This issue is discussed at github:
https://github.com/pydata/pandas/issues/8862
I had this problem recently, and it turned out to be because I had recently used conda to install some packages from the command prompt, but had forgetten to launch the command prompt as administrator.
In my case I was able to fix the problem by launching command prompt as administrator, and reinstalling the packages concerned with "conda install -f ".
In your case you could try "conda install -f pandas".
It is possible you might have this problem with more than one package.
i'm pretty sure this issue occurs on Windows due to file open issues. Because a process is holding the file handler to one of the packages files the upgrade fails. Kill all Python and Excel processes and try again.

Problems importing numpy into IPython notebook

Having some errors when attempting to run import numpy as np inside the IPython notebook environment. I assume that the Enthought Canopy package is borked, any tips would be much appreciated!
ImportError Traceback (most recent call last)
<ipython-input-2-140a5caba752> in <module>()
----> 1 import numpy as np
2 import scipy
3 import matplotlib as mpl
/Users/iMacHome/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/__init__.pyc in <module>()
141 return loader(*packages, **options)
142
--> 143 import add_newdocs
144 __all__ = ['add_newdocs']
145
/Users/iMacHome/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/add_newdocs.py in <module>()
7 # core/fromnumeric.py, core/defmatrix.py up-to-date.
8
----> 9 from numpy.lib import add_newdoc
10
11 ###############################################################################
Reset your Canopy Python User environment by deleting /Users/iMacHome/Library/Enthought/, and restarting the Canopy GUI (to re-initialize the environment), then try again. If that doesn't do it, consider the possibility that you are cross-linking with another Python installation. To test this, what is your sys.prefix and sys.path in ipython?