I have installed the latest version of Anaconda recently. When I am trying to import matplotlib.finance, I have a module does not exist error in spyder.
matplotlib and mpl-finance are installed already.
What should I do to resolve the issue?
I have the following problem with the following code in python 3.7
from matplotlib.finance import candlestick_ohlc
File "<ipython-input-1-7ea83a59eaf3>", line 1, in <module>
from matplotlib.finance import candlestick_ohlc
ModuleNotFoundError: No module named 'matplotlib.finance'
matplotlib.finance does not exist (anymore).
If you have installed mpl-finance, you need to import it as mpl_finance, e.g.
from mpl_finance import candlestick_ohlc
There is a now a new version of this module. Try this: https://pypi.org/project/mplfinance/
Related
I am trying to run a ML pipeline in Azure, I use pandarallel module but the pipeline fails with below error.
from pandarallel import pandarallel
File "/azureml-envs/azureml_76aa2eb12d27af119fdfef634eaaf565/lib/python3.6/site-packages/pandarallel/__init__.py", line 1, in <module>
from .core import pandarallel
File "/azureml-envs/azureml_76aa2eb12d27af119fdfef634eaaf565/lib/python3.6/site-packages/pandarallel/core.py", line 26, in <module>
from .progress_bars import ProgressBarsType, get_progress_bars, progress_wrapper
File "/azureml-envs/azureml_76aa2eb12d27af119fdfef634eaaf565/lib/python3.6/site-packages/pandarallel/progress_bars.py", line 8, in <module>
from time import time_ns
ImportError: cannot import name 'time_ns'
In the dependencies yml file, I hard coded pandarallel version from 1.3.2 to 1.6.4 but all versions fail with either time_ns error or ImportError: cannot import name 'PlasmaStoreFull' or ModuleNotFoundError: No module named 'ipywidgets'. Each version of pandarallel is giving such errors.
I am not using time_ns anywhere in my code. Could someone please let me know how to fix this issue.
The time_ns() method on Python is used to fetch the time in nanoseconds. It's not an issue; the underlying error is caused by the module "ipywidgets". The issue was caused by ipywidgets is not installed with IPython.
Please Install by using the below commands and re-run.
pip install ipywidgets
conda install ipywidgets
#Either command will resolve issue.
Here is the # Tutorial: Create production ML pipelines with Python SDK v2 in a Jupyter notebook
with reference of thread
try:
# Pyarrow version > 0.14
from pyarrow.plasma import PlasmaStoreFull as _PlasmaStoreFull
except ImportError:
# Pyarrow version <= 0.14
from pyarrow.lib import PlasmaStoreFull as _PlasmaStoreFull
see this bugfix
I was trying to create a plot of a map with matplotlib, and I tried to run this code:
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
map = Basemap()
plt.show()
but I get this error:
ModuleNotFoundError: No module named 'mpl_toolkits.basemap'
I have read many answers to similar problems, but none of them have worked for me.
(Python basemap module impossible to import, ModuleNotFoundError: No module named 'mpl_toolkits.basemap')
I am running Python 3.7 on macOS 10.15.5 using PyCharm
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
I am using Python 3.6.8 on Windows 10
I installed tensorflow, keras, and utils using pip.
pip install tensorflow and it installs the version 2.0.0
pip install keras and it installs the version 2.3.1
pip install utils but it does not show what version I have installed.
This is my header:
from keras.preprocessing import image
from PIL import Image
from keras.models import model_from_json, load_model
import numpy as np
import cv2
from datetime import datetime
import os
import random
import string
from utils.datasets import get_labels
from utils.inference import apply_offsets
from utils.inference import load_detection_model
from utils.preprocessor import preprocess_input
This is my error:
from utils.datasets import get_labels
ModuleNotFoundError: No module named 'utils.datasets'
Why am I getting this error? And how to fix it? BTW The code was written by a previous programmer and I need to modify it. But I can't even run it. not so good in python tho. i'm just getting started to it.
All my google search are all purple but I can't seem to find any solutions.
EDIT
The suggested answer (ImportError: No module named datasets) does not satisfy my needs. I am having trouble on utils module. because when I comment out the line from utils.datasets import get_labels
The error is on the next line:
ModuleNotFoundError: No module named 'utils.inference'
The utils model what the code your provided want to import is the part of the oarriaga/face_classification project.
The pip installed utils modul is quite different package, so you should not have installed via pip. Your code try to import moduls from this package, but it obviously has no such moduls. That is why the error messages.
So what you have to do is pip uninstall utils and then if your project directory structure is complete, the above code will import the face_classification package's moduls.
I was looking for matpoltlib.pylot package on Pycharm . I couldn't found this package and i installed matplotlib instead.
I installed it from file>setting>project interpreter.
On importing the package:
import matplotlib.pyplot as plt
I get error as follow:
ModuleNotFoundError: No module named 'matplotlib'
I expected to see a normal distribution plot.