Giter Site home page Giter Site logo

Comments (25)

stevengj avatar stevengj commented on August 27, 2024

I can't reproduce your error. Can you try updating your Julia build in case this was some bug briefly in git master?

from pyplot.jl.

jtravs avatar jtravs commented on August 27, 2024

I already checked it again on this version:

Julia Version 0.2.0-prerelease+3265
Commit 92b03a5 2013-08-15 06:55:56 UTC
Platform Info:
  System: Linux (x86_64-linux-gnu)
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY)
  LAPACK: libopenblas
  LIBM: libopenlibm

I'll check an even newer build too. Is there any other info that would be helpful?

from pyplot.jl.

stevengj avatar stevengj commented on August 27, 2024

@loladiro, do you have any idea how this could happen? It is very mysterious to me, and unfortunately I cannot reproduce the problem.

from pyplot.jl.

jtravs avatar jtravs commented on August 27, 2024

Some more info. Using the Agg backend doesn't have this problem:

julia> using PyCall
julia> @pyimport matplotlib
julia> matplotlib.use("Agg")
julia> @pyimport pylab as plt
julia> plt.plot([1,2,3])
julia> 1.0
1.0

But using the default backend has the same error:

julia> using PyCall
julia> @pyimport pylab as plt
julia> plt.plot([1,2,3])
julia> 1.0
ERROR: syntax: invalid numeric constant 1.0

Could it be to do with GUI usage? I'm am accesing julia on linux over a ssh connection from a mac. The GUI plots show fine, except for this bug.

from pyplot.jl.

AlexanderFabisch avatar AlexanderFabisch commented on August 27, 2024

I can confirm this error:

julia> using PyPlot

julia> figure()
Figure(PyObject <matplotlib.figure.Figure object at 0x657c810>)

julia> 3.0
ERROR: syntax: invalid numeric constant 3.0

Julia version Version 0.2.0-prerelease+3627, PyPlot commit 7c59b3e, PyCall commit 4f4f9c3.

Calling a function from PyPlot somehow seems to break all numeric constants that contain a '.'. 1e-1 works perfectly. I am working with linux, too.

from pyplot.jl.

stevengj avatar stevengj commented on August 27, 2024

Still can't reproduce. I tried it on OSX and on Debian GNU/Linux with the latest versions of everything.

Which GUI toolkit are you using? (using PyPlot; pygui()) I'm using Qt (PyQt4)

from pyplot.jl.

AlexanderFabisch avatar AlexanderFabisch commented on August 27, 2024

I can't reproduce that with Ubuntu 13.04 (Matplotlib 1.2.1) either. I think it is a problem with the version of matplotlib. Are there any known requirements? Tomorrow I could look up which version I was using when the error occured.

from pyplot.jl.

stevengj avatar stevengj commented on August 27, 2024

Both matplotlib 0.99.3 and matplotlib 1.2 work for me.

from pyplot.jl.

AlexanderFabisch avatar AlexanderFabisch commented on August 27, 2024

I currently have these library versions:

Python: 2.7.3 (default, Apr 10 2013, 06:20:15, GCC 4.6.3)
matplotlib: 1.1.1rc
numpy: 1.6.1
Julia: 0.2.0-prerelease+3627
PyPlot commit 7c59b3e
PyCall commit 4f4f9c3

After upgrading to the current version of matplotlib (from git) this error has been fixed.

from pyplot.jl.

andreasnoack avatar andreasnoack commented on August 27, 2024

I can confirm this. I also get

julia> using PyPlot

julia> figure()
Figure(PyObject <matplotlib.figure.Figure object at 0x109835950>)

julia> 1.0
ERROR: syntax: invalid numeric constant "1.0"

I have

julia> versioninfo()
Julia Version 0.3.0-prerelease+92
Commit 8879168 (2013-11-21 03:42 UTC)
Platform Info:
  System: Darwin (x86_64-apple-darwin13.0.0)
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY)
  LAPACK: libopenblas
  LIBM: libopenlibm

and python 2.7.6 with matplotlib 1.3.1 and Qt4.

from pyplot.jl.

andreasnoack avatar andreasnoack commented on August 27, 2024

Please let me know, If I can provide any further information that might
help you to locate the problem. It is really convenient to be able to use
matplotlib from julia.

2013/11/21 Steven G. Johnson [email protected]

Unfortunately, I still can't reproduce this.


Reply to this email directly or view it on GitHubhttps://github.com//issues/13#issuecomment-29003497
.

Med venlig hilsen

Andreas Noack Jensen

from pyplot.jl.

stevengj avatar stevengj commented on August 27, 2024

