gnuradio-for-mac-without-macports icon indicating copy to clipboard operation
gnuradio-for-mac-without-macports copied to clipboard

Python3 not found

Open mehdideveloper opened this issue 4 years ago • 11 comments

Hey Tried the latest 3.8 pre-release on macOS 10.15 Although I have installed python3 via brew, GNURadio shows an error dialog on startup and then closes:

Python 3.7 is not installed. Download it here: https://www.python.org/downloads/

mehdideveloper avatar Oct 09 '19 06:10 mehdideveloper

Was about to report the same for MacPorts and dove into the app bundle to see if I could change where it expects to find python. It's looking in:

/Library/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python

So it's expecting the app bundle version from the python web site. I hate having to have two identical versions installed (small SSD), but changing the symlinks in the GNURadio app bundle was not enough. Installing the app bundle version from the Python web site solved the issue.

Perhaps future versions could take Brew and Macports into consideration. They are quite predictable as to their default install locations. Saving 100+MB would be appreciated.

playaspec avatar Oct 12 '19 03:10 playaspec

@playaspec That solved the issue, now I get Unable to verify running X server though I have already compiled GNURadio 3.7.12 and using it without issues, so there should be no problems with things like X (I suppose)

mehdideveloper avatar Oct 12 '19 08:10 mehdideveloper

I assume you have XQuartz installed? Make sure the "Authenticate connections" button is checked in the Security tab of XQuartz's. preferences. Also, make sure you have xset installed, and is in your path.

playaspec avatar Oct 13 '19 21:10 playaspec

Yes I have XQuartz (latest version) and xset is in the path and the checkbox is checked. It first says Starting X server and then Unable to verify running X server. Will attempt anyway and then closes !

mehdideveloper avatar Oct 13 '19 22:10 mehdideveloper

Perhaps future versions could take Brew and Macports into consideration. They are quite predictable as to their default install locations. Saving 100+MB would be appreciated.

This is more difficult to do than it sounds, since components of the GNURadio install want to link against libpython and friends -- and thus depend on some implementation details of the relevant Python. These are then compounded by some peculiarities of the way macOS's linker handles runtime paths.

I'd actually suggest someone spend some time reviving any of the previous brew taps for GNUradio. Those were difficult to maintain for a while, because they depended on things like Qt4, which Homebrew dropped. With GR3.8, the dependency list seems like it'd actually be manageable by Homebrew, again. :)

ktemkin avatar Oct 16 '19 03:10 ktemkin

Yes I have XQuartz (latest version) and xset is in the path and the checkbox is checked. It first says Starting X server and then Unable to verify running X server. Will attempt anyway and then closes !

Can you run the following command from a terminal, and let know if you get any output / what output you get?

/Applications/GNURadio.app/Contents/MacOS/usr/bin/run-grc

ktemkin avatar Oct 16 '19 03:10 ktemkin

@ktemkin Here's the output of the command:

Traceback (most recent call last):
  File "/Applications/GNURadio.app/Contents/MacOS/usr/bin/gnuradio-companion", line 102, in <module>
    run_main()
  File "/Applications/GNURadio.app/Contents/MacOS/usr/bin/gnuradio-companion", line 95, in run_main
    exit(main())
  File "/Applications/GNURadio.app/Contents/MacOS/usr/share/gnuradio/python/site-packages/gnuradio/grc/main.py", line 73, in main
    from .gui.Platform import Platform
  File "/Applications/GNURadio.app/Contents/MacOS/usr/share/gnuradio/python/site-packages/gnuradio/grc/gui/Platform.py", line 26, in <module>
    from . import canvas
  File "/Applications/GNURadio.app/Contents/MacOS/usr/share/gnuradio/python/site-packages/gnuradio/grc/gui/canvas/__init__.py", line 21, in <module>
    from .param import Param
  File "/Applications/GNURadio.app/Contents/MacOS/usr/share/gnuradio/python/site-packages/gnuradio/grc/gui/canvas/param.py", line 23, in <module>
    from .. import ParamWidgets, Utils, Constants
  File "/Applications/GNURadio.app/Contents/MacOS/usr/share/gnuradio/python/site-packages/gnuradio/grc/gui/ParamWidgets.py", line 52, in <module>
    Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
TypeError: Argument 0 does not allow None as a value

mehdideveloper avatar Oct 16 '19 08:10 mehdideveloper

get the same issues:

/Applications/GNURadio.app/Contents/MacOS/usr/bin/run-grc

/Applications/GNURadio.app/Contents/MacOS/usr/bin/run-grc: /Applications/GNURadio.app/Contents/MacOS/usr/bin/gnuradio-companion: /Library/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Content: bad interpreter: No such file or directory
/Applications/GNURadio.app/Contents/MacOS/usr/bin/run-grc: line 108: /Applications/GNURadio.app/Contents/MacOS/usr/bin/gnuradio-companion: Undefined error: 0
/Applications/GNURadio.app/Contents/MacOS/usr/bin/gnuradio-config-info  -v
3.8.0.0
binwalk /Applications/GNURadio.app/Contents/MacOS/usr/bin/gnuradio-companion

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
2             0x2             Unix path: /Library/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python
97            0x61            Copyright string: "Copyright 2016 Free Software Foundation, Inc."
/Applications/GNURadio.app/Contents/MacOS/usr/bin/gnuradio-companion
zsh: /Applications/GNURadio.app/Contents/MacOS/usr/bin/gnuradio-companion: bad interpreter: /Library/Frameworks/Python.framework/Versions/3.7/Resources/Py: no such file or directory

cn0xroot avatar Nov 01 '19 07:11 cn0xroot

@cn0xroot You have Python 3.8 installed. You need to get Python 3.7 as the binwalk dump shows the executable was hardcoded to find Python 3.7

I was unsuccessful with Python 3.8 earlier. Python 3.7 did the trick.

hongsolo9 avatar Apr 09 '20 17:04 hongsolo9

I also got the surprising message about Python3.7 not being present; I think I installed it from Apple a while ago.

I edited the top of run-grc as follows:

XQUARTZ_APP_DIR=/Applications/Utilities/XQuartz.app
# PYTHON_FRAMEWORK_DIR="/Library/Frameworks/Python.framework/Versions/${PYTHON_VERSION}"
PYTHON_FRAMEWORK_DIR=$(python3 -c 'import os ; print (os.__file__.rsplit("/lib/python",1)[0]);')
PYTHON="${PYTHON_FRAMEWORK_DIR}/Resources/Python.app/Contents/MacOS/Python"

This finds my already-installed Python 3 at /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python. I think/hope the code is sufficiently general to work with other Python 3.7 installs too.

Update: The path is hardwired in many other places, so this is not nearly enough. I found hard-coded paths in 285 files with grep -lnsr 'Python\.framework' *... I'd suggest being less restrictive in the Python3 origin?

vanrein avatar Sep 23 '20 08:09 vanrein

I was unsuccessful with Python 3.8 earlier. Python 3.7 did the trick.

Is this a property of GNURadio, or of this Mac OS X version? I'm surprised that it would set an upper bound to the Python version. (This also relates to my remark about the Python3 location being too rigidly enforced.)

vanrein avatar Sep 23 '20 08:09 vanrein