The issue is in the title:
ImportError: cannot import name 'styles' from 'matplotlib'
I have tried the recommended answers, I have used
sudo pip install --upgrade matplotlib
and
pip install --user --upgrade matplotlib
and still have the same error as before.
Code:
import tkinter as tk
from tkinter import ttk
import matplotlib
from matplotlib import styles
LARGE_FONT = ("Verdana", 12)
error:
ImportError: cannot import name 'styles' from 'matplotlib'
(/Users/myname/opt/anaconda3/lib/python3.7/site-packages/matplotlib/__init__.py)
I have tried this with a few python versions in vs code (3.6.6, 3.7.6, 3.8.1) and Anaconda Spyder (which I believe is 3.7.x but I'm not sure which) and get the same error.
Any ideas or is Matplotlib styles not useable anymore?
Do you mean 'style' instead of 'styles'?
from matplotlib import style
Related
I get this error importing in a Python virtual environment,
import plotly.offline
ModuleNotFoundError: No module named 'plotly.offline'
I installed plotly using pip install plotly. Tried to uninstall and reinstall. But still same eror. I'm using Python3 in the venv. I can import plotly with import plotly but none of its modules I can't.
But when I tried a global install (not using a venv) I am able to import plotly.offline.
I have matplotlib-2.2.3 installed. When I used matplotlib in jupyter, it throws the following error:
ImportError: cannot import name cbook in jupyter
All is OK when I run the code in PyCharm. I used python 2.7 and I have tried many suggestions like that in ImportError: cannot import name cbook but none worked.
I finally found the solution that downgrade the matplotlib and six, and that solves my question.
pip install six==1.10.0
pip install matplotlib==2.0.2
My imports :
from pydub import AudioSegment
import matplotlib.pyplot as plt
import numpy as np
import wave
import sys
why am i getting that error while i'm clearly not importing tkinter and how to fix it
One of your imported packages requires tkinter as a dependency, so you need to install it.
# if you are using Anaconda
conda install tk
# if you are using Ubuntu
sudo apt-get install python3-tk
I wrote a program in python 3.6.2(32 bit) in Windows, and imported the following libraries.
from tkinter import font
from fontTools.ttLib import TTFont
from tkinter import messagebox
import tkinter.font as font
from tkinter.ttk import Separator, Style
from tkinter.filedialog import *
import tkinter as tkfont
When I run the code, I get this error:
No module named 'fontTools'
When I install the module via this command:
pip install fontTools
I get the following error:
Could not find a version that satisfies the requirement fontTools (from versions: )
No matching distribution found for fontTools
How can I fix this?
As the documentation states:
pip install fonttools
It's all lowercase.
You can use following command as below:
pip install --user fonttools
when I import charts
I get a lots of error
how to solve it?thanks
import charts
erroe image likes here
ModuleNotFoundError: No module named 'scipy'# i import scipy but still error
Looks like scipy is not installed
Try to install it using your terminal:
pip install scipy