3

I'm trying to add some wxPython tests to work with travis-ci, but I can't figure out how to install wxPython in the build environment. I used brew to install wxPython on my computer, but I can't get brew to work with travis-ci. In the travis-ci docs, it appears that brew should come built-in: http://docs.travis-ci.com/user/installing-dependencies/#Installing-Mac-Packages, but as far as I can tell it doesn't. If I try to use brew, I get this error message:

$ brew update
/home/travis/build.sh: line 41: brew: command not found

Here are some other things I've tried in my .travis.yml file to get brew/wxPython:

- ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Produced this error message:

The command "ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"" failed and exited with 1 during .

I then tried:

- mkdir homebrew && curl -L https://github.com/Homebrew/homebrew/tarball/master | tar xz --strip 1 -C homebrew
- brew install wxpython

which gave me:

The command "brew install wxpython" failed and exited with 127 during .

I also tried to install wxPython directly this way:

- sudo apt-get update -qq                                                                         
- sudo apt-get install -qq libgtk2.0-dev libgtkglextmm-x11-1.2-dev libgtkmm-2.4-dev               
- sudo apt-get install python-dev                                                                 
- sudo apt-get install libboost-python-dev libboost-signals-dev                                   
- sudo apt-get install libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev                     
- wget http://sourceforge.net/projects/wxpython/files/wxPython/2.9.4.0/wxPython-src-2.9.4.0.tar.b\z2                                                                                                   
- tar xf wxPython-src-2.9.4.0.tar.bz2                                                             
- cd wxPython-src-2.9.4.0/                                                                        
- wget http://sourceforge.net/projects/wxpython/files/wxPython/2.9.4.0/wxPython-src-2.9.4.1.patch
- patch -p0 < wxPython-src-2.9.4.1.patch                                                          
- cd wxPython/                                                                                    
## fails at this step:                                                                                    
- python build-wxpython.py --build_dir=../bld                                                     
- cd ..                                                                                           
- export PYTHONPATH="$PWD/wxPython"                                                               
- export LD_LIBRARY_PATH="$PWD/bld/lib"                                                           
- cd .. 

which gave this error message:

g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
make: *** [.pch/wxprec_coredll/wx/wxprec.h.gch] Error 4
make: *** Waiting for unfinished jobs....
make: *** [.pch/wxprec_mediadll/wx/wxprec.h.gch] Error 4
make: *** [.pch/wxprec_auidll/wx/wxprec.h.gch] Error 4
make: *** [.pch/wxprec_richtextdll/wx/wxprec.h.gch] Error 4
make: *** [.pch/wxprec_gldll/wx/wxprec.h.gch] Error 4
make: *** [.pch/wxprec_stcdll/wx/wxprec.h.gch] Error 4
Error building
ERROR: failed building wxWidgets
Traceback (most recent call last):
File "build-wxpython.py", line 378, in <module>
wxbuild.main(wxscript, build_options)
File "/home/travis/build/ltauxe/PmagPy/wxPython-src2.9.4.0/build/tools/build-wxwidgets.py", line 470, in main
exitIfError(wxBuilder.build(dir=buildDir, options=args), "Error building")
File "/home/travis/build/ltauxe/PmagPy/wxPython-src-2.9.4.0/build/tools/build-wxwidgets.py", line 74, in exitIfError
raise builder.BuildError(msg)
BuildError
The command "python build-wxpython.py --build_dir=../bld" failed and exited with 1 during .

You can look at my .travis.yml file here: https://github.com/ltauxe/PmagPy/blob/travis-ci/.travis.yml

Ultimately, I just want wxPython, and I don't care how I get it. Any suggestions on getting wxPython to work with travis-ci would be appreciated, or insight into why I can't get brew to work. Thanks!

edit:

I've tried something new and added this line to my .travis.yml file:

- sudo apt-get install -y python-wxgtk2.8

This seems to install wxpython successfully, but then the testing stalls with this error message:

if warn: warnings.warn(_use_error_msg)
Xlib:  extension "RANDR" missing on display ":99.0".

And the testing times out.

J Jones
  • 3,060
  • 4
  • 26
  • 43

2 Answers2

3

I've been trying to do the same thing for quite some time. Here's what I've found:

Travis-CI:

One of the reasons things are a little difficult is that Travis-CI is running Ubunutu 12.04, and wxPython only has pre-built binaries up to 11.04. Another reason was that some ubuntu packages were disallowed on travis (though they have since been whitelisted).


Python 2 and wxPython 2.8:

This one is pretty easy, since it's in the ubuntu apt repositories. Have the following in your .travis.yml file:

addons:
  apt:
    packages:
      # for wxPython:
      - python-wxgtk2.8
      - python-wxtools
      - wx2.8-doc
      - wx2.8-examples
      - wx2.8-headers
      - wx2.8-i18n

Source


For Python 2 and wxPython 3.0 (classic, not Phoenix):

You can use Conda to install it wxPython. Here's the relevent portion of .travis.yml:

before_install:
  # get Conda
  - if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
      wget https://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh;
    else
      wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
    fi
  - bash miniconda.sh -b -p $HOME/miniconda
  - export PATH="$HOME/miniconda/bin:$PATH"
  - hash -r
  - conda config --set always_yes yes --set changeps1 no
  - conda update -q conda
  # Useful for debugging any issues with conda
  - conda info -a

install:
  # install wxPython 3.0.0.0
  - conda install -c https://conda.anaconda.org/travis wxpython

(I personally like it in before_install, but you could also put this towards the top of install).

Source


For Python 3 and wxPython Phoenix 3.0:

I've so far been unsuccessful with this. I've tried:

  • building from source using the build/build.py script provided by wxPython
  • building from source in the standard linux way (configure, make, make install)
  • using conda
  • pip install --upgrade --pre --trusted-host wxpython.org -vvv -f http://wxpython.org/Phoenix/snapshot-builds/ wxPython_Phoenix

    • note the -vvv on pip: since the build takes ~20 minutes, Travis will abort if there's no console output (it assumes the cmd has locked up). Adding verbosity prevents that abort from happening.

and none of them have worked completely. Some got further than others: for example, installing via pip appears to get through the wxWidgets configure and make just fine, but fails somewhere in the SIP build (it also takes 20 minutes...)

Hopefully I figure it out soon.


Appveyor:

I know you only asked about Travis, but I use Travis + AppVeyor to cover all operating systems so I figured others do the same. Might as well keep all the info in one place.

These are much, much easier. Simply find a pre-built wheel file for the version of wxPython that you want and install it with pip:

- "%CMD_IN_ENV% pip install --upgrade --pre http://wxpython.org/Phoenix/snapshot-builds/wxPython_Phoenix-3.0.3.dev1820+49a8884-cp34-none-win32.whl"
Community
  • 1
  • 1
dthor
  • 1,749
  • 1
  • 18
  • 45
  • this is 2 years old... did you succed by anychance? – Trebia Project. Aug 10 '17 at 22:14
  • @TrebiaProject. Sadly no, I was never able to make it work. However, there are Windows and MacOS wheel on PyPI for wxPython Phoenix now so at least those two are easy to install now. And as I just saw below, there are Linux wheels available in the snapshot builds. – dthor Aug 21 '17 at 15:54
2

For newer versions of wxpython you will need to install using pip and the wheel file. There are some pre-builds avaialble in this location: https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-14.04/

The travis file that worked for me is:

language: python
python:
  - "3.5.3"

addons:
  apt:
    packages:
    - libwebkitgtk-dev
    - libjpeg-dev
    - libtiff-dev
    - libgtk2.0-dev
    - libsdl1.2-dev
    - libgstreamer-plugins-base0.10-dev
    - freeglut3
    - freeglut3-dev
    - libnotify-dev

# command to install dependencies
install: 
  - sudo apt-get update
  - wget "https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-14.04/wxPython-4.0.0b1-cp35-cp35m-linux_x86_64.whl"
  - pip install wxPython-4.0.0b1-cp35-cp35m-linux_x86_64.whl 

script: nosetests -v --with-id  --with-coverage --with-html --cover-package=./

Notice that the location for whl files are:

Trebia Project.
  • 930
  • 2
  • 17
  • 36
  • Those are prerelease snapshot builds. Release builds for some linux distros can be found here: https://extras.wxpython.org/wxPython4/extras/linux/ – RobinDunn Aug 15 '17 at 17:54
  • @RobinDunn thanks for the hint, I tested in my project following your suggestions to double check and updated the post, so anyone looking for this one will have the right information. Quick question, I am struggling now with the DISPLAY in order to be able to test in batch (is ok in my computer), do you know how can I make it? (https://stackoverflow.com/questions/45665315/testing-in-batch-a-wxpython-gui-python) Thanks! – Trebia Project. Aug 15 '17 at 19:49