MacOS, Gramps Versions, the Network Chart Addon and Python

I asked long ago on the Gramps Users mail list how to get the Network Chart addon to run on a Mac. The basic answer was it is not easy to do. I have hope that things have changed.

Recently I installed Gramps 5.1.3 using the Gramps-Intel-5.1.3-3.dmg package linked off the Gramps website. The Prerequisites Checker says “You have Gramps 5.1.3 installed; an unreleased development version.” I noticed the basic same message when I had 5.1.2 installed. Is this a development version or was some flag set incorrectly?

I am running macOS Catalina 10.15.3.

The Prerequisites Checker reports Python 3.8.5, but when I start Python in a terminal window, I start some variant of Python 2 and the command python3 returns an “invalid active developer path” error. I’m guessing Python3 is not setup correctly on my machine but Gramps can make it work. Does that mean Gramps has its own Python3 package and that is why it is difficult to install the utilities needed by the Network Chart addon? Is there some hack that I can do to install the packages? I would need reasonable directions.

The bottom of the Network Chart addon webpage (https://gramps-project.org/wiki/index.php?title=NetworkChart) recommends using MacPorts but that is at Gramps 5.1.1. And I have not figured out what MacPorts is all about yet. The webpage also links to bug report (https://gramps-project.org/bugs/view.php?id=11900) [wow, just realized that report is from this month!], and user atwong gave up on getting it to work even with MacPorts.

Has anyone succeeded in getting the Network Chart addon to work on a Mac?

Thank you,
Doug

Update your addons, the current version of Prerequistes Checker was updated to recognize Gramps 5.1.3 was released.

Reading the whole bug report you can see that yes atwong has multiple versions of python and was having issues identifying or even recognizing that the version of python used by Gramps was different to version where he installing the prerequisites, if you check the output he was getting from macport you can see he didn’t have the permissions set correctly to install them, so he gave up but atwong saying macports doesn’t work only mean it does not work for him. Someone a bit more technical will need to workout how exactly to do it with macports and document it for us mere mortals!

HI:

I use Gramps a bit and contribute to the MacPorts project on some other stuff. I don’t have time to try out the NetworkChart plugin at the moment but maybe I can give some pointers.

The .dmg installer downloaded from Gramps installs the software as a typical Mac .app package. That means that Python 3 and eveything else that Gramps needs to run is inside the .app (a .app is a special kind of directory). You can’t run Python 3 from the command line in Terminal since there is no PATH set to find the executable inside the .app.

Installing Gramps via MacPorts puts all the components in a hierarchy of folders under ‘/opt/local/’. So the executable for Python3 would be found at /opt/local/bin/python3. Installing MacPorts usually adds this PATH so you can conveniently start things in the Terminal just by typing ‘python3’.

From the wiki page, it appears the NetworkChart needs networkx [1] and pygraphviz [2]. In MacPorts, these would be installed with:

sudo port install py37-networkx py37-pygraphviz

This assumes that you’ve installed gramps with the default python37 variant.

HTH,

Craig

[1] https://ports.macports.org/port/py37-networkx/summary
[2] https://ports.macports.org/port/py37-pygraphviz/summary

1 Like

Just did, and restarted Gramps. The Plugin Manager says I’m running Prerequisites Checker Version: 0.8.34. The Checker is still reporting “You have Gramps 5.1.3 installed; an unreleased development version.”

I consider myself Mere Mortal, Second Class. I professionally programmed 20 years ago. Lots of thick rust in my skill set today.

Thanks Craig.

This will take me some time to try.

Can I have the MacPorts and the ‘standard’ version of Gramps installed at the same time, with unique copies of my tree, or should I expect conflicts?

The Prerequisite Checker is reporting Python 3.8.5. Assuming that is the version I get with MacPorts, would I substitute “py38” for the two “py37” parameters in the sudo command?

I noticed there is a Python Shell addon/gramplet. Is there anyway to use that to load network and pygraphviz and then load the Network Chart addon?

Doug

Hi Doug:

I believe it is safe to have both versions installed. Don’t try to have them point to the same Gramps database, however, in case there is any version incompatibility. Use xml exports to move your trees back and forth if needed.

Currently, the MacPorts version of Gramps does not have an option for Python 3.8; the highest (and default) is currently 3.7. I don’t think that makes any practical difference for Gramps.

I’m not familiar with the Python Shell. However, unless the developer specifically tested with macOS, I would be doubtful that it would work. If you use MacPorts, the networkx and py-graphviz will be installed in a location that the MacPorts-installed-python37 will find by default. So the NetworkChart plugin ought to be able to find all the dependencies it needs. [Fingers crossed.]

Craig
(I’m not a Python guy but another package that I support on MacPorts makes extensive use of Python. Thus I’ve absorbed some basic stuff.)

I ended up installing the Network Chart add on to my MacPorts-installed Gramps (after installing the python modules mentioned above). Seems to work fine.

Craig

That is good news Craig.

Display Error RESOLVED: Rebooted the computer.

I think I was able to install Xcode, MacPorts, and then “port” in Gramps, network, pygraphviz and xorg-server. I am getting a display error when starting gramps. Any idea what I need to do?

  • Dougs-MBP:~ doug$ gramps

  • (gramps:81317): Gtk- WARNING **: 08:14:14.461: cannot open display:

  • Dougs-MBP:~ doug$ echo $DISPLAY

  • Dougs-MBP:~ Doug$

Thank you all. I have Network Chart working under MacPorts.

Ah, sorry. IMHO, the MacPorts project doesn’t do a very good job of helping new users with X11 apps. At the end of the install process, a message would have been displayed saying:

xinit has the following notes:
  To use MacPorts' X11 as the default server, install xorg-server, log out, and log back in.

After logging out of your account and back in (or restarting), entering “gramps” in Terminal is supposed to automatically start the X11 application and open the Gramps application in that environment. However, that doesn’t work for me; perhaps it will for you.

What I’ve done is start the X11 app (see /Applications/MacPorts). Under the Applications menu, choose Customize and Add item. Double click in the appropriate spot in the Name column and enter “Gramps” and then tab to the Command column and enter “gramps”. This will add a Gramps entry in the Applications menu and from then on you can start Gramps just by selecting that menu item after you’ve started the X11 app.

HTH

Craig

Craig,

Just a few notes in case someone in the future tries to load Gramps under MacPorts.

Gramps would not start after I loaded all the software (see below). I then exited and closed the terminal window, and opened a new terminal. Then Gramps would start but it had the display error. Finally I rebooted, launched a terminal window and ran Gramps. Success. I did not try logging out and in of the Mac and perhaps that would have been sufficient. MacPorts is very verbose when it installs a package.

BTW, it is running under X11. All I need to do is enter ‘gramps’ in a terminal window.

Software Installed (from memory, possibly in error, sorry):

  • Xcode from the Mac AppStore.
  • MacPorts from the MacPorts website.
  • From a terminal window:
    • sudo port install gramps
    • sudo port install py37-networkx py37-pygraphviz
    • sudo port install xorg-server
  • Reboot computer
  • From a terminal window:
    • gramps

Doug

Glad you got it working.

Please consider opting-in to report MacPorts statistics via ‘sudo port install mpstats’ A process will then run once a week on your computer to submit anonymous statistics on the ports installed on your computer. These help maintainers to know a basic profile of the software environments their port is running under. It helps potential users to see that other people have their configuration have a particular port installed.

There is a quiet mode (sudo port -q install foo) but it isn’t recommended. Too many users would jump the gun and assume the install was hung when it was actually still working away.

Gramps requires at least 150 supporting packages (“ports” in MacPorts parlance). You get a couple of lines for each package as it is being retrieved and installed; more if it has to be built from source.

Going forward, you can handle software updates as follows:

sudo port selfupdate

This updates the index of all MacPorts ports to reflect the latest versions available through MacPorts.

port outdated

This will list any ports that you have installed and an updated version is available. Optional.

 sudo port upgrade outdated

Actually installs updated versions of your ports. Also installs any updates to the MacPorts software, if required.

At a bare minimum, you should upgrade your installed ports annually. If you leave it too long, the upgrade can be problematic sometimes.

Craig

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.