user1438310
user1438310

Reputation: 787

Julia PyPlot segments

This question is related to the already asked question: Julia error using PyPlot - signal (11): Segmentation fault

However, it is not entirely clear to me what the solution there was, or whether even the steps there apply also to my case (I tried them with no effect).

I have been using Julia 4.6 for some time without any problems. I then decided to update my Ubuntu distribution from 14 to 16.04. This is when PyPlot stopped working. I have updated the Julia Packages, and I also did Pkg.build("PyPlot") to no effect. I also run Pkg.test("PyCall") and it passes all tests succesfuly. I also tried the suggestion

ENV["PYTHON"] = ""; Pkg.build("PyPlot")

The situation right now is the following. I can import PyPLot normally:

using PyPlot

This gives me no errors. However, as soon as I invoke any command relating to PyPlot, like:

figure()

I receive the error:

signal (11): Segmentation fault
unknown function (ip: 0x32736)
Segmentation fault (core dumped)

and Julia exits of course.

I don't know if this is relevant, but out of curioustiy I tried the following thing. After starting python in the command line, I do:

import matplotlib.pyplot

which gives me the following error message:

RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 29, in <module>
    import matplotlib.colorbar
  File "/usr/lib/python2.7/dist-packages/matplotlib/colorbar.py", line 34, in <module>
    import matplotlib.collections as collections
  File "/usr/lib/python2.7/dist-packages/matplotlib/collections.py", line 27, in <module>
    import matplotlib.backend_bases as backend_bases
  File "/usr/lib/python2.7/dist-packages/matplotlib/backend_bases.py", line 62, in <module>
    import matplotlib.textpath as textpath
  File "/usr/lib/python2.7/dist-packages/matplotlib/textpath.py", line 15, in <module>
    import matplotlib.font_manager as font_manager
  File "/usr/lib/python2.7/dist-packages/matplotlib/font_manager.py", line 58, in <module>
    from matplotlib import ft2font
ImportError: numpy.core.multiarray failed to import

All help appreciated.

EDIT:

I fixed the problem in python with the import statement by simply uninstalling and reinstalling matplotlib via pip. However, this changed nothing for Julia.

Upvotes: 1

Views: 404

Answers (1)

user1438310
user1438310

Reputation: 787

In the end I managed to solve the problem with the help of a colleague.

I first re-installed matplotlib via pip.

I had to point Julia to the system installed Python:

ENV["PYTHON"]="/usr/bin/python" 

I then rebuilt PyCall and PyPlot:

Pkg.build("PyCall")
Pkg.build("PyPlot")

Restarted Julia and it worked!

Upvotes: 1

Related Questions