Compiling on OSX (10.11) with non-system Python

I have been trying to get Panda3D (v 1.9.2) running on my computer running El Capitan with a version of Python that did not come with the system (v 2.7.11). I believe this is not possible with the .dmg installer, so have been attempting to build from the source. I have the NVIDIA Cg toolkit, and downloaded the source and third party extensions from this website. However, when I run the makepanda/makepanda.py file using this custom Python distribution, it crashes at 93% with the following error (using verbose syntax):

[ 93%] Generating ‘pandac’ tree
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 -B built/direct/ffi/jGenPyCode.py -r panda3d.core panda3d.physics panda3d.fx panda3d.direct panda3d.vision panda3d.skel panda3d.egg panda3d.ode
Process exited with exit status 255 and signal code 117

The Python version referenced here is the OSX system Python, not the version of Python used to run this makepanda file. On top of this, the verbose output suggests that this is the version of Python being used for many parts of the build, since an early notification is:

Using Python 2.7 build located at /System/Library/Frameworks/Python.framework/Versions/2.7/Headers

Is there any way to make sure that the makepanda file uses the version of Python used to call it? I’m also hoping that is the cause of the error, but please let me know if that wouldn’t be the cause of this problem.

Thank you!

Two changes are necessary for this to happen. Firstly, in makepandacore.py, function SdkLocatePython, find this line:

    elif GetTarget() == 'darwin':

Replace it with:

    elif False:

Secondly, in makepanda.py, find these lines:

            if GetTarget() == "darwin" and not RTDIST and not PkgHasCustomLocation("PYTHON"):
                LibName("PYTHON", "-framework Python")

Replace that “if” with an “if False:” as well.

Then, delete the “built” directory and re-try building.

Thanks! Those changes helped point the installer to the right place and the makepanda script passes all of the milestones it choked on in the past.

However, I’m running into issues getting across the finish line. When I run it with the --installer option is returns an error on the command:

cp -R built/.so dstroot/pythoncode/Developer/Panda3D/
cp: built/
.so: No such file or directory
Process exited with exit status 0 and signal code 1

If I exclude the installer option, the makepanda script finishes without errors, but I’m not sure where the built package lies since it wasn’t installed to anywhere on my PYTHONPATH.

Any help you could provide for getting the installer working would be greatly appreciated.

Thank you!

I think you can comment out the offending line in makepanda.py that copies these files:

        oscmd("cp -R %s/*.so                  dstroot/pythoncode/Developer/Panda3D/" % GetOutputDir())

I’ll look into checking in a fix for this.

Without building an installer, you can also run Panda straight from the “built” directory. Just point your PYTHONPATH environment variable to the “built” directory generated by makepanda, and that should be sufficient to run your programs.