7

I want to create a native Mac OS X package installer, the creation of the package is not really the problem, the real deal is the dependencies that have to get installed; I need to install Python, NumPy and Matplotlib (only if the required versions are not already installed).

I have heard really bad things about the Package Maker app, I've been reading a little and have already even found a nice tutorial although it is quite outdated. As a reference, here's Apple's reference guide.

I imagine I would have to use the uncompiled source provided from each of these three projects.

It would really help me to see the PackageMaker file that is used to create the official Python installer, if such file is available somewhere, please point me to it.

Anyway:

What would be the best way to do this? Is using a PackageMaker silly for this purpose? Any other literature that would help me?

Extra:

What would be the easiest way to test my installers?

El Developer
  • 3,345
  • 1
  • 21
  • 40
  • OS X already has python, so have a look at `virtualenv`+`pip install` combo wrapped with a `shell script`. – Misha Akovantsev Feb 12 '12 at 08:17
  • 1
    The Python that ships with Mac OS X won't work with Matplotlib, you have to do a fresh install from Python.org. Anyway, I will check those two options. – El Developer Feb 12 '12 at 08:24
  • I mentioned that, because, if you already have any python by default, you easily can write `install.sh` to install virtualenv, pip and so on. Oh wait. You can do this even without default python. – Misha Akovantsev Feb 12 '12 at 08:29
  • 1
    It is possible, but not easy, to install numpy, scipy and matplotlib for the default Python in Lion. I did it this weekend, but I think you are wise to package them all together instead. – Brian B Feb 17 '12 at 16:41
  • Yeah, I hate when I see a user all confused and not being able to install the software. Specially for the users or people that don't have a background on UNIX :( – El Developer Feb 17 '12 at 16:54
  • "The Python that ships with Mac OS X won't work with Matplotlib, you have to do a fresh install from Python.org." <- this is probably not true. – LaC Feb 17 '12 at 19:07
  • Sorry, i forgot to add, that this is true for the Matplotlib.pkg installer. http://s104.photobucket.com/albums/m184/yosmark/?action=view&current=Capturadepantalla2012-01-12alas0636.png (See the first few lines) ... I assumed that being that the suggestion, I installed Python from python.org and then proceeded to install Matplotlib. – El Developer Feb 17 '12 at 19:13
  • Did you ever check out the [Packages](http://s.sudre.free.fr/Software/Packages/about.html) application, that possibly seems to do what you want? How did you solve this in the end? – MiB Nov 22 '14 at 00:08
  • I never looked at Packages, we ended up having to move to use pip. – El Developer Nov 22 '14 at 00:14
  • I know it's an old Q, I'm commenting just for anyone stumbles upon here. On reading your comment on @michael 's answer, I think you want it for easing dependencies for development process; you probably need docker. – 0xc0de Oct 11 '18 at 05:37

4 Answers4

4

I'm assuming that you want to install the packages that you mentioned because you are developing a Python application. Have you looked at PyInstaller? It "converts (packages) Python programs into stand-alone executables, under Windows, Linux, Mac OS X, Solaris and AIX", so you don't have to worry about what's installed on the target system.

And if you use PyInstaller, the "extra" would be easy. Simply copy the resulting executable to any other machine and test it out by executing it.

michael pan
  • 589
  • 3
  • 10
  • Although this is a solution (I'm not 100% sure), for developing a lot of our people have to install everything, and they usually waste a lot of time installing everything, that is why I need to create an installer and if there is some code to edit or remove they can. This is a solution for distribution, not for development. Thank you for the suggestion Michael. – El Developer Feb 12 '12 at 07:58
  • 1
    Is there a Python package to create general `pkg` installers for macOS? – Royi Mar 08 '19 at 21:35
2

Something like /tmp/install.sh:

cd ~
curl -C - -O http://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.7.tar.gz

tar -xzf virtualenv-1.7.tar.gz
cd ./virtualenv-1.7
python setup.py install

cd ~
rm virtualenv-1.7.tar.gz
rm -rd ./virtualenv-1.7

virtualenv myenvfolder
source myenvfolder/bin/activate
easy_install pip 

pip install NumPy
pip install Matplotlib

And then:

chmod +x /tmp/install.sh;
/tmp/install.sh
Misha Akovantsev
  • 1,817
  • 13
  • 14
  • Are you suggesting to add this script to the Package Installer project? Else, I want to avoid any interaction with the terminal for the installation. That's why I want to use Package Installer. Thanks! – El Developer Feb 13 '12 at 04:48
  • Side note: Usually dependency packages (pip installable) are listed in a `requirement.txt` like file and added to version control (git), and any installer script just has to have `pip install -r /requirement.txt`. – 0xc0de Oct 11 '18 at 05:31
1

Maybe you can use macports binary-packages or binary-archives? and maybe fabric or puppet. Puppet on OSX.

Macports is as simple as apt-get to use and takes care of all dependencies. By default macports installs to /opt/local so installs don't interfere with apple installs. Default is to compile from source. Some packages are big and have a lot of dependencies so compiling takes a lot of time and all the recourse on the machine. If you make a binary-archive you only have to compile ones pr machine arcithecture/osx-version. Then you only need to install macports and sett up a share with binary-archives. With fabric or puppet you can automate builds and distribution.

Then if you in the near future find out that you need pytable or numexpr it is as simple as: sudo port install py26-tables and if other people need it to you can make binary-archive of it and put it on the share.

mfrellum
  • 169
  • 3
-1

To install Python's latest version you can go here, and you can install NumPy and matplotlib directly in your terminal with these commands:

pip3 install matplotlib

pip3 install numpy
Reza Rahemtola
  • 1,182
  • 7
  • 16
  • 30
JPhay0001
  • 1
  • 3
  • This does not answer the question, this is not what they're asking about. – Eric Aya Aug 07 '21 at 12:28
  • He says that the problem is not the package, but installing the dependencies (python, numpy and matplotlib), that's what I'm answering – JPhay0001 Jun 20 '23 at 20:48