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.
Loading other modules? Cartopy/basemap?
-
So far I'm very impressed with Pythonista but one thing missing for me are some of the extra modules. I'm specifically looking for map plotting, ideally cartopy but if not at least basemap.
Is it possible to somehow load these non-default modules? I got the impression it was using the site-packages folder but I can't quite see how.
Thanks!
-
It is possible to install additional libraries in Pythonista, but only if they are pure Python, and don't contain any required C/C++/Assembly/Fortran/etc. parts. That means the library itself has to be pure Python, and all of its dependencies have to be included with Pythonista or also pure Python. This is because of Apple's strict rules on code signing - any native (compiled) code loaded by an app must be signed by Apple or the app developer. This means that even if you have a Mac and an Apple Developer membership and were to compile and sign the native modules yourself, you couldn't load them in Pythonista, because of the code signing restrictions.
Accoding to Cartopy's setup.py, it requires Cython, which is a language based on Python that translates into C, which is then compiled with a normal C compiler. This means that you can't install Cartopy in Pythonista (unless the Cython/C parts are optional, but it doesn't look like it).
basemap is based on matplotlib, which uses native code, but is included with Pythonista. However if I'm reading the basemap repo right, it also includes some additional C code itself. This means that you also can't install basemap in Pythonista.