1

Hi I am following a tutorial that was using matplotlib.finance to use candlestick.ohlc. When researching I found out that that lib was deprecated and to use mlp_finance. I believe I have installed it by running the command prompt and entering the line pip install mpl_finance. The result that I get this

enter image description here

I tried re running the script but I still get the error:

     from  mpl_finance   import candlestick_ohlc
    ModuleNotFoundError: No module named 'mpl_finance'

I checked the python library path and I don't see a folder labeled mlp_finance(Im not sure if Im suppose to). But I do see a file labeled mpl_finance-0.10.0-py3.7.egg

enter image description here

Any help on resolving this issue? Downloaded the git package and ran the command prompt install

enter image description here

ran the command line pip install git clone https://github.com/matplotlib/mpl_finance.git mpl_finance.git

enter image description here

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
JoeyDiaz
  • 137
  • 1
  • 2
  • 12

6 Answers6

3

I've got the same error you told, but I resolved it as below.

First, install mpl_finance

pip install https://github.com/matplotlib/mpl_finance/archive/master.zip

Second, upgrade mpl_finance

pip install --upgrade mplfinance

Hope that this will work.

Osadhi Virochana
  • 1,294
  • 2
  • 11
  • 21
  • This is a very confusing answer. `mpl_finance` and `mplfinance` are two different packages. There is no reason to install both. `mpl_finance` is the old deprecated version. `mplfinance` is the new version. They both **do the same thing but have a very different interface**. See https://github.com/matplotlib/mplfinance#usage and https://github.com/matplotlib/mplfinance#old-api-availability for more information. – Daniel Goldfarb Mar 14 '21 at 01:24
2

if you using Anaconda - To install this package with conda run: conda install -c conda-forge mplfinance

AnoopDixit
  • 209
  • 2
  • 6
1

If you want to follow that tutorial on mpl_finance, you can do so by installing the new mplfinance:

pip install --upgrade mplfinance

Then every place the tutorial tells you to import from mpl_finance change the import to
from mplfinance.original_flavor, for example:

change:

from  mpl_finance   import candlestick_ohlc

to

from mplfinance.original_flavor import candlestick_ohlc
Daniel Goldfarb
  • 6,937
  • 5
  • 29
  • 61
0

You need to install matplotlib/mpl_finance at https://github.com/matplotlib/mpl_finance

git clone https://github.com/matplotlib/mpl_finance.git mpl_finance.git
cd mpl_finance.git
python setup.py install
caot
  • 3,066
  • 35
  • 37
0

mpl_finance has been deprecated, just install the module as mplfinance.

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
-2

pip install mlp_finance will solve the issue

Samuel Liew
  • 76,741
  • 107
  • 159
  • 260
JoeyDiaz
  • 137
  • 1
  • 2
  • 12