discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] "from gnuradio import gr" fails with a Fatal Pyth


From: Michael Dickens
Subject: Re: [Discuss-gnuradio] "from gnuradio import gr" fails with a Fatal Python error
Date: Mon, 21 Nov 2016 14:02:01 -0500

Glad that you are getting GR working on your Mac.

If you want to make sure "which python" results in a MacPorts version, use "port select":
{{{
port select --list python
}}}
will list the options; mine are:
{{{
% port select --list python
Available versions for python:
        none
        python26-apple
        python27
        python27-apple
        python34
        python35
}}}
Then, you select the one you want. For GR, we generally want MacPorts' version 2.7:
{{{
sudo port select python python27
}}}
and, then "--list" will return:
{{{
% port select --list python
Available versions for python:
        none
        python26-apple
        python27 (active)
        python27-apple
        python34
        python35
}}}

Hope this helps! - MLD

On Mon, Nov 21, 2016, at 01:32 PM, Gilad Beeri (ApolloShield) wrote:
Hi,
Seems like you got it. I'm writing here analysis and fixing steps for future generations.
  1. Reproduce the problem by running 'python -c "from gnuradio import gr' - that should crash and print the error
  2. Running "which python" should show the python binary used, most probably /usr/bin/python
  3. 'port list | grep "lang/python"' will show the installed MacPort Python versions.
  4. Assuming your default Python is 2.7 ("python -V" to verify),  "port contents python27 | grep bin/python" will show the binaries installed by that Python 2.7 port, which will probably be /opt/local/bin/python2.7 (which symlinks to /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7).
  5. Running '/opt/local/bin/python2.7 -c "from gnuradio import gr"' works as expected
  6. So it's possible to work with GNU Radio as long as you use the correct Python binary. In my case, the PATH environment variable did have /opt/local/bin before /usr/local/bin, but MacPorts doesn't create a "python" symlink, so it can be fixed by either using "python2.7" (which exists in /opt/local/bin and will be used before the system's binary) or by creating a symlink with "ln -s /usr/local/bin/python2.7 /usr/local/bin/python". After symlinking, 'python -c "from gnuradio import gr' works as expected.

On Mon, Nov 21, 2016 at 6:44 PM Michael Dickens <address@hidden> wrote:

Hi Gilad - IIRC this error means that Python installs are being mixed between linking and runtime. For example, linking against the macOS provided Python and then trying to use MacPorts' Python for runtime execution. If this statement doesn't help, email me off-list & we'll work through your issue. - MLD

On Mon, Nov 21, 2016, at 11:10 AM, Gilad Beeri (ApolloShield) wrote:
The Python statement "from gnuradio import gr" crashes the Python process with "Fatal Python error: PyThreadState_Get: no current thread" (mac OS 10.12.1, GNU Radio 3.7.10.1 using Mac Ports, full log is attached).

I tried following the cleanup process detailed in https://github.com/metacollin/homebrew-gnuradio/issues/47,
which caused me to remove the GR modules foo, baz and ieee802_11, such that in a 2nd execution of that script it doesn't find anything.
Tried reinstalling GNU Radio with "sudo port -f uninstall gnuradio; sudo port -t install gnuradio" but still no luck.

Email had 1 attachment:
  • gnuradio_python_exception.txt
      24k (text/plain)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]