wxPython Phoenix with Anaconda Python

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

wxPython Phoenix with Anaconda Python

Clemens Brunner
Hi!

I wanted to try wxPython Phoenix 4.0.0a1 on my Mac with Anaconda Python. Installing via pip install wxpython works fine, but when I run the following minimal example I get an error:

python -c "import wx; app = wx.App()"


This program needs access to the screen. Please run with a

Framework build of python, and only when you are logged in

on the main display of your Mac.


Any ideas what went wrong?


Thanks,

Clemens

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxPython Phoenix with Anaconda Python

Matt Newville
With Anaconda Python on Mac OSX, you must use 'pythonw' instead of 'python' for wxPython applications.

See https://groups.google.com/d/msg/wxpython-users/T-H1Dbnnb1Q/RuXZuDo7AgAJ

--Matt

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxPython Phoenix with Anaconda Python

Umar Yusuf
Another possible bug with Anaconda Python is: wxPython doesn't load/run via the Jupyter Notebook (at least on my setup). Has anybody noticed this?

On Fri, Apr 28, 2017 at 5:16 PM, Matt Newville <[hidden email]> wrote:
With Anaconda Python on Mac OSX, you must use 'pythonw' instead of 'python' for wxPython applications.

See https://groups.google.com/d/msg/wxpython-users/T-H1Dbnnb1Q/RuXZuDo7AgAJ

--Matt

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.



--

**************************************

*Wouldn't you rather do Business with us?  *   
This message is for the designated recipient only and may contain
privileged, proprietary, or otherwise private information. If you have
received it in error, please notify the sender immediately and delete the
original. Any use of the email by you is prohibited. If you have received
this communication in error, please notify the author by replying to this
e-mail immediately.

**************************************

www.BintaSMS.com <http://www.bintasms.com/>
www.BintaComputers.net <http://www.bintacomputers.net/>


--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxPython Phoenix with Anaconda Python

Chris Barker - NOAA Federal
That's because the Jupiter notebook does not use pythonw. It uses the regular python executable. It maybe possible to launch the notebook with pythonw, if so that might work for you. Otherwise we really need to get continuum to update the OS X python so that it supports windowing applications properly.

-CHB

On Apr 28, 2017, at 2:20 PM, Umar Yusuf <[hidden email]> wrote:

Another possible bug with Anaconda Python is: wxPython doesn't load/run via the Jupyter Notebook (at least on my setup). Has anybody noticed this?

On Fri, Apr 28, 2017 at 5:16 PM, Matt Newville <[hidden email]> wrote:
With Anaconda Python on Mac OSX, you must use 'pythonw' instead of 'python' for wxPython applications.

See https://groups.google.com/d/msg/wxpython-users/T-H1Dbnnb1Q/RuXZuDo7AgAJ

--Matt

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.



--

**************************************

*Wouldn't you rather do Business with us?  *   
This message is for the designated recipient only and may contain
privileged, proprietary, or otherwise private information. If you have
received it in error, please notify the sender immediately and delete the
original. Any use of the email by you is prohibited. If you have received
this communication in error, please notify the author by replying to this
e-mail immediately.

**************************************

www.BintaSMS.com <http://www.bintasms.com/>
www.BintaComputers.net <http://www.bintacomputers.net/>


--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxPython Phoenix with Anaconda Python

Matt Newville
In reply to this post by Umar Yusuf


On Fri, Apr 28, 2017 at 4:20 PM, Umar Yusuf <[hidden email]> wrote:
Another possible bug with Anaconda Python is: wxPython doesn't load/run via the Jupyter Notebook (at least on my setup). Has anybody noticed this?

You can use "pythonw" to launch ipython:

    Macbook:~>pythonw ~/anaconda3/bin/ipython
    Python 3.6.0 |Anaconda custom (x86_64)| (default, Dec 23 2016, 13:19:00)
    Type "copyright", "credits" or "license" for more information.

    IPython 5.3.0 -- An enhanced Interactive Python.
    ?         -> Introduction and overview of IPython's features.
    %quickref -> Quick reference.
    help      -> Python's own help system.
    object?   -> Details about 'object', use 'object??' for extra details.
    Imported history from '/Users/Newville/.pyhist'

    In [1]: import wx ; app = wx.App() ; print(app) ; print(wx.PlatformInfo)
    <wx.core.App object at 0x10946b558>
    ('__WXMAC__', 'wxMac', 'unicode', 'unicode-wchar', 'wxOSX', 'wxOSX-cocoa', 'wx-assertions-on', 'phoenix', 'wxWidgets 3.0.3')

    In [2]: wx.__version__
    Out[2]: '4.0.0a1'


