Forum Archive

Upgrade matplotlib to the latest

craftmojo

I manage to download the latest matplotlib 1.5.1 using pipista. However, I dont know how to replace current matplotlib (1.3) and using it in my code.

I couldnt run below code using current matplotlib:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import style
style.use("ggplot")

x = [1, 5, 1.5, 8, 1, 9]
y = [2, 8, 1.8, 8, 0.6, 11]

plt.scatter(x,y)
plt.show()

Any help would be appreciated.

Many Thanks.

ccc

I believe that you need to put it in site-packages And then quit and relaunch Pythonista.

import matplotlib
print(matplotlib.__version__)
print(matplotlib.__version__numpy__)
craftmojo

Do I need extract the downloaded file (tar.gz) and then place it inside site-packages ?

JonB

it is not obvious that you can upgrade matplotlib. Much of matplotlib is c code, and version 1.3 to 1.5 had changes to thousands of lines of c. While you might get some bits to work, it seems unlikely it will behave as 1.5 is supposed to.

craftmojo

Thanks for the answer.
Is there any workaround, so I can use 1.5 lib for my code ?
How about upgrade other modules like numpy, or install new module like sklearn.
Is it possible ?

dgelessus

No, you can only install pure Python modules yourself. Modules such as numpy and matplotlib that use C, Cython, Fortran or other compiled languages need to be integrated into Pythonista by omz, because Apple's app guidelines do not allow compiling native code in an app, and simply because there are no C compilers for iOS on iOS.