Installing wx in an Anaconda virtual environment

1,847 views
Skip to first unread message

cappy2112

unread,
Apr 18, 2017, 5:29:22 PM4/18/17
to wxPython-users

Hello Everyone,

its been a few years since I've actively used wx as well as have monitored this list, and have lost touch with where wx Python is, 2.x vs 3.x , not to mention Phoenix.
(Mike Driscoll has given me a brief update though.)

Since then, I've become an avid fan of the Anaconda distribution, because it will install all dependencies needed for me to run the Jupuer notebook (formerly the iPython Notebook).

I'm currently using Windows 7, 64-Bit, but I've installed the 32-Bit version of Python via the Anaconda installer, because I need to distribute PyInstaller .exe's on 32-Bit Windows systems.
Anaconda has its own version of virtual environments, which is both a curse and a blessing. The Python ecosystem really should converge on one of these that everyone uses.

I've successfully installed wxPython 3.0.0 in one of my Anaconda virtual environments using : conda install wxpython
Unfortunately, 3.0.2 isn't available through anaconda nor pip. When I tried installing wx 3.02 via pip, an error was displayed. Pip wouldn't even display versions of wx other than 4.x alpha :(

I've always been a big fan of the wxPython demo package -> http://downloads.sourceforge.net/wxpython/wxPython3.0-win32-docs-demos-3.0.2.0.exe

but I don't know how to make this work with an Anaconda virtual environment, since it is installed via a .EXE installer.

Does anyone have any ideas?

Thanks

Tony



Matt Newville

unread,
Apr 18, 2017, 6:19:53 PM4/18/17
to wxpytho...@googlegroups.com
Tony,


On Tue, Apr 18, 2017 at 4:29 PM, cappy2112 <capp...@gmail.com> wrote:

Hello Everyone,

its been a few years since I've actively used wx as well as have monitored this list, and have lost touch with where wx Python is, 2.x vs 3.x , not to mention Phoenix.
(Mike Driscoll has given me a brief update though.)

Since then, I've become an avid fan of the Anaconda distribution, because it will install all dependencies needed for me to run the Jupuer notebook (formerly the iPython Notebook).

I'm currently using Windows 7, 64-Bit, but I've installed the 32-Bit version of Python via the Anaconda installer, because I need to distribute PyInstaller .exe's on 32-Bit Windows systems.
Anaconda has its own version of virtual environments, which is both a curse and a blessing. The Python ecosystem really should converge on one of these that everyone uses.

I've successfully installed wxPython 3.0.0 in one of my Anaconda virtual environments using : conda install wxpython
Unfortunately, 3.0.2 isn't available through anaconda nor pip. When I tried installing wx 3.02 via pip, an error was displayed. Pip wouldn't even display versions of wx other than 4.x alpha :(
 

You might try    conda install -c newville wxpython-phoenix

This will install a snapshot of 3.0.3 from about a month ago. It works for me with Anaconda Python 2.7 and 3.6 on Windows 7 (32- and 64-bit), Mac OSX, and Linux (64-bit only, and tested Centos 7 and Fedora 24),

This conda channel was mostly to test the building a conda package for Phoenix, and has not yet been updated for wxPython 4.0.0a1.   There is a Pull Request for that at Chris Barker's github repo for wxPython conda recipes at https://github.com/PythonCHB/wxPython_conda_recipe but it has not been well tested or used to actually build packages.  Then again, the 3.0.3 snapshots work pretty well, so 4.0.0a1 should also work.

The hope is to push such conda packages to conda_forge.I ran into some challenges with that, especially wrt automatically building for Linux on the CircleCI docker system they use -- I'm sure this would be easy for someone more familiar than I am with CircleCI to figure out, but I haven't found the time.

If you or anyone else would like to help build these packages, that would be very much appreciated.

I've always been a big fan of the wxPython demo package -> http://downloads.sourceforge.net/wxpython/wxPython3.0-win32-docs-demos-3.0.2.0.exe

but I don't know how to make this work with an Anaconda virtual environment, since it is installed via a .EXE installer.
Does anyone have any ideas?
 
The demos and docs can be installed from source, even on Windows.  I think a conda recipe for these would not be hard.

--Matt Newville

cappy2112

unread,
Apr 18, 2017, 7:24:16 PM4/18/17
to wxPython-users, newv...@cars.uchicago.edu

Matt

>>You might try    conda install -c newville wxpython-phoenix
This worked fine form inside of my Anaconda virtenv

>>The demos and docs can be installed from source, even on Windows.  I think a conda recipe for these would not be hard.
I've got no idea how to make a conda recipe, and I've never installed the Docs & Demos from source.

Thanks for the info!

Steve Barnes

unread,
Apr 19, 2017, 12:05:25 AM4/19/17
to wxpytho...@googlegroups.com


On 19/04/2017 00:24, cappy2112 wrote:
>
> Matt
>
>>>You might try conda install -c newville wxpython-phoenix
> This worked fine form inside of my Anaconda virtenv
>
>>>The demos and docs can be installed from source, even on Windows. I
> think a conda recipe for these would not be hard.
> I've got no idea how to make a conda recipe, and I've never installed
> the Docs & Demos from source.
>
> Thanks for the info!
>

The Docs do take some building but the Demos, at least mostly, run
successfully from source, (it is python after all), once you have
wxPython installed and running. The steps are:

1/ Change directory to a working area and check which wxPython you are
using with `python -c "import wx;print(wx.version());"`
2/ Either:
2a/ Use git _Recommended_:
- Clone the wxPython source code for Classic and/or Phoenix (depending
which you are looking to work from) with one or both of:
- `git clone https://github.com/wxWidgets/Phoenix.git`
- `git clone https://github.com/wxWidgets/wxPython.git`
- change directory to the one that you are interested in wxPython (for
2.8.0.2 to 3.0.2.0) or Phoenix (for 4.0.0a1).
- List the available release tags with `git tag`
- Update your working copy to the desired tag with `git checkout `
followed by the name of the tag.
2b/ Use your browser _You have to do this for each version that you are
interested in_
- Go to one/or both of:
- https://github.com/wxWidgets/wxPython/releases
- https://github.com/wxWidgets/Phoenix/releases
- Find the version that you are interested in and download the .zip or
.tag.gz whichever you find most convenient.
- Unzip/Untar to your working area and change directory to the
resulting directory.
3. cd demo
4. python demo.py
5. You can add a shortcut to your desktop to run the demo if you wish.
6. If you use the git method you can update at any time with `git
pull` and switch between versions with the git tag and checkout
commands. If you use the browser method you will have to download any
new releases and unzip/untar the version(s) that you wish to try - in
this case I strongly recommend either a new directory or deleting all of
the contents of the old one first as you may get some issues with old
.pyc files, etc., otherwise.

You also now have the entire source code of wxPython & wxWidgets to
explore if you choose.

In classic the documents are under docs as html files mostly while in
Phoenix you will need to use Sphinx-doc to build the docs and IIRC you
may need doxygen and graphviz installed for that to work.

Have fun!

--
Steve (Gadget) Barnes
Any opinions in this message are my personal opinions and do not reflect
those of my employer.

Tony Cappellini

unread,
Apr 19, 2017, 12:52:10 AM4/19/17
to gadge...@live.co.uk, wxpytho...@googlegroups.com
Thanks Steve


--
You received this message because you are subscribed to a topic in the Google Groups "wxPython-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wxpython-users/T-H1Dbnnb1Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wxpython-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tony Cappellini

unread,
Apr 22, 2017, 10:57:58 PM4/22/17
to wxpytho...@googlegroups.com
Matt

Do you use wxPython on OS X by any chance?
I've installed Phoenix in an Anaconda virtual env, but when I tried running a simple wxPython App,
this was displayed

"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."

I've googled this message, but don't quite understand the problem nor the fix.
Even after I tired one of the fixes, I stall cannot launch a wx app.


thanks

Tony

--
You received this message because you are subscribed to a topic in the Google Groups "wxPython-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wxpython-users/T-H1Dbnnb1Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wxpython-users+unsubscribe@googlegroups.com.

Matt Newville

unread,
Apr 22, 2017, 11:43:20 PM4/22/17
to wxpytho...@googlegroups.com
Hi Tony,



On Sat, Apr 22, 2017 at 9:57 PM, Tony Cappellini <capp...@gmail.com> wrote:
Matt

Do you use wxPython on OS X by any chance?
I've installed Phoenix in an Anaconda virtual env, but when I tried running a simple wxPython App,
this was displayed

"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."

I've googled this message, but don't quite understand the problem nor the fix.
Even after I tired one of the fixes, I stall cannot launch a wx app.


You have to run wxPython programs with "pythonw" to use the Framework build needed for wxWidgets. This is a "known problem" with Anaconda Python, though maybe not known well enough. 

Several people have complained to Continuum about this, including pointing out the fact that python from Python.org and MacPorts build with Mac OSX Frameworks .  
You can read a couple such conversations at
    https://groups.google.com/a/continuum.io/forum/#!searchin/anaconda/wxpython$20osx/anaconda/-ZAynUQW5HQ/L8AeqfMWNWwJ
    https://groups.google.com/a/continuum.io/forum/#!searchin/anaconda/osx$20framework/anaconda/1rX3A1Noi9Q/68MNJWLxupYJ

What's weird is that they do provide a framework build as an App with the "pythonw" shell script to invoke this on OSX.  But this is not the default "python".  When asked why nearly two years ago, the response from Continuum's CTO is:
    https://groups.google.com/a/continuum.io/d/msg/anaconda/1rX3A1Noi9Q/I5xCwR4EnckJ

As you can see, they have known about the problem for more than two years and provide that framework-enabled App, only on Mac OSX, but have not fixed "python". One must assume they have other priorities.

Anyway, use "pythonw".  And every time you do, let it remind you that Anaconda is not Python, but a convenient-to-use-and-free distribution of Python with no obligation to respond to paying or non-paying customers or provide support for every feature request such as "have wxPython work easily on a Mac".

Cheers,

--Matt

Tony Cappellini

unread,
Apr 23, 2017, 12:51:24 AM4/23/17
to wxpytho...@googlegroups.com


Matt,

I did find several of those posts, prior to posting my message.
I did try Pythonw, but nothing changed. This is why I had decided to post the message.
There must be something more to that solution that I could not find.

Thanks


--
You received this message because you are subscribed to a topic in the Google Groups "wxPython-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wxpython-users/T-H1Dbnnb1Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wxpython-user...@googlegroups.com.

Matthew Newville

unread,
Apr 23, 2017, 8:46:14 AM4/23/17
to wxpytho...@googlegroups.com
Hi Tony,


On Apr 22, 2017 11:51 PM, "Tony Cappellini" <capp...@gmail.com> wrote:


Matt,

I did find several of those posts, prior to posting my message.
I did try Pythonw, but nothing changed. This is why I had decided to post the message.
There must be something more to that solution that I could not find.

Thanks


Hm,  that's strange.  I use and distribute wxPython 3 (and now 4) apps with Anaconda for use on OSX.   I have seen this work on dozens of Macs (and many anaconda instances on devel machines) and heard about it working on many more.  I've never seen or heard a report about the Framework error when using pythonw or the version of 'python' in the Python.app. 



To unsubscribe from this group and all its topics, send an email to wxpython-users+unsubscribe@googlegroups.com.

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 wxpython-users+unsubscribe@googlegroups.com.

Tony Cappellini

unread,
Apr 23, 2017, 9:55:53 AM4/23/17
to wxpytho...@googlegroups.com
Invoking pythonw has the same affect as python, so there must be another step involved, that I've missed.

To unsubscribe from this group and all its topics, send an email to wxpython-user...@googlegroups.com.

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 wxpython-user...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "wxPython-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wxpython-users/T-H1Dbnnb1Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wxpython-user...@googlegroups.com.

Matthew Newville

unread,
Apr 23, 2017, 10:28:42 PM4/23/17
to wxpytho...@googlegroups.com
On Apr 23, 2017 8:55 AM, "Tony Cappellini" <capp...@gmail.com> wrote:
Invoking pythonw has the same affect as python, so there must be another step involved, that I've missed.


No idea what that step would be.  I've never seen or heard of that problem.    It's hard to see what could possibly go wrong, since pythonw is a 2 line shell script:

    export PYTHONEXECUTABLE={ANCONDA}/bin/python
    {ANACONDA}/python.app/Contents/MacOS/python "$@"

where {ANACONDA} is the installation directory.    Maybe that gibes a hint of things to try.


Tony Cappellini

unread,
Apr 24, 2017, 12:03:59 AM4/24/17
to wxpytho...@googlegroups.com, matt.n...@gmail.com
OK. I've figured it out.

python script.py works

I had put pythonw on the shebang line, previously, as well as renamed the script to script.pyw.
Neither one worked.

On windows, when I want to run a GUI app without a console window, just simply change the .py to .pyw- DONE.
Python is just much easier on Windows, I don't need to put pythonw in front of the script
but I'm glad this is resolved now.

Thanks Matt.







--
You received this message because you are subscribed to a topic in the Google Groups "wxPython-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/wxpython-users/T-H1Dbnnb1Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to wxpython-users+unsubscribe@googlegroups.com.

cappy2112

unread,
Apr 24, 2017, 2:27:08 PM4/24/17
to wxPython-users, matt.n...@gmail.com, capp...@gmail.com

Grrrr

That should have been:

pythonw script.py 

works now. The GUI is displayed
Reply all
Reply to author
Forward
0 new messages