I'm trying to install Scipy through pip, but it won't work. It says that it already is installed, but when I try to import the modules it gives me errors.
from matplotlib import pyplot as plt
Error:
Traceback (most recent call last):
File "C:\Users\TimGF\Documents\Coding\Python\numpy.py", line 1, in <module>
from matplotlib import pyplot as plt
File "C:\Python36\lib\site-packages\matplotlib\__init__.py", line 127, in <module>
from . import cbook
File "C:\Python36\lib\site-packages\matplotlib\cbook\__init__.py", line 35, in <module>
import numpy as np
File "C:\Users\TimGF\Documents\Coding\Python\numpy.py", line 1, in <module>
from matplotlib import pyplot as plt
File "C:\Python36\lib\site-packages\matplotlib\pyplot.py", line 31, in <module>
import matplotlib.colorbar
File "C:\Python36\lib\site-packages\matplotlib\colorbar.py", line 32, in <module>
import matplotlib.artist as martist
File "C:\Python36\lib\site-packages\matplotlib\artist.py", line 15, in <module>
from . import cbook, docstring, rcParams
ImportError: cannot import name 'rcParams'
EDIT: It turned out, that the problem was, that I called my file "matplotlib.py".
Turned out that I was super stupid, and I just had to rename the python file to something else than "matplotlib.py" since it confused the script.
Related
I am using pycharm for Python in Windows 10.
I have installed the package matplotlib.
I am using python 3.6 when i do import matplotlib there is no error.
However if i do matplotlib.pyplot as plt i am getting this following errors:
Traceback (most recent call last):
File "D:/Year4/เจคจบ/Project/ex/Image_manipulation_detection-master/demo_two_stream.py", line 9, in <module>
import matplotlib.pyplot as plt
File "C:\Users\Acer\AppData\Local\Programs\Python\Python36\lib\site-packages\matplotlib\__init__.py", line 110, in <module>
from matplotlib.rcsetup import validate_backend, cycler
File "C:\Users\Acer\AppData\Local\Programs\Python\Python36\lib\site-packages\matplotlib\rcsetup.py", line 28, in <module>
from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
File "C:\Users\Acer\AppData\Local\Programs\Python\Python36\lib\site-packages\matplotlib\fontconfig_pattern.py", line 15, in <module>
from pyparsing import (Literal, ZeroOrMore, Optional, Regex, StringEnd,
File "C:\Users\Acer\AppData\Local\Programs\Python\Python36\lib\site-packages\pyparsing\__init__.py", line 130, in <module>
__version__ = __version_info__.__version__
AttributeError: 'version_info' object has no attribute '__version__'
I'm trying to run my Python program and these are the modules I'm importing:
from tkinter import *
from functools import partial
import numpy as np import
matplotlib matplotlib.use("TkAgg")
from matplotlib.figure import Figure
from matplotlib.backends.backend_tkagg
import FigureCanvasTkAgg, NavigationToolbar2Tk
I always end up with the following error message:
C:\Users\HP\anaconda3\lib\site-packages\numpy\__init__.py:138: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
from . import _distributor_init
Traceback (most recent call last):
File "ASRS.py", line 12, in <module>
from matplotlib.figure import Figure
File "C:\Users\HP\AppData\Roaming\Python\Python38\site-packages\matplotlib\figure.py", line 18, in <module>
from matplotlib import docstring, projections
File "C:\Users\HP\AppData\Roaming\Python\Python38\site-packages\matplotlib\projections\__init__.py", line 1, in <module>
from .. import axes, docstring
File "C:\Users\HP\AppData\Roaming\Python\Python38\site-packages\matplotlib\axes\__init__.py", line 1, in <module>
from ._subplots import *
File "C:\Users\HP\AppData\Roaming\Python\Python38\site-packages\matplotlib\axes\_subplots.py", line 6, in <module>
from matplotlib.axes._axes import Axes
File "C:\Users\HP\AppData\Roaming\Python\Python38\site-packages\matplotlib\axes\_axes.py", line 14, in <module>
import matplotlib.contour as mcontour
File "C:\Users\HP\AppData\Roaming\Python\Python38\site-packages\matplotlib\contour.py", line 17, in <module>
import matplotlib.text as text
File "C:\Users\HP\AppData\Roaming\Python\Python38\site-packages\matplotlib\text.py", line 16, in <module>
from .textpath import TextPath # Unused, but imported by others.
File "C:\Users\HP\AppData\Roaming\Python\Python38\site-packages\matplotlib\textpath.py", line 11, in <module>
from matplotlib.mathtext import MathTextParser
File "C:\Users\HP\AppData\Roaming\Python\Python38\site-packages\matplotlib\mathtext.py", line 27, in <module>
from PIL import Image
File "C:\Users\HP\anaconda3\lib\site-packages\PIL\Image.py", line 94, in <module>
from . import _imaging as core
**ImportError: DLL load failed while importing _imaging: Belirtilen modül bulunamadı.**
How can I fix this?
Simply upgrading the package "Pillow" (using the Anaconda environment) worked for me to resolve this issue.
pip install --upgrade Pillow
I have those errors when i'm trying to import the matplotlib.
How can i fix this?
I have install matplotlib with the pip install matplotlib and this was a succes.
But when i import the package i have this kind of error.
i see it is in the init block but how can i fix this?
i have already tried the pip matplotlib upgrade but this keeps the same problem.
i just have matplotlib uninstalled and back installed and it is the same problem.
My code:
import matplotlib.pyplot as plt
Error:
Traceback (most recent call last):
File "C:\Python27\TEST.py", line 1, in <module>
import matplotlib.pyplot as plt
File "C:\Python27\lib\site-packages\matplotlib\pyplot.py", line 26, in <module>
from matplotlib.figure import Figure, figaspect
File "C:\Python27\lib\site-packages\matplotlib\figure.py", line 24, in <module>
import matplotlib.artist as martist
File "C:\Python27\lib\site-packages\matplotlib\artist.py", line 7, in <module>
from transforms import Bbox, IdentityTransform, TransformedBbox, \
File "C:\Python27\lib\site-packages\matplotlib\transforms.py", line 35, in <module>
from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,
ImportError: DLL load failed: %1 is geen geldige Win32-toepassing
I have tried another code, that I found in the comments. But this generate my another error code.
Code :
import matplotlib as mpl
mpl.use('TkAgg')
import matplotlib.pyplot as plt
Error:
Traceback (most recent call last):
File "C:\Python27\TEST.py", line 1, in <module>
import matplotlib as mpl
File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 1097, in <module>
rcParams = rc_params()
File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 933, in rc_params
fname = matplotlib_fname()
File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 781, in matplotlib_fname
for fname in gen_candidates():
File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 770, in gen_candidates
yield os.path.join(six.moves.getcwd(), 'matplotlibrc')
AttributeError: '_MovedItems' object has no attribute 'getcwd'
Error
Little test program
A "p" seems to be missing from "pyplot". You have pylot instead of pyplot in the import statement.
Have installed win 10 on my macbook for working with different plot libraries in python 3.4. I began vs Tkinter, but it is boring, so I followed some forums-speakers and tried matplotlib. I installed it using pip3 and get next error:
Traceback (most recent call last):
File "C:/Users/Gleb/PycharmProjects/_testing_plot_libraries_/matplotlib_trying.py", line 1, in <module>
import matplotlib.pyplot as plt
File "C:\Python34\lib\site-packages\matplotlib\__init__.py", line 124, in <module>
from matplotlib.rcsetup import (defaultParams,
File "C:\Python34\lib\site-packages\matplotlib\rcsetup.py", line 30, in <module>
from matplotlib.fontconfig_pattern import parse_fontconfig_pattern
File "C:\Python34\lib\site-packages\matplotlib\fontconfig_pattern.py", line 25, in <module>
from pyparsing import Literal, ZeroOrMore, \
File "C:\Python34\lib\site-packages\pyparsing.py", line 2, in <module>
import matplotlib.pyplot as plt
File "C:\Python34\lib\site-packages\matplotlib\pyplot.py", line 29, in <module>
import matplotlib.colorbar
File "C:\Python34\lib\site-packages\matplotlib\colorbar.py", line 32, in <module>
import matplotlib.artist as martist
File "C:\Python34\lib\site-packages\matplotlib\artist.py", line 13, in <module>
from matplotlib import docstring, rcParams
ImportError: cannot import name 'rcParams'
in simple task:
import matplotlib.pyplot as plt
plt.plot([1,2,3])
plt.ylabel('some numbers')
plt.show()
what should I do to make it work?
can you give me some advises in plot libraries for science? Im looking for more 2D than 3D plotting libraries.
The problem is likely a configuration issue, because getting the installation correct on Macs seems to be tricky. I'm running Mavericks and matplotlib 1.4.x, yet when I open a Python 2.7.5 shell and import pylib, I get this error:
>>> import pylab
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/pylab.py", line 230, in <module>
import matplotlib.finance
File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/finance.py", line 38, in <module>
from matplotlib.collections import LineCollection, PolyCollection
File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/collections.py", line 27, in <module>
import matplotlib.backend_bases as backend_bases
File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/backend_bases.py", line 55, in <module>
import matplotlib.textpath as textpath
File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/textpath.py", line 22, in <module>
from matplotlib.mathtext import MathTextParser
File "/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/mathtext.py", line 64, in <module>
import matplotlib._png as _png
ImportError: dlopen(/Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/_png.so, 2): Library not loaded: /usr/local/lib/libpng15.15.dylib
Referenced from: /Library/Python/2.7/site-packages/matplotlib-1.4.x-py2.7-macosx-10.9-intel.egg/matplotlib/_png.so
Reason: image not found
I have libpng16 installed, but not libpng15.
I saw a hardcoded reference to libpng15 in _png.so.
Uninstall and install of matplotlib fixed the issue for me.
You can always moke it by generating a soft link like this
sudo ln -s /opt/X11/lib/libpng.dylib /usr/local/lib/libpng15.15.dylib
Not the cleaner solution but I haven't figure out why matplotlib stubbornly asks specifically for libpng15 and not any 15 or greater.