# How to remove PyPlot.jl from the distribution of a package that uses it

**URL:** https://discourse.julialang.org/t/how-to-remove-pyplot-jl-from-the-distribution-of-a-package-that-uses-it/15130
**Category:** Visualization
**Created:** [September 18, 2018, 2:05pm UTC](https://discourse.julialang.org/t/how-to-remove-pyplot-jl-from-the-distribution-of-a-package-that-uses-it/15130 "2018-09-18T14:05:19Z")
**Posts on this page:** 1
**Showing post:** 10

<div class="post-metadata">

### Author: ![MartinOtter](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@MartinOtter](https://discourse.julialang.org/u/MartinOtter)
#### Post date: [October 5, 2018, 5:05pm UTC](https://discourse.julialang.org/t/how-to-remove-pyplot-jl-from-the-distribution-of-a-package-that-uses-it/15130/10 "2018-10-05T17:05:14Z")

</div>

O.k., finally found a solution that seems to work and not producing warning messages:

```julia
module TestPlot2

using Requires
export myplot

myplot(x,y) = println("... myplot(...) ignored, since PyPlot not available")

function __init__ ()
    if !Requires.isprecompiling()  
        @eval Main begin
            try
                import PyPlot
            catch
                println("... PyPlot not available (plot commands will be ignored)")
            end
        end
    end
    
    @require PyPlot = "d330b81b-6aea-500a-939a-2ce795aea3ee" begin
        myplot(x,y) = PyPlot.plot(x,y)
    end
end

end

```

---

_[View the full topic](https://discourse.julialang.org/t/how-to-remove-pyplot-jl-from-the-distribution-of-a-package-that-uses-it/15130)._
