Build error on Travis and appveyor - basemap python

Hello,

I have some build error on Travis ans Appveyor related to the use of basemap in my package.

Build error on appveyor

ERROR: LoadError: LoadError: PyError (:PyImport_ImportModule) <type 'exceptions.ImportError'>
ImportError('No module named basemap',)

Same error on Travis.

Here’s the file used for .travis.yml and appveyor.yml.

In those files, I use Pkg.add("Conda"); using Conda; Conda.add("matplotlib"); Conda.add("basemap")'; in before_install code block. Not sure it’s the right way to do it (obviously not!).

Thanks for any hint and help! I musu admit I’m slightly lost with travis and appeveyor commands.

I’ve succeeded by changing the way I was importing the python packages.

Inside the main Module file ClimateTools.jl:

const basemap = PyNULL()
const np = PyNULL()
const mpl = PyNULL()

function __init__()
  copy!(mpl, pyimport_conda("matplotlib", "matplotlib"))
  copy!(basemap, pyimport_conda("mpl_toolkits.basemap", "basemap"))
  copy!(np, pyimport_conda("numpy", "numpy"))
end

Previously it was:

@pyimport mpl_toolkits.basemap as basemap
@pyimport numpy as np

And inside .travil.yml I used:

before_install:
  - julia -e 'Pkg.add("PyCall"); ENV["PYTHON"]=""; Pkg.build("PyCall")'
  - julia -e 'Pkg.add("Conda"); using Conda; Conda.add("matplotlib"); Conda.add("basemap");'

So far so good, the builds are now successful. :slight_smile:

1 Like