Looks like I need to try matplotlib 1.3.1. (I don't suppose you can run it through valgrind or something? This really sounds like some kind of memory bug where something in the Python C API is stomping on Julia memory.)

from pyplot.jl.

dcarrera avatar dcarrera commented on August 27, 2024

For what it's worth, I have the same problem.

julia> using PyPlot
julia> surf( rand(10,10) )
julia> 1.5
ERROR: syntax: invalid numeric constant "1.5"

Julia and PyPlot are brand new from Git. The OS is Ubuntu 13.10, which comes with Matplotlib 1.2.1.

I just installed Matplot 1.3.1 from source to see if that make any difference, but I can't figure out where it is installed or how to get PyPlot to see it. If you happen to know, let me know and I'll test it.

from pyplot.jl.

dcarrera avatar dcarrera commented on August 27, 2024

The "TkAgg" backend seems to work.

julia> using PyCall
julia> @pyimport matplotlib
julia> matplotlib.use("TkAgg")
julia> @pyimport pylab as plt
Warning: imported binding for transpose overwritten in module __anon__

julia> plt.plot([1 2 3 4 5],"ro")
5-element Array{Any,1}:
 PyObject <matplotlib.lines.Line2D object at 0xea36c0c>
 PyObject <matplotlib.lines.Line2D object at 0xea3b24c>
 PyObject <matplotlib.lines.Line2D object at 0xea3b3ec>
 PyObject <matplotlib.lines.Line2D object at 0xea3b54c>
 PyObject <matplotlib.lines.Line2D object at 0xea3b6ac>

julia> 1.0
1.0

julia> plt.show()

julia> 1.0
1.0

So, adding support for TkAgg might be a work-around for PyPlot until better information becomes available. I tried to do this myself, but I got stuck when trying to add an event loop for Tkinter in PyCall.jl.

(1) In PyPlot/src/PyPlot.jl

-    const gui2matplotlib = [ :wx=>"WXAgg", :gtk=>"GTKAgg", :qt=>"Qt4Agg" ]
+    const gui2matplotlib = [ :tk => "TkAgg", :wx=>"WXAgg", :gtk=>"GTKAgg", :qt=>"Qt4Agg" ]
...
-            for g in (:qt, :wx, :gtk)
+            for g in (:tk, :qt, :wx, :gtk)

(2) In PyCall/src/gui.jl

pygui_works(gui::Symbol) = gui == :default ||
-    ((gui == :wx && pyexists("wx")) ||
+    ((gui == :tk && pyexists("Tkinter")) ||
+     (gui == :wx && pyexists("wx")) ||
...
+# TK:
+function tk_eventloop(sec::Real=50e-3)
+    tk = pyimport("Tkinter")
+    #
+    #    ... no idea what to put here ...
+    #
+    install_doevent(doevent, sec)
+end
+
 # GTK:
 function gtk_eventloop(sec::Real=50e-3)
     gtk = pyimport("gtk")
...
 function pygui_start(gui::Symbol=pygui(), sec::Real=50e-3)
     pygui(gui)
     if !haskey(eventloops, gui)
-        if gui == :wx
+        if gui == :tk
+            eventloops[gui] = tk_eventloop(sec)
+        elseif gui == :wx
             eventloops[gui] = wx_eventloop(sec)

from pyplot.jl.

dcarrera avatar dcarrera commented on August 27, 2024

Incidentally, I tested every GUI backend I could find (Gtk, Wx, Qt) and Tkinter was the only one that did not mess up floating point.

from pyplot.jl.

dcarrera avatar dcarrera commented on August 27, 2024

I have a hypothesis: The bug may be restricted to 32-bit systems.

I have tested three computers all running Ubuntu (but not all the same version). Two computers are 64-bit and one computer is 32-bit. The two 64-bit computers work fine. The bug with floats is only observed the 32-bit computer.

Considering the very small sample, it is difficult to make any strong assertions. It would be helpful if other people who experienced this bug could confirm whether they are running 32-bit machines or 64-bit machines. If this is indeed the cause, it would explain why it is so hard to reproduce, as 32-bit computers are now rare. This would also be indicative of a real memory bug in Matplotlib which may still come back later.

This is all speculation, but I think it is worth examining.

from pyplot.jl.

AlexanderFabisch avatar AlexanderFabisch commented on August 27, 2024

I am 90% sure that I used two Ubuntus with 64 bit to reproduce this error. But it is too long ago to be sure. To verify this, someone who can reproduce this error should try the exact same version of matplotlib, python, julia and pyplot on a 32 bit system and a 64 bit system.

from pyplot.jl.

dcarrera avatar dcarrera commented on August 27, 2024

Incidentally, because the problem is restricted to the GUI, you can still use PyPlot with the IJulia notebook.

from pyplot.jl.

stevengj avatar stevengj commented on August 27, 2024

I just found a possible source of this problem. @alanedelman was experiencing segfaults with PyPlot.plot on his machine, and it seemed like the problem was due to:

  • Matplotlib internally calls some BLAS operations (via NumPy) during plot, probably to rescale the data somehow, and these BLAS calls get directed to Julia's OpenBLAS library (since that is already loaded in memory).
  • Julia's OpenBLAS library is compiled with 64-bit indices, which are not the default. Matplotlib apparently passes 32-bit indices. Unpredictable behavior ensues.

Can one of you who is seeing this problem compile Julia with

rm -rf deps/openblas*
make clean
make USE_BLAS64=0

to see if that fixes the problem for you? (It fixed the crash for Alan.)

from pyplot.jl.

stevengj avatar stevengj commented on August 27, 2024

See also JuliaLang/julia#4923

from pyplot.jl.

andreasnoack avatar andreasnoack commented on August 27, 2024

I have just tried your fix but unfortunately it doesn't help. I still get the same error.

Unfortunately Valgrind from brew doesn't work with newer OS Xs and I don't get the error on my Ubuntu machine.

from pyplot.jl.

dcarrera avatar dcarrera commented on August 27, 2024

I just tried it too. The error remains. :-(

from pyplot.jl.

andreasnoack avatar andreasnoack commented on August 27, 2024

I have switched Linux distribution and now I can reproduce this on Linux. I have posted the output from Valgrind here

from pyplot.jl.

ufechner7 avatar ufechner7 commented on August 27, 2024

Same problem here. Ubuntu 12.04 64 bit. I already deleted openblas, that I used for NumPy before and downgraded numpy to 1.7.1, but the problem persists.

from pyplot.jl.

ufechner7 avatar ufechner7 commented on August 27, 2024

I tried it in a virtual machine (VirtualBox) with the same OS and it works. When I start Julia or load numpy I get the message:
OpenBLAS : Your OS does not support AVX instructions. OpenBLAS is using Nehalem kernels as a fallback, which may give poorer performance.

Can this be related to this bug?

from pyplot.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.