Installing Glade on Mac OS X

Home Forums Installation Installing Glade on Mac OS X

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #281
    Keith
    Keymaster

    First download from:

    https://www.peardrop.co.uk/downloadfiles/glade4_mac64.tar.gz (64 bit, Python 2.7)

    https://www.peardrop.co.uk/downloadfiles/glade5_mac64.tar.gz (64 bit, Python 3.8)

    Unzip/untar to a directory of choice, then follow the instructions in the README.txt file. Note that for the embedded Python interpreter to work correctly you must set the env var PYTHONPATH to the directory where glade is installed, so it can find the ui.py module. The env var GLADE_HOME is recommended but not essential; Glade will attempt to locate the online html docs based on the app’s location if this is not set.

    To set env vars so you can use Glade from the command line, you can edit your ~/.bash_profile and add e.g:

    export GLADE_HOME=$HOME/Documents/glade4_mac64
    export PYTHONPATH=.:$GLADE_HOME:$PYTHONPATH

    Setting up env vars so you can start Glade from the icon is more complex, as this does not use the shell. The way to do it is to create a file e.g. ~/set_env_vars and use launchctl:

    #!/bin/bash
    # This file is executed during login, and sets up env vars for programs started from their icon
    launchctl setenv GLADE_HOME $HOME/Documents/glade4_mac64
    launchctl setenv PYTHONPATH .:$GLADE_HOME:$PYTHONPATH

    To get this file to execute on login, rather than on starting a terminal, go to System Preferences->Users and Groups and select the ‘Login Items’ tab for the user. Add the file e.g. set_env_vars as above.

    For Glade4, the native Mac Python which is version 2.7 will be used. Glade5 requires Python 3.8. So to install Glade5 on the Mac, you will also need to install a more recent version of Python. You can use the Brew package manager to do this, which will install a version 3.8 in /usr/local (so python2.7, which is required by OSX, is unaffected).

    1. Download and install Brew. You can use the guide at https://osxdaily.com/2018/03/07/how-install-homebrew-mac-os/
    2. Install Brew: ‘brew install python3’
    • This topic was modified 10 months, 1 week ago by Keith.
    • This topic was modified 8 months, 4 weeks ago by Keith.
    • This topic was modified 8 months, 4 weeks ago by Keith.
    • This topic was modified 5 months, 3 weeks ago by Keith.
    • This topic was modified 5 months, 3 weeks ago by Keith.
    • This topic was modified 5 months, 3 weeks ago by Keith.
    #1128
    mguthaus
    Participant

    I have OSX Snow Leopard and have hesitated to upgrade to Lion. Is there any reason this shouldn't work with Snow Leopard? I tried (but not very hard) and get an error:

    "glade cannot be opened because of a problem."

    Very specific. :xd:

    Thanks,

    Matt

    #1129
    Keith
    Keymaster

    Hi Matt,

    Any more info or error messages to debug this? I am building on Lion, but alas have no means to build or test on older versions of the OS. From what I was led to believe by the Trolltech/Nokia/Digia folks, this would be compatible (from a Qt point of view) with OS's from 10.5 onwards.

    cheers

    Keith

    #1130
    Keith
    Keymaster

    One thing worth checking is the version of Python on your Mac. Glade was built linked to version 2.7, it's possible you have an older version and that is causing a problem.

    #1131
    mguthaus
    Participant

    Yes, it was a Python version problem. I was getting this error:

    May 11 10:24:28 otaku [0x0-0x27027].com.peardrop.glade[426]: dyld: Library not loaded: /System/Library/Frameworks/Python.framework/Versions/2.7/Python

    but after installing 2.7 from python.org it works fine. Thanks!

    #1292
    Keith
    Keymaster

    One other thing to watch out for on the Mac. If you have Qt libraries installed on your machine, and they are defined in the DYLD_LIBRARY_PATH environment variable, and they are of a different version to the ones shipped with the glade.app bundle, then you will most likely get a crash if you try and run Glade from the command line rather than click on it in the Finder.

    The reason is that when clicked on with the Finder, OSX environment variables are ignored by the app, which looks for and finds the Qt libs in the .app bundle.

    When run from the command line, the executable knows nothing about the .app bundle libs, and looks at DYLD_LIBRARY_PATH instead. And if e.g. you have Qt 4.8.2 on your system, but Glade was compiled with 4.8.6, it will print an error message to the terminal and die…

    #2036
    Keith
    Keymaster

    A nasty bug has been fixed in 4.6.4 that caused some shortcut keys (bindkeys) not to work on the Mac. This is actually a bug in Qt itself… the Qt folks have been notified.

    #2203
    geoffatmuse
    Participant

    Hello,

    I wonder, is it possible for to link Glade to the subsequently installed Python, in this case 2.7.15, and its accompanying 3rd party modules, instead of linking to the MAC OS system Python.

    Quote:
    First download from:

    https://www.peardrop.co.uk/glade/glade4_mac64.tar.gz (64 bit only)

    Unzip/untar to a directory of choice, then follow the instructions in the README.txt file. Note that for the embedded Python interpreter to work correctly you MUST set the env var PYTHONPATH to the directory where glade is installed, so it can find the ui.py module. The env var GLADE_HOME is recommended but not essential; Glade will attempt to locate the online html docs based on the app's location if this is not set.

    NB prior to version 4.2.4, Glade was built with ActiveState Python. This caused several problems if you just tried to use the version of Python which comes with the Mac (thank you to the users who reported this!). So as of 4.2.4, Glade is linked to the Mac python (currently version 2.7).

    #2204
    Keith
    Keymaster
    Quote:
    Hello,
    I wonder, is it possible for to link Glade to the subsequently installed Python, in this case 2.7.15, and its accompanying 3rd party modules, instead of linking to the MAC OS system Python.

    Glade is built with the current Python version (in my case it is 2.7.10) but will use the site libraries of your installation, depending where PYTHONPATH is set to.

    Is there a particular issue you are encountering that is causing a problem with the default site libraries?

    #2205
    geoffatmuse
    Participant

    I believe I am encountering a compatibility issue between python 2.7.10 and the python requests library with python 2.7.15. I have set PYTHONPATH to the python 2.7.15 directory and that is all working swimmingly.

    However, I receive a "ImportError: cannot import name _remove_dead_weakref" when I open Glade from the command line – "open glade.app". Interestingly, I've just realized that I do not receive this error when opening Glade from Finder.

    Quote:
    Quote:
    Hello,
    I wonder, is it possible for to link Glade to the subsequently installed Python, in this case 2.7.15, and its accompanying 3rd party modules, instead of linking to the MAC OS system Python.

    Glade is built with the current Python version (in my case it is 2.7.10) but will use the site libraries of your installation, depending where PYTHONPATH is set to.

    Is there a particular issue you are encountering that is causing a problem with the default site libraries?

    #2206
    Keith
    Keymaster

    When opening from the command line, you get the environment variables set in your .bash_profile. And presumably this is where you are setting PYTHONPATH.

    Any reason why you have a 2.7.15 installation – the current version for an up to date MacOS is 2.7.10?

    #2207
    geoffatmuse
    Participant
    Quote:
    When opening from the command line, you get the environment variables set in your .bash_profile. And presumably this is where you are setting PYTHONPATH.

    Any reason why you have a 2.7.15 installation – the current version for an up to date MacOS is 2.7.10?

    I am fairly certain that I could use 2.7.10 for my Glade scripts. However, my preference is not to develop using the Mac system installed Python. I believe the issues I am experiencing are the result of a conflict between Glade using the system installed Python and my script importing and using python libraries that are in a standard python installation. So I think the fix would be for me to either use the Python that shipped with my Mac for my Glade scripts or be able to configure Glade to use the standard python installation instead of the system installed Python that comes with the OS.

    Is my understanding correct that Glade is linked to the Mac system python installation and there is no way to configure Glade to have it use a different python installation?

    Thanks for your inputs. I really appreciate it.

    #2208
    Keith
    Keymaster

    Glade is linked to the system libs for its embedded python :

    Keiths-MBP:MacOS keith$ otool -L glade
    glade:
    /System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.10)

    I believe you can control the framework search path using the env var DYLD_FRAMEWORK_PATH if you want it to pick up a non-standard python framework?

    Then the module load path (sys.path) is set using the env var PYTHONPATH.

    #2209
    Keith
    Keymaster
Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.