# Error installing and use PyPlot in windows 10 x 64 in julia 0.6.1

**URL:** <https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261>\
**Category:** New to Julia\
**Created:** [November 23, 2017, 2:45am UTC](https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261 "2017-11-23T02:45:00Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![leaoshark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leaoshark/32/11462_2.png) [@leaoshark](https://discourse.julialang.org/u/leaoshark)\
**Post date:** [November 23, 2017, 2:45am UTC](https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261/1 "2017-11-23T02:45:00Z")

</div>

Hello … this post is new, any posts have a solution for this problem …

how to fix PyPlot in windows 10 x64 using julia 0.6.1 ?? any topics that i look have a simple solution  
Anyone here uses windows ?

when i pkg add pyplot, this is the error

 ![erro2](https://global.discourse-cdn.com/julialang/original/3X/3/1/31c117986d6f51a1742b2c3e33510bf6bd6b7fe0.jpeg)

and i cannot use this … pkg.build pycall does not solve and many more tries…

who know a specific action to fix it ?

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [November 23, 2017, 7:45am UTC](https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261/2 "2017-11-23T07:45:03Z")

</div>

> [@leaoshark](#):
>
> pkg.build pycall does not solve and many more tries…

I would be useful to see the transcript of what you have tried and how it failed.

Also, please copy-paste terminal output between backticks (```), instead of a screenshot.

---

<div class="post-metadata">

**Author:** ![Daneel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/daneel/32/175_2.png) [@Daneel](https://discourse.julialang.org/u/Daneel)\
**Post date:** [November 23, 2017, 9:16am UTC](https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261/3 "2017-11-23T09:16:16Z")

</div>

Please list your Python installations along with the results of this command in Julia.

```julia
ENV["PYTHON"]

```

---

<div class="post-metadata">

**Author:** ![leaoshark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leaoshark/32/11462_2.png) [@leaoshark](https://discourse.julialang.org/u/leaoshark)\
**Post date:** [November 23, 2017, 11:21am UTC](https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261/4 "2017-11-23T11:21:15Z")

</div>

ERROR: KeyError: key “PYTHON” not found  
Stacktrace:  
[1] access\_env(::Base.##288#289, ::String) at .\env.jl:14  
[2] getindex(::Base.EnvHash, ::String) at .\env.jl:78

---

<div class="post-metadata">

**Author:** ![leaoshark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leaoshark/32/11462_2.png) [@leaoshark](https://discourse.julialang.org/u/leaoshark)\
**Post date:** [November 23, 2017, 11:22am UTC](https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261/5 "2017-11-23T11:22:40Z")

</div>

I TRIED somany things…

installed miniconda external, other command lines…

tell me what to do and i will do it

---

<div class="post-metadata">

**Author:** ![leaoshark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leaoshark/32/11462_2.png) [@leaoshark](https://discourse.julialang.org/u/leaoshark)\
**Post date:** [November 23, 2017, 4:04pm UTC](https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261/7 "2017-11-23T16:04:45Z")

</div>

env python does not work

if i try to plot using pyplot, appears a message of runtime error 6041 and does now show any plot

can i do this ? [Persistent environment variables on Windows « Python recipes « ActiveState Code](http://code.activestate.com/recipes/416087-persistent-environment-variables-on-windows/)

---

<div class="post-metadata">

**Author:** ![leaoshark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leaoshark/32/11462_2.png) [@leaoshark](https://discourse.julialang.org/u/leaoshark)\
**Post date:** [November 24, 2017, 12:18am UTC](https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261/8 "2017-11-24T00:18:20Z")

</div>

if i use this, in the figure, i can have only one plot, not more … can you help ?

![erro2](https://global.discourse-cdn.com/julialang/original/3X/a/9/a9bac6aeb012e69bb40d8b112a172f622325a323.png)

---

<div class="post-metadata">

**Author:** ![Daneel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/daneel/32/175_2.png) [@Daneel](https://discourse.julialang.org/u/Daneel)\
**Post date:** [November 24, 2017, 7:32am UTC](https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261/9 "2017-11-24T07:32:54Z")

</div>

Have you tested that the version of Python you want to use can import matplotlib?

Have you added the PYTHON environmental variable to Windows with the path of that Python? Do it directly through Windows.

---

<div class="post-metadata">

**Author:** ![mzaffalon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzaffalon/32/214168_2.png) [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Post date:** [November 24, 2017, 8:19am UTC](https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261/10 "2017-11-24T08:19:33Z")

</div>

If you read the error message, it says that your `tt` and `s` vectors differ in length: `length(tt)` is 188.

---

<div class="post-metadata">

**Author:** ![leaoshark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leaoshark/32/11462_2.png) [@leaoshark](https://discourse.julialang.org/u/leaoshark)\
**Post date:** [November 24, 2017, 4:15pm UTC](https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261/11 "2017-11-24T16:15:19Z")

</div>

sorry … i have two computers using windows …

in one, i can fix it … but in another, i cant … look

```julia
julia> plot(1:10)
ERROR: ArgumentError: haskey of NULL PyObject
Stacktrace:
 [1] haskey(::PyCall.PyObject, ::String) at C:\Users\Lucas\.julia\v0.6\PyCall\src\PyCall.jl:268
 [2] #plot#85(::Array{Any,1}, ::Function, ::UnitRange{Int64}, ::Vararg{UnitRange{Int64},N} where N) at C:\Users\Lucas\.julia\v0.6\PyPlot\src\PyPlot.jl:169
 [3] plot(::UnitRange{Int64}, ::Vararg{UnitRange{Int64},N} where N) at C:\Users\Lucas\.julia\v0.6\PyPlot\src\PyPlot.jl:169

```

what are this error ?

---

<div class="post-metadata">

**Author:** ![mzaffalon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mzaffalon/32/214168_2.png) [@mzaffalon](https://discourse.julialang.org/u/mzaffalon)\
**Post date:** [November 24, 2017, 9:44pm UTC](https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261/12 "2017-11-24T21:44:23Z")

</div>

What is the sequence of commands you type starting from a new Julia session?

---

<div class="post-metadata">

**Author:** ![leaoshark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leaoshark/32/11462_2.png) [@leaoshark](https://discourse.julialang.org/u/leaoshark)\
**Post date:** [November 27, 2017, 8:29pm UTC](https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261/13 "2017-11-27T20:29:56Z")

</div>

i use atom to do my program …

but when i start julia prompt, i use

using PyPlot

plot(1:10)

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [November 27, 2017, 9:59pm UTC](https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261/14 "2017-11-27T21:59:43Z")

</div>

Note that `ENV["PYTHON"]` only affects _building_ the PyCall package, i.e. when you run `Pkg.build("PyCall")` manually, when PyCall is first added, or when PyCall is upgraded. It doesn’t affect `using PyCall`.

If you run `using PyCall; PyCall.python`, you will see what python it was configured with.

To force PyCall (and hence PyPlot) to use its own Conda installation, which is generally the most reliable thing, especially if you don’t know much about installing stuff, do

```julia
ENV["PYTHON"]=""
Pkg.build("PyCall")

```

(You only need to do this once and it will remember what Python you selected on future upgrades.)

---

<div class="post-metadata">

**Author:** ![Daneel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/daneel/32/175_2.png) [@Daneel](https://discourse.julialang.org/u/Daneel)\
**Post date:** [November 28, 2017, 7:56am UTC](https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261/15 "2017-11-28T07:56:38Z")

</div>

> [@Daneel](#):
>
> Rebuild PyCall or PyPlot to use the new setting, Pkg.build(“PyCall”).

Was my post unclear on that point? It’s good to know that is can be checked after building instead of assuming it’s whatever is in `ENV["PYTHON"]`.

In my experience simply adding PyPlot doesn’t always work in Windows and it somehow often comes down to which python is being used or the environmental variable. Explicitly testing the version of python being pointed to is quite helpful.  
I really should write down the problem and solutions so I could later submit them as a bug reports but I never think about it at the time.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [November 28, 2017, 1:16pm UTC](https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261/16 "2017-11-28T13:16:43Z")

</div>

> [@Daneel](#):
>
> Was my post unclear on that point? It’s good to know that is can be checked after building instead of assuming it’s whatever is in ENV[“PYTHON”].

Your post was unclear because you said that the `PYTHON` variable “must exist”, which is false, that its value indicates the python that PyPlot is currently using, which is false, and setting it in Julia may not work and that you may have to set it globally on your system, which is false.

`ENV["PYTHON"]` does not need to be set at all. If you do set it, you only need to set it during the Julia session where you run `Pkg.build("PyCall")`. If you set it to be `""` then `Pkg.build` will configure PyCall to install/use its own python distro via Conda.jl. It has no effect otherwise.

---

<div class="post-metadata">

**Author:** ![Daneel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/daneel/32/175_2.png) [@Daneel](https://discourse.julialang.org/u/Daneel)\
**Post date:** [November 28, 2017, 1:39pm UTC](https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261/17 "2017-11-28T13:39:45Z")

</div>

I stand corrected. Rather than leave it open for future confusion I’ve flagged the post for deletion.

How does it work with updates to PyCall or PyPlot where they are precompiled again? Does the `ENV["PYTHON"]` set in Julia still apply to future precompilations? What is the precedence between `ENV["PYTHON"]` in Julia and the environmental variables set in Windows?

Your clarification is appreciated.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [November 28, 2017, 1:43pm UTC](https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261/18 "2017-11-28T13:43:17Z")

</div>

> [@Daneel](#):
>
> How does it work with updates to PyCall or PyPlot where they are precompiled again? Does the ENV[“PYTHON”] set in Julia still apply to future precompilations? What is the precedence between ENV[“PYTHON”] in Julia and the environmental variables set in Windows?

The next time you build, if `ENV["PYTHON"]` is not set, it remembers which Python it used in the previous build. If an `ENV["PYTHON"]` is set, that takes precedence.

If you set `ENV["PYTHON"] ="foo"` in a Julia session, it overwrites any value inherited from the surrounding environment (e.g. the system setting) during the currrent session (but it doesn’t change the system setting) — this is how environment variables work.

---

<div class="post-metadata">

**Author:** ![leaoshark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leaoshark/32/11462_2.png) [@leaoshark](https://discourse.julialang.org/u/leaoshark)\
**Post date:** [November 29, 2017, 2:52am UTC](https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261/19 "2017-11-29T02:52:19Z")

</div>

```julia
julia> ENV["PYTHON"] ="foo"
"foo"

julia> Pkg.build("PyCall")
INFO: Building Conda
INFO: Building PyCall
INFO: No system-wide Python was found; got the following error:
could not spawn setenv(`foo -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'))"`,String["USERDOMAIN_ROAMINGPROFILE=LAPTOP-TRHVI6R5", "HOMEPATH=\\Users\\Lucas", "ProgramData=C:\\ProgramData", "ProgramW6432=C:\\Program Files", "PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY;.PYW", "SESSIONNAME=Console", "APPDATA=C:\\Users\\Lucas\\AppData\\Roaming", "PUBLIC=C:\\Users\\Public", "USERDOMAIN=LAPTOP-TRHVI6R5", "OS=Windows_NT", "PROCESSOR_REVISION=9e09", "TMP=C:\\Users\\Lucas\\AppData\\Local\\Temp", "ALLUSERSPROFILE=C:\\ProgramData", "Path=C:\\Users\\Lucas\\AppData\\Local\\Julia-0.6.0\\bin;C:\\Users\\Lucas\\AppData\\Local\\Julia-0.6.0\\bin;C:\\Python35\\;C:\\Python35\\Scripts\\;C:\\python36\\Scripts\\;C:\\python36\\;C:\\Program Files\\Microsoft MPI\\Bin\\;C:\\Program Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS Client\\;C:\\windows\\system32;C:\\windows;C:\\windows\\System32\\Wbem;C:\\windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64\\;C:\\Program Files\\MATLAB\\R2017a\\runtime\\win64;C:\\Program Files\\MATLAB\\R2017a\\bin;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Program Files\\dotnet\\;C:\\Program Files\\Git\\cmd;C:\\Users\\Lucas\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\Lucas\\Downloads\\g95\\bin;C:\\Users\\Lucas\\AppData\\Local\\atom\\bin", "COMPUTERNAME=LAPTOP-TRHVI6R5", "MSMPI_BIN=C:\\Program Files\\Microsoft MPI\\Bin\\", "USERNAME=Lucas", "CommonProgramFiles(x86)=C:\\Program Files (x86)\\Common Files", "CommonProgramFiles=C:\\Program Files\\Common Files", "G95_LIBRARY_PATH=C:\\Users\\Lucas\\Downloads\\g95\\lib\\gcc-lib\\i686-pc-mingw32\\4.1.2;C:\\Users\\Lucas\\Downloads\\g95\\lib", "USERPROFILE=C:\\Users\\Lucas", "PSModulePath=C:\\Program Files\\WindowsPowerShell\\Modules;C:\\windows\\system32\\WindowsPowerShell\\v1.0\\Modules", "PROCESSOR_LEVEL=6", "PhytonPath=C:\\Program Files\\Anaconda3\\", "=C:=C:\\Users\\Lucas\\.julia\\v0.6\\PyCall\\deps", "TEMP=C:\\Users\\Lucas\\AppData\\Local\\Temp", "SystemDrive=C:", "HOMEDRIVE=C:", "PYTHONIOENCODING=UTF-8", "PYTHON=foo", "LOCALAPPDATA=C:\\Users\\Lucas\\AppData\\Local", "PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 158 Stepping 9, GenuineIntel", "NUMBER_OF_PROCESSORS=8", "=::=::\\", "ComSpec=C:\\windows\\system32\\cmd.exe", "VS140COMNTOOLS=C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\", "SystemRoot=C:\\windows", "OneDrive=C:\\Users\\Lucas\\OneDrive", "MOZ_PLUGIN_PATH=C:\\Program Files (x86)\\Foxit Software\\Foxit Reader\\plugins\\", "ProgramFiles(x86)=C:\\Program Files (x86)", "LOGONSERVER=\\\\LAPTOP-TRHVI6R5", "windir=C:\\windows", "FPS_BROWSER_USER_PROFILE_STRING=Default", "CommonProgramW6432=C:\\Program Files\\Common Files", "ProgramFiles=C:\\Program Files", "FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer", "PROCESSOR_ARCHITECTURE=AMD64", "OPENBLAS_MAIN_FREE=1"]): no such file or directory (ENOENT)
using the Python distribution in the Conda package
INFO: PyCall is using C:\Users\Lucas\.julia\v0.6\Conda\deps\usr\python.exe (Python 2.7.13) at C:\Users\Lucas\.julia\v0.6\Conda\deps\usr\python.exe, libpython = C:\Users\Lucas\.julia\v0.6\Conda\deps\usr\python27
INFO: C:\Users\Lucas\.julia\v0.6\PyCall\deps\deps.jl has been updated
INFO: C:\Users\Lucas\.julia\v0.6\PyCall\deps\PYTHON has been updated

julia> using PyPlot
INFO: Recompiling stale cache file C:\Users\Lucas\.julia\lib\v0.6\PyCall.ji for module PyCall.
INFO: Recompiling stale cache file C:\Users\Lucas\.julia\lib\v0.6\PyPlot.ji for module PyPlot.
sys:1: UserWarning:
This call to matplotlib.use() has no effect because the backend has already
been chosen; matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

The backend was *originally* set to u'Qt5Agg' by the following code:
  File "C:\Users\Lucas\.julia\v0.6\Conda\deps\usr\lib\site-packages\matplotlib\backends\ __init__.py", line 14, in <module>
    line for line in traceback.format_stack()

ERROR: InitError: PyError (ccall(@pysym(:PyImport_ImportModule), PyPtr, (Cstring,), name)

The Python package matplotlib.pyplot could not be found by pyimport. Usually this means
that you did not install matplotlib.pyplot in the Python version being used by PyCall.

PyCall is currently configured to use the Julia-specific Python distribution
installed by the Conda.jl package. To install the matplotlib.pyplot module, you can
use `pyimport_conda("matplotlib.pyplot", PKG)`, where PKG is the Anaconda
package the contains the module matplotlib.pyplot, or alternatively you can use the
Conda package directly (via `using Conda` followed by `Conda.add` etcetera).

Alternatively, if you want to use a different Python distribution on your
system, such as a system-wide Python (as opposed to the Julia-specific Python),
you can re-configure PyCall with that Python. As explained in the PyCall
documentation, set ENV["PYTHON"] to the path/name of the python executable
you want to use, run Pkg.build("PyCall"), and re-launch Julia.

) <type 'exceptions.ImportError'>
ImportError(u'Matplotlib qt-based backends require an external PyQt4, PyQt5,\nPySide or PySide2 package to be installed, but it was not found.',)
  File "C:\Users\Lucas\.julia\v0.6\Conda\deps\usr\lib\site-packages\matplotlib\pyplot.py", line 113, in <module>
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
  File "C:\Users\Lucas\.julia\v0.6\Conda\deps\usr\lib\site-packages\matplotlib\backends\ __init__.py", line 60, in pylab_setup
    [backend_name], 0)
  File "C:\Users\Lucas\.julia\v0.6\Conda\deps\usr\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 16, in <module>
    from .backend_qt5 import (
  File "C:\Users\Lucas\.julia\v0.6\Conda\deps\usr\lib\site-packages\matplotlib\backends\backend_qt5.py", line 18, in <module>
    import matplotlib.backends.qt_editor.figureoptions as figureoptions
  File "C:\Users\Lucas\.julia\v0.6\Conda\deps\usr\lib\site-packages\matplotlib\backends\qt_editor\figureoptions.py", line 20, in <module>
    import matplotlib.backends.qt_editor.formlayout as formlayout
  File "C:\Users\Lucas\.julia\v0.6\Conda\deps\usr\lib\site-packages\matplotlib\backends\qt_editor\formlayout.py", line 56, in <module>
    from matplotlib.backends.qt_compat import QtGui, QtWidgets, QtCore
  File "C:\Users\Lucas\.julia\v0.6\Conda\deps\usr\lib\site-packages\matplotlib\backends\qt_compat.py", line 201, in <module>
    "Matplotlib qt-based backends require an external PyQt4, PyQt5,\n"

Stacktrace:
 [1] pyerr_check at C:\Users\Lucas\.julia\v0.6\PyCall\src\exception.jl:56 [inlined]
 [2] pyerr_check at C:\Users\Lucas\.julia\v0.6\PyCall\src\exception.jl:61 [inlined]
 [3] macro expansion at C:\Users\Lucas\.julia\v0.6\PyCall\src\exception.jl:81 [inlined]
 [4] pyimport(::String) at C:\Users\Lucas\.julia\v0.6\PyCall\src\PyCall.jl:374
 [5] __init__ () at C:\Users\Lucas\.julia\v0.6\PyPlot\src\init.jl:189
 [6] _include_from_serialized(::String) at .\loading.jl:157
 [7] _require_from_serialized(::Int64, ::Symbol, ::String, ::Bool) at .\loading.jl:200
 [8] _require(::Symbol) at .\loading.jl:457
 [9] require(::Symbol) at .\loading.jl:398
during initialization of module PyPlot

julia> plot(1:10)
ERROR: UndefVarError: plot not defined

julia> using PyPlot

julia> plot(1:10)
ERROR: ArgumentError: haskey of NULL PyObject
Stacktrace:
 [1] haskey(::PyCall.PyObject, ::String) at C:\Users\Lucas\.julia\v0.6\PyCall\src\PyCall.jl:268
 [2] #plot#85(::Array{Any,1}, ::Function, ::UnitRange{Int64}, ::Vararg{UnitRange{Int64},N} where N) at C:\Users\Lucas\.julia\v0.6\PyPlot\src\PyPlot.jl:169
 [3] plot(::UnitRange{Int64}, ::Vararg{UnitRange{Int64},N} where N) at C:\Users\Lucas\.julia\v0.6\PyPlot\src\PyPlot.jl:169

julia> ENV["PYTHON"]=""
""

julia> using PyPlot

julia> plot(1:10)
ERROR: ArgumentError: haskey of NULL PyObject
Stacktrace:
 [1] haskey(::PyCall.PyObject, ::String) at C:\Users\Lucas\.julia\v0.6\PyCall\src\PyCall.jl:268
 [2] #plot#85(::Array{Any,1}, ::Function, ::UnitRange{Int64}, ::Vararg{UnitRange{Int64},N} where N) at C:\Users\Lucas\.julia\v0.6\PyPlot\src\PyPlot.jl:169
 [3] plot(::UnitRange{Int64}, ::Vararg{UnitRange{Int64},N} where N) at C:\Users\Lucas\.julia\v0.6\PyPlot\src\PyPlot.jl:169

julia>

```

---

<div class="post-metadata">

**Author:** ![leaoshark](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/leaoshark/32/11462_2.png) [@leaoshark](https://discourse.julialang.org/u/leaoshark)\
**Post date:** [November 29, 2017, 2:52am UTC](https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261/20 "2017-11-29T02:52:50Z")

</div>

look my answer

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [November 29, 2017, 3:52am UTC](https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261/21 "2017-11-29T03:52:01Z")

</div>

I’m guessing you have a matplotlibrc configuration file (leftover from some previous installation attempt) that is causing it to default to the qt5agg backend, which is currently not working on Windows IIRC.

Try

```julia
ENV["MPLBACKEND"]="tkagg"
using PyPlot

```

to switch backends to Tk. If this works, fix your `.matplotlibrc` file to change it permanently.

[Next page](https://discourse.julialang.org/t/error-installing-and-use-pyplot-in-windows-10-x-64-in-julia-0-6-1/7261.md?page=2)
