Install Numpy 1.8 in Travis CI

In my project, I (should) use the function included in Numpy 1.8, but not in earlier versions ( formatter numpy.set_printoptions option).

Since the Travis CI build machines are based on Ubuntu 12.04, by default I only have Numpy 1.6.1 available. Then I tried to install the Numpy-1.8.1-Debian package for Ubuntu 14.04 and its dependencies manually, which led to further problems:

I need to install the libblas3 and liblapack3 packages to install Numpy 1.8, which is not possible if liblapack3gf and libblas3gf (which are by default) are installed on the system, because the packages will break them. If I apt-get remove them, libatlas3gf-base is automatically installed using the same apt-get command (which does not correspond to the standard Ubuntu system, I even install it on my local machine to make sure). If I then try to remove Vlibatlas3gf-baseV, again liblapack3gf and libblas3gf will be automatically installed again.

I don’t know how to deal with this problem, or how to get around this to get Numpy 1.8 to work with Travis. I also tried suggestions for updating Numpy via pip provided here , but this did not work in Travis.

Any help is much appreciated!

Thank you very much!


Decision:

I followed the rth answer to the following .travis.yml file with additional help here and here :

 language: python matrix: include: - python: 2.7 env: NUMPY=1.8 SCIPY=0.13 notifications: email: false before_install: - travis_retry wget http://repo.continuum.io/miniconda/Miniconda-3.8.3-Linux-x86_64.sh -O miniconda.sh - chmod +x miniconda.sh - bash miniconda.sh -b -p $HOME/miniconda - export PATH=/home/travis/miniconda/bin:$PATH - conda update --yes conda install: - conda create --yes -n test python=$TRAVIS_PYTHON_VERSION - source activate test - conda install --yes numpy=$NUMPY scipy=$SCIPY matplotlib pip - pip install setuptools - [ ... some other packages to install ... ] - python setup.py install script: - nosetests 

Now everything works as expected. Please note: you can not import and use PyLab with this setting, see the Comments below for an explanation.

+6
source share
3 answers

Creating scientific python modules from sources (whether compiling directly or using pip ) in a continuous integration stream is slow (15 minutes for numpy, another 15 minutes if you need scipy, etc.), and a waste of resources,

You are better off using a numpy binary distribution, such as the one provided by Anaconda. For Travis CI you can use

 language: python before_script: - wget http://repo.continuum.io/miniconda/Miniconda-3.8.3-Linux-x86_64.sh -O miniconda.sh - chmod +x miniconda.sh - export PATH=/home/travis/miniconda/bin:$PATH - conda install --yes numpy=1.8 

Also consider this more complete installation example for Travis CI.

+3
source

I tried installing Numpy 1.8.2 from pip on the Travis CI and it seemed to work.

Here is the contents of my .travis.yml file:

 language: python before_script: - pip uninstall numpy -y - pip install -I numpy==1.8.2 script: python -c 'import numpy; print numpy.version.version' 

You can see that it successfully prints 1.8.2 in this build log .

Hope this helps!

+2
source

numpy now pre-installed on Travis CI. In rare cases, when the pre-installed version is older than the latest version of numpy , binary versions of numpy are available from PyPI , so there is no need to create numpy in Travis CI.

Excerpt from an example .travis.yml file :

 addons: apt: packages: - gfortran - libatlas-dev - libatlas-base-dev - liblapack-dev - libgmp-dev - libmpfr-dev before_install: - pip install -U --only-binary=numpy,scipy numpy scipy 
0
source

Source: https://habr.com/ru/post/988367/


All Articles