Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using ScikitLearn.jl #412

Closed
yusri-dh opened this issue Sep 11, 2020 · 5 comments
Closed

Error when using ScikitLearn.jl #412

yusri-dh opened this issue Sep 11, 2020 · 5 comments
Labels
other packages Integration with other Julia packages

Comments

@yusri-dh
Copy link

yusri-dh commented Sep 11, 2020

I have an error when import ScikitLearn model.

Here is my code:

begin
	import Pkg
	Pkg.activate(mktempdir())
	Pkg.add("ScikitLearn")
end

using ScikitLearn

@sk_import linear_model: LogisticRegression

when I performed last line of code above, an error occured:

Failed to show value:

PyError ($(Expr(:escape, :(ccall(#= /home/yusri/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'TypeError'>

TypeError("'property' object is not callable")

   pyerr_check@exception.jl:60[inlined]
   pyerr_check@exception.jl:64[inlined]
   _handle_error(::String)@exception.jl:81
   macro expansion@exception.jl:95[inlined]
   #110@pyfncall.jl:43[inlined]
   disable_sigint@c.jl:446[inlined]
   __pycall!@pyfncall.jl:42[inlined]
   _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{}, ::Int64, ::Ptr{Nothing})@pyfncall.jl:29
   _pycall!@pyfncall.jl:11[inlined]
   #pycall#115@pyfncall.jl:80[inlined]
   pycall@pyfncall.jl:80[inlined]
   showable(::MIME{Symbol("text/html")}, ::PyCall.PyObject)@PyCall.jl:894
   #invokelatest#1@essentials.jl:710[inlined]
   invokelatest@essentials.jl:709[inlined]
   #17@PlutoRunner.jl:307[inlined]
   iterate@iterators.jl:431[inlined]
   first@abstractarray.jl:341[inlined]
   |>(::Base.Iterators.Filter{Main.PlutoRunner.var"#17#19"{PyCall.PyObject},Array{MIME,1}}, ::typeof(first))@operators.jl:834
   #show_richest#16(::Bool, ::typeof(Main.PlutoRunner.show_richest), ::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::Any)@PlutoRunner.jl:307
   show_richest(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::Any)@PlutoRunner.jl:307
   #sprint_withreturned#15(::IOContext{Base.PipeEndpoint}, ::Int64, ::typeof(Main.PlutoRunner.sprint_withreturned), ::Function, ::PyCall.PyObject)@PlutoRunner.jl:279
   format_output(::Any)@PlutoRunner.jl:219
   formatted_result_of(::Base.UUID, ::Bool)@PlutoRunner.jl:41
   top-level scope@none:1

The code is working well in my repl.

@Moelf
Copy link
Contributor

Moelf commented Sep 11, 2020

try slap on a ; to suppress output for now, this is indeed a bug

@fonsp fonsp added the other packages Integration with other Julia packages label Sep 11, 2020
@fonsp
Copy link
Owner

fonsp commented Sep 11, 2020

Could you run this notebook and tell us what the outputs/errors were?

begin
	import Pkg
	Pkg.activate(mktempdir())
	Pkg.add("ScikitLearn")
end

using ScikitLearn

x = begin
	@sk_import linear_model: LogisticRegression
end;

Base.invokelatest(showable, MIME"text/plain"(), x)

Base.invokelatest(showable, MIME"text/html"(), x)

Base.invokelatest(showable, MIME"text/latex"(), x)

Base.invokelatest(showable, MIME"application/vnd.pluto.tree+xml"(), x)

Base.invokelatest(showable, MIME"image/png"(), x)

@yusri-dh
Copy link
Author

yusri-dh commented Sep 11, 2020

@fonsp I run your code in Pluto.jl:

Base.invokelatest(showable, MIME"text/plain"(), x)
>true

Base.invokelatest(showable, MIME"text/html"(), x)
>PyError ($(Expr(:escape, :(ccall(#= /home/yusri/.julia/packages/PyCall/zqDXB/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'TypeError'>

TypeError("'property' object is not callable")

    pyerr_check@exception.jl:60[inlined]
    pyerr_check@exception.jl:64[inlined]
    _handle_error(::String)@exception.jl:81
    macro expansion@exception.jl:95[inlined]
    #110@pyfncall.jl:43[inlined]
    disable_sigint@c.jl:446[inlined]
    __pycall!@pyfncall.jl:42[inlined]
    _pycall!(::PyCall.PyObject, ::PyCall.PyObject, ::Tuple{}, ::Int64, ::Ptr{Nothing})@pyfncall.jl:29
    _pycall!@pyfncall.jl:11[inlined]
    #pycall#115@pyfncall.jl:80[inlined]
    pycall@pyfncall.jl:80[inlined]
    showable(::MIME{Symbol("text/html")}, ::PyCall.PyObject)@PyCall.jl:894
    #invokelatest#1(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(Base.invokelatest), ::Any, ::Any, ::Vararg{Any,N} where N)@essentials.jl:710
    invokelatest(::Any, ::Any, ::Vararg{Any,N} where N)@essentials.jl:709
    top-level scope@Local: 1

Base.invokelatest(showable, MIME"text/latex"(), x)
>false

Base.invokelatest(showable, MIME"application/vnd.pluto.tree+xml"(), x)
>false

Base.invokelatest(showable, MIME"image/png"(), x)
>false

@fonsp
Copy link
Owner

fonsp commented Sep 11, 2020

You should open a bug report with ScikitLearn.jl - this is unrelated to Pluto.

Here's the MWE of the bug:

using ScikitLearn

x = begin
	@sk_import linear_model: LogisticRegression
end

showable(MIME"text/html"(), x)

@cstjean
Copy link

cstjean commented Sep 13, 2020

try slap on a ; to suppress output for now, this is indeed a bug

@yusri-dh Does that fix the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
other packages Integration with other Julia packages
Projects
None yet
Development

No branches or pull requests

4 participants