But this "pythonw trick" does not work with "jupyter-console" or "jupyter-qtconsole" probably because they do some some crazy hacking of the Python environment and PYTHONEXECUTABLE -- that is kind of the point of Jupyter, after all.

But, of course, Anaconda is just messing around with us, and they actually ship an almost-working Python so that "import wx" will work with

    ~/anaconda3/python.app/Contents/MacOS/python ~/anaconda3/bin/jupyter-console

that is *without* setting PYTHONEXECUTABLE.  I've seen actual wx apps work like this, but haven't tested it in any detail.   



--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxPython Phoenix with Anaconda Python

Clemens Brunner
Thanks Matt, but I don't have a pythonw in my Anaconda folder. I just have the one provided in /usr/bin. How do I use that to call the Anaconda Python executable? When I do e.g.

pythonw /usr/local/anaconda/bin/ipython


I get the following error:


Traceback (most recent call last):

  File "/usr/local/anaconda/bin/ipython", line 4, in <module>

    import IPython

ImportError: No module named IPython


Thanks,
Clemens



On Saturday, April 29, 2017 at 2:37:14 AM UTC+2, Matt Newville wrote:


On Fri, Apr 28, 2017 at 4:20 PM, Umar Yusuf <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="93wxmJvnBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">bintaco...@...> wrote:
Another possible bug with Anaconda Python is: wxPython doesn't load/run via the Jupyter Notebook (at least on my setup). Has anybody noticed this?

You can use "pythonw" to launch ipython:

    Macbook:~>pythonw ~/anaconda3/bin/ipython
    Python 3.6.0 |Anaconda custom (x86_64)| (default, Dec 23 2016, 13:19:00)
    Type "copyright", "credits" or "license" for more information.

    IPython 5.3.0 -- An enhanced Interactive Python.
    ?         -> Introduction and overview of IPython's features.
    %quickref -> Quick reference.
    help      -> Python's own help system.
    object?   -> Details about 'object', use 'object??' for extra details.
    Imported history from '/Users/Newville/.pyhist'

    In [1]: import wx ; app = wx.App() ; print(app) ; print(wx.PlatformInfo)
    <wx.core.App object at 0x10946b558>
    ('__WXMAC__', 'wxMac', 'unicode', 'unicode-wchar', 'wxOSX', 'wxOSX-cocoa', 'wx-assertions-on', 'phoenix', 'wxWidgets 3.0.3')

    In [2]: wx.__version__
    Out[2]: '4.0.0a1'


But this "pythonw trick" does not work with "jupyter-console" or "jupyter-qtconsole" probably because they do some some crazy hacking of the Python environment and PYTHONEXECUTABLE -- that is kind of the point of Jupyter, after all.

But, of course, Anaconda is just messing around with us, and they actually ship an almost-working Python so that "import wx" will work with

    ~/anaconda3/python.app/Contents/MacOS/python ~/anaconda3/bin/jupyter-console

that is *without* setting PYTHONEXECUTABLE.  I've seen actual wx apps work like this, but haven't tested it in any detail.   



--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxPython Phoenix with Anaconda Python

Matt Newville


On Tue, May 2, 2017 at 5:50 AM, Clemens Brunner <[hidden email]> wrote:
Thanks Matt, but I don't have a pythonw in my Anaconda folder. I just have the one provided in /usr/bin. How do I use that to call the Anaconda Python executable? When I do e.g.

pythonw /usr/local/anaconda/bin/ipython


I get the following error:


Traceback (most recent call last):

  File "/usr/local/anaconda/bin/ipython", line 4, in <module>

    import IPython

ImportError: No module named IPython



Does this have anything to do with wxPython? 

You have 'ipython' but not the 'IPython' module, and not 'pythonw'?   That seems like something is wrong with the Anaconda installation.   For me, Anaconda on Mac OSX installs either to /Users/USERNAME/anaconda or /Users/USERNAME/anaconda3  when doing 'install for me only' or /anaconda or /anaconda3 when installing for all users.

I suggest reinstalling.

--Matt

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxPython Phoenix with Anaconda Python

Clemens Brunner
On Tuesday, May 2, 2017 at 1:52:09 PM UTC+2, Matt Newville wrote:
You have 'ipython' but not the 'IPython' module, and not 'pythonw'?   That seems like something is wrong with the Anaconda installation.   For me, Anaconda on Mac OSX installs either to /Users/USERNAME/anaconda or /Users/USERNAME/anaconda3  when doing 'install for me only' or /anaconda or /anaconda3 when installing for all users.

Actually, I'm using Miniconda3 installed to /usr/local/anaconda. Apparently, you have to install the python.app package via conda in order to get pythonw. Meanwhile, I've switched to Python installed via Homebrew which works like a charm.

Clemens

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.