Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Matplotlib and numpy incompatibility *** help needed ***
-
Hi there,
I’m using Pythonista for couple days and I am fairly happy with.
Nevertheless, I’m trying to import some librairies such as:
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import sklearn.linear_modelSeems like there are some incompatibility, here under the trace.
Please help,
OswaldTraceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/8985502A-A0F1-4025-BA7E-58369C1FBDEC/Pythonista3/Documents/site-packages-3/numpy/init.py", line 124, in <module>
from numpy.config import show as show_config
ModuleNotFoundError: No module named 'numpy.config'During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/8985502A-A0F1-4025-BA7E-58369C1FBDEC/Pythonista3/Documents/linear_model.py", line 2, in <module>
import matplotlib.pyplot as plt
File "/var/containers/Bundle/Application/D8D11013-53B3-4F3D-BD17-2AAB6743B611/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/matplotlib/init.py", line 181, in <module>
from matplotlib.cbook import is_string_like
File "/var/containers/Bundle/Application/D8D11013-53B3-4F3D-BD17-2AAB6743B611/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/matplotlib/cbook.py", line 34, in <module>
import numpy as np
File "/private/var/mobile/Containers/Shared/AppGroup/8985502A-A0F1-4025-BA7E-58369C1FBDEC/Pythonista3/Documents/site-packages-3/numpy/init.py", line 129, in <module>
raise ImportError(msg)
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.
Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/8985502A-A0F1-4025-BA7E-58369C1FBDEC/Pythonista3/Documents/site-packages-3/numpy/init.py", line 124, in <module>
from numpy.config import show as show_config
ModuleNotFoundError: No module named 'numpy.config'During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/8985502A-A0F1-4025-BA7E-58369C1FBDEC/Pythonista3/Documents/linear_model.py", line 2, in <module>
import matplotlib.pyplot as plt
File "/var/containers/Bundle/Application/D8D11013-53B3-4F3D-BD17-2AAB6743B611/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/matplotlib/init.py", line 181, in <module>
from matplotlib.cbook import is_string_like
File "/var/containers/Bundle/Application/D8D11013-53B3-4F3D-BD17-2AAB6743B611/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/matplotlib/cbook.py", line 34, in <module>
import numpy as np
File "/private/var/mobile/Containers/Shared/AppGroup/8985502A-A0F1-4025-BA7E-58369C1FBDEC/Pythonista3/Documents/site-packages-3/numpy/init.py", line 129, in <module>
raise ImportError(msg)
ImportError: Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there. -
It appears that you have tried to install numpy, perhaps via pip in stash. Or, this tried to install when you tried to install pandas.
Needless to say, on iOS it is impossible to install modules which depend on c, FORTRAN, etc, unless signed by the app (Pythonista) author, which isn’t going to happen. Go into your site-packages folder and delete numpy — you can use the built-in versions of numpy and matplotlib, which are a few versions old, but work fine for most things unless you are someone who works in the bleeding edge.
You likewise cannot install sklearn, scikit, pandas, or anything which is not pure python. You should probably delete anything you tried to install in site-packages, and force quit pythonista.
-
Thanks for your prompt answer.
Regards,
Oswald