0

Installed julia v0.3.2 into MacOSX 10.9.5 Did

Pkg.add("IJulia")
Pkg.add("PyPlot")

initiate ijulia with:

ipython notebook --profile=julia

This starts an IJulia notebook (it says IJ in the top left.

I enter using pyplot into the first line of iJulia, hit shift enter, and get this:

objc[21233]: Class TKApplication is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined. objc[21233]: Class TKMenu is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined. objc[21233]: Class TKContentView is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined. objc[21233]: Class TKWindow is implemented in both /Library/Frameworks/Tk.framework/Versions/8.5/Tk and /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. Which one is undefined. INFO: Loading help data... Warning: requiring "pyplot" did not define a corresponding module.

OK, so my mac has the tk package installed in two places. If i remove the TK and TCL frameworks from Library/Frameworks, as suggested here: http://michaelwelburn.com/2013/06/07/python-error-conflicting-tk-libraries-and-activetcl/ and here: Python tk framework then I get the following error when I try to start iJulia:

INFO: Loading help data... Warning: requiring "pyplot" did not define a corresponding module.

The other authors said this worked so I am confused.

My /usr/local/bin directory includes these) executables: tclselect tclsh tclsh8.5 tclsh8.6 tclvfse wish wish8.5 wish8.6

I hesitate to remove the system framework. I have the native mac python as well as the anaconda version (which has its own lib/tk) I am at a loss as to the next step.

EDIT: My julia code is this:

using PyPlot

# julia set
# (the familiar mandelbrot set is obtained by setting c==z initially)
function julia(z, c; maxiter=200)
    for n = 1:maxiter
        if abs2(z) > 4
            return n-1
        end
        z = z*z + c
    end
    return maxiter
end

# varying the second argument to julia() tiny amounts results in a stunning variety of forms
@time m = [ uint8(julia(complex(r,i), complex(-.06,.67))) for i=1:-.002:-1, r=-1.5:.002:1.5 ];

# the notebook is able to display ColorMaps
get_cmap("RdGy")

imshow(m, cmap="RdGy", extent=[-1.5,1.5,-1,1])

each line executes fine in iJulia except the last line starting with imshow which gives this error:

PyError (PyObject_Call) <class '_tkinter.TclError'>
TclError('Can\'t find a usable tk.tcl in the following directories: \n    /System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts\n\n/System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts/tk.tcl: version conflict for package "Tk": have 8.5.15, need exactly 8.5.9\nversion conflict for package "Tk": have 8.5.15, need exactly 8.5.9\n    while executing\n"package require -exact Tk  8.5.9"\n    (file "/System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts/tk.tcl" line 20)\n    invoked from within\n"source /System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts/tk.tcl"\n    ("uplevel" body line 1)\n    invoked from within\n"uplevel #0 [list source $file]"\n\n\nThis probably means that tk wasn\'t installed properly.\n',)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/pyplot.py", line 2370, in imshow
    ax = gca()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/pyplot.py", line 701, in gca
    ax =  gcf().gca(**kwargs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/pyplot.py", line 343, in figure
    **kwargs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/backends/backend_tkagg.py", line 80, in new_figure_manager
    window = Tk.Tk()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1764, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)

while loading In[7], in expression starting on line 1

 in pyerr_check at /Users/userme/.julia/v0.3/PyCall/src/exception.jl:58
 in pycall at /Users/userme/.julia/v0.3/PyCall/src/PyCall.jl:85
 in imshow at /Users/userme/.julia/v0.3/PyPlot/src/PyPlot.jl:370
Community
  • 1
  • 1
aquagremlin
  • 3,515
  • 2
  • 29
  • 51
  • First, I don't see any errors there, just warnings (and INFO messages). Is there an actual problem beyond those warnings? – abarnert Nov 18 '14 at 00:55
  • Is your IPython installed to the native Mac Python, or the Anaconda one? – abarnert Nov 18 '14 at 00:57
  • Also, do you have a third Tk (from ActiveTcl or elsewhere) besides the native Mac one and the Anaconda one? If so, how did you install it? – abarnert Nov 18 '14 at 00:59
  • Finally, have you tried using `tclselect 8.6`? I have no idea whether whichever Python you're running cares about that, but if it does, it sounds like you only have one 8.6, while you have two or three 8.5s… – abarnert Nov 18 '14 at 01:00
  • my python was installed to anaconda and my version is 2.3.1---I have no other python installations. – aquagremlin Nov 18 '14 at 01:03
  • Although what I showed is a warning, i get errors later on in my iJulia notebook. my next line is to start calculating a julia set. i'll put that in a separate comment – aquagremlin Nov 18 '14 at 01:05
  • # julia set # (the familiar mandelbrot set is obtained by setting c==z initially) function julia(z, c; maxiter=200) for n = 1:maxiter if abs2(z) > 4 return n-1 end z = z*z + c end return maxiter end – aquagremlin Nov 18 '14 at 01:06
  • # now i calculate m @time m = [ uint8(julia(complex(r,i), complex(-.06,.67))) for i=1:-.002:-1, r=-1.5:.002:1.5 ]; – aquagremlin Nov 18 '14 at 01:07
  • then i enter this: imshow(m, cmap="RdGy", extent=[-1.5,1.5,-1,1]) – aquagremlin Nov 18 '14 at 01:08
  • and i get this error: PyError (PyObject_Call) TclError('Can\'t find a usable tk.tcl in the following directories: \n /System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts\n\n/System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts/tk.tcl: version conflict for package "Tk": have 8.5.15, need exactly 8.5.9\nversion conflict for package "Tk": have 8.5.15, need exactly 8.5.9\n while executing\n"package require -exact Tk 8.5.9"\n ------there is much more to this error but it seems julia is choking on tk. – aquagremlin Nov 18 '14 at 01:10
  • Please don't try to post large amounts of code and errors in comments. First, comments lose all formatting. Second, if they're not in the question, people looking for a question to answer, or for an answer to their similar question, won't see any of that information. Just edit your question. – abarnert Nov 18 '14 at 01:11
  • Anyway, if Anaconda has its own embedded Tk, it really shouldn't be looking at _either_ the /System/Library version or the /Library version. Also, you still haven't answered whether you installed another Tk or not. – abarnert Nov 18 '14 at 01:13
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/65111/discussion-between-aquagremlin-and-abarnert). – aquagremlin Nov 18 '14 at 01:13

2 Answers2

0

I feel so stupid. My problem was the .bash_profile I had these lines

PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH

leftover from a previous python install. I also had a bunch of executables in my /usr/local/bin folder from this old python install. When I deleted the python 2.7 folder before putting in anaconda, I forgot to delete these.

Now the error is gone. I hope this helps someone.

aquagremlin
  • 3,515
  • 2
  • 29
  • 51
0

For the Warning: Warning: requiring "*" did not define a corresponding module. In some cases it helps to check if we use a stable version.

Ran into same issues with 0.38+pre-versions. After switching back to 0.37 stable the issue was gone.

Run into this issue with PyCall: Warning: requiring "PyCall" did not define a corresponding module.

0xmilk_
  • 21
  • 2