Skip to content

using PyPlot causes InitError #406

@milankl

Description

@milankl

I've build PyPlot against python version 3.6.4 that I usually use, via ENV["PYTHON"] = /home/...
This python has matplotlib 3.0.0 installed and it works fine. Although building doesn't throw an error, using PyPlot throws

julia> using PyPlot
ERROR: InitError: PyCall.PyError("PyImport_ImportModule\n\nThe Python package matplotlib.pyplot couldnot be found by pyimport

if in the same REPL session I rebuild it, using PyPlot runs through only throwing the

WARNING: using PyPlot.plt in module Main conflicts with an existing identifier.
WARNING: using PyPlot.axes in module Main conflicts with an existing identifier.

warning. However, whenever I try to do something like, I get

julia> plot(randn(300))
ERROR: ArgumentError: haskey of NULL PyObject
Stacktrace:
 [1] haskey(::PyObject, ::String) at /home/kloewer/.julia/packages/PyCall/0jMpb/src/PyCall.jl:310
 [2] #plot#85(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Array{Float64,1}) at /home/kloewer/.julia/packages/PyPlot/fZuOQ/src/PyPlot.jl:176
 [3] plot(::Array{Float64,1}) at /home/kloewer/.julia/packages/PyPlot/fZuOQ/src/PyPlot.jl:176
 [4] top-level scope at none:0

Building PyCall with ENV["PYTHON"] = "" solves the problem, but I find it a bit redundant having two python environments that essentially fulfill the same purpose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions