# Error compiling PyCall

**URL:** <https://discourse.julialang.org/t/error-compiling-pycall/26415>\
**Category:** General Usage\
**Created:** [July 16, 2019, 12:28pm UTC](https://discourse.julialang.org/t/error-compiling-pycall/26415 "2019-07-16T12:28:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Philippe\_Maincon1](https://avatars.discourse-cdn.com/v4/letter/p/ec9cab/32.png) [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Post date:** [July 16, 2019, 12:28pm UTC](https://discourse.julialang.org/t/error-compiling-pycall/26415/1 "2019-07-16T12:28:30Z")

</div>

Hi guys,

I am trying to get started with Matplotlib. My environment is

```julia
versioninfo
versioninfo (generic function with 2 methods)

julia> versioninfo()
Julia Version 1.1.0
Commit 80516ca202 (2019-01-21 21:24 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, haswell)
Environment:
  JULIA_EDITOR = "C:\Users\philippem\AppData\Local\JuliaPro-1.1.0.1\app-1.36.0\atom.exe" -a
  JULIA_NUM_THREADS = 2
  JULIA_PKG_SERVER = https://pkg.juliacomputing.com/
  JULIA_PKG_TOKEN_PATH = C:\Users\philippem\.juliapro\token.toml

```

I am pointing to Julia’s Conda: `ENV["PYTHON"]=""`. The command `Pkg.build("PyCall")` yields

```julia
  Building Conda ─→ `C:\Users\philippem\.juliapro\JuliaPro_v1.1.0.1\packag
  Building PyCall → `C:\Users\philippem\.juliapro\JuliaPro_v1.1.0.1\packag
┌ Error: Error building `PyCall`:
│ ┌ Info: Using the Python distribution in the Conda package by default.
│ └ To use a different Python version, set ENV["PYTHON"]="pythoncommand" a
│ ERROR: LoadError: IOError: could not spawn setenv(`'C:\Users\PHILIP~1\Ap1\packages\PyCall\ttONZ\deps\find_libpython.py' --list-all`,["LINK_HOME=C:BLE_FALLBACK=true", "HOMEPATH=\\Users\\philippem", "VSTO_SUPPRESSDISPLAYALPATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL", "NODEData\\Roaming", "PUBLIC=C:\\Users\\Public", "USERDOMAIN=SINTEFGRP", "OS=Wical\\Temp", "MSMPI_LIB32=C:\\Program Files\\Microsoft HPC Pack 2008 R2\\Li1.1.0.1\\app-1.36.0\\atom.exe\" -a", "ALLUSERSPROFILE=C:\\ProgramData", "hare\\julia\\stdlib\\v1.1\\MbedTLS;C:\\Users\\philippem\\AppData\\Local\\Jr\\bin;C:\\Users\\philippem\\AppData\\Local\\JuliaPro-1.1.0.1\\Julia-1.1.0\JuliaPro-1.1.0.1\\Julia-1.1.0\\share\\julia\\stdlib\\v1.1\\MbedTLS\\deps\Common Files\\Intel\\Shared Libraries\\redist\\intel64\\mpirt;C:\\Program er;C:\\Program Files (x86)\\Common Files\\Intel\\Shared Libraries\\redist\\\redist\\ia32\\compiler;C:\\Program Files\\Microsoft HPC Pack 2008 R2\\BiWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\MATLAB\\R2018b\5a\\bin;C:\\Program Files\\MATLAB\\R2014b\\bin;C:\\Program Files (x86)\\Miver\\100\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\100\\DTS\md;C:\\SIMULIA\\Abaqus\\Commands;C:\\WINDOWS\\System32\\WindowsPowerShell\ram Files (x86)\\PuTTY\\;C:\\Program Files (x86)\\LyX 2.2\\Perl\\bin;C:\\P.0\\;C:\\Program Files\\nodejs\\;C:\\Users\\philippem\\AppData\\Local\\LyXC:\\Users\\philippem\\AppData\\Local\\Continuum\\Anaconda3\\Scripts;C:\\Usal\\Programs\\MiKTeX 2.9\\miktex\\bin\\x64\\;C:\\texlive\\2015\\bin\\win32oaming\\npm", "windows_tracing_logfile=C:\\BVTBin\\Tests\\installpackage\\AME=philippem", "CommonProgramFiles(x86)=C:\\Program Files (x86)\\Common FR13=C:\\Program Files (x86)\\Intel\\Composer XE 2013\\", "INTEL_LICENSE_FIProgram Files\\Microsoft HPC Pack 2008 R2\\Inc\\", "USERPROFILE=C:\\Users\odulePath=C:\\Users\\philippem\\Documents\\WindowsPowerShell\\Modules;C:\\, "VSTO_LOGALERTS=1", "JULIA_PKG_TOKEN_PATH=C:\\Users\\philippem\\.juliaprapro\\JuliaPro_v1.1.0.1\\packages\\PyCall\\ttONZ\\deps", "TERM=xterm-256co\Local\\Temp", "PYTHONIOENCODING=UTF-8", "PYTHON=", "NODE_PATH=C:\\Users\\r\\exports", "LOCALAPPDATA=C:\\Users\\philippem\\AppData\\Local", "PROCESSOF_PROCESSORS=4", "MSMPI_LIB64=C:\\Program Files\\Microsoft HPC Pack 2008 ystemRoot=C:\\WINDOWS", "JULIA_PKG_SERVER=https://pkg.juliacomputing.com/"ALERTS =0", "VS100COMNTOOLS=C:\\Program Files (x86)\\Microsoft Visual StudB8-491d-B8AC-179A1FE1BE77", "JULIA_NUM_THREADS=2", "ProgramFiles(x86)=C:\\es\\Intel\\Shared Libraries\\", "PSExecutionPolicyPreference=Bypass", "JUNNOW_INVENTORY_HOME=C:\\Program Files\\INVENTORYCLIENT", "LOGONSERVER=\\\\S\\OneDrive - SINTEF", "ATOM_HOME=C:\\Users\\philippem\\AppData\\Local\\Julal\\Temp\\jl_6283.tmp", "CommonProgramW6432=C:\\Program Files\\Common FileBLAS_MAIN_FREE=1"]): no such file or directory (ENOENT)
│ Stacktrace:
│ [1] _spawn_primitive(::String, ::Cmd, ::Array{Any,1}) at .\process.jl:
│ [2] #505 at .\process.jl:413 [inlined]
│ [3] setup_stdios(::getfield(Base, Symbol("##505#506")){Cmd}, ::Array{A
│ [4] _spawn at .\process.jl:412 [inlined]
│ [5] #eachline#511(::Bool, ::Function, ::Cmd) at .\process.jl:618
│ [6] eachline at .\process.jl:617 [inlined]
│ [7] #readlines#288 at .\io.jl:414 [inlined]
│ [8] readlines at .\io.jl:414 [inlined]
│ [9] exec_find_libpython at C:\Users\philippem\.juliapro\JuliaPro_v1.1.
│ [10] #find_libpython#3(::typeof(Libdl.dlopen), ::Function, ::String) abuildutils.jl:43
│ [11] find_libpython(::String) at C:\Users\philippem\.juliapro\JuliaPro
│ [12] top-level scope at C:\Users\philippem\.juliapro\JuliaPro_v1.1.0.1
│ [13] include at .\boot.jl:326 [inlined]
│ [14] include_relative(::Module, ::String) at .\loading.jl:1038
│ [15] include(::Module, ::String) at .\sysimg.jl:29
│ [16] include(::String) at .\client.jl:403
│ [17] top-level scope at none:0
│ in expression starting at C:\Users\philippem\.juliapro\JuliaPro_v1.1.0.
└ @ Pkg.Operations C:\Users\julia\AppData\Local\Julia-1.1.0\share\julia\s

```

…which does not make me wise. The only comment I can offer that

```julia
 ERROR: LoadError: IOError: could not spawn setenv(`'C:\Users\PHILIP~1\Ap1\packages\PyCall\ttONZ\deps\find_libpython.py'

```

is strange because the only user on this computer is `philippem`. Which raises the question of how the string `PHILIP~1` appeared.

Launch in 3:45 minutes!!! 😀

Philippe

---

<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:** [July 16, 2019, 2:59pm UTC](https://discourse.julialang.org/t/error-compiling-pycall/26415/2 "2019-07-16T14:59:38Z")

</div>

> [@Philippe\_Maincon1](#):
>
> is strange because the only user on this computer is `philippem` . Which raises the question of how the string `PHILIP~1` appeared.

> **[8.3 filename](https://en.wikipedia.org/wiki/8.3_filename)**
>
> An 8.3 filename (also called a short filename or SFN) is a filename convention used by old versions of DOS and versions of Microsoft Windows prior to Windows 95 and Windows NT 3.5. It is also used in modern Microsoft operating systems as an alternate filename to the long filename, to provide compatibility with legacy programs. The filename convention is limited by the FAT file system. Similar 8.3 file naming schemes have also existed on earlier CP/M, TRS-80, Atari, and some Data General and Di 8....

---

<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:** [July 16, 2019, 4:04pm UTC](https://discourse.julialang.org/t/error-compiling-pycall/26415/3 "2019-07-16T16:04:38Z")

</div>

You could be seeing something similar to [https://github.com/JuliaPy/PyCall.jl/issues/688](https://github.com/JuliaPy/PyCall.jl/issues/688) … somehow, the JuliaPro setup on Windows sometimes want to install Conda into a weird temp directory. You can fix it by doing:

```julia
rm(abspath(first(DEPOT_PATH), "conda", "deps.jl"))

```

and then re-building Conda and PyCall.

(It would be nice if a knowledgable Windows user could reproduce and diagnose this problem.)

---

<div class="post-metadata">

**Author:** ![Philippe\_Maincon1](https://avatars.discourse-cdn.com/v4/letter/p/ec9cab/32.png) [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Post date:** [July 17, 2019, 7:02am UTC](https://discourse.julialang.org/t/error-compiling-pycall/26415/4 "2019-07-17T07:02:08Z")

</div>

> [@stevengj](#):
>
> rm(abspath(first(DEPOT\_PATH), “conda”, “deps.jl”))

GREAT!  
First I agree my issue is probably the same as [JuliaPro installation error spawning "Temp\python.exe" · Issue #688 · JuliaPy/PyCall.jl · GitHub](https://github.com/JuliaPy/PyCall.jl/issues/688) (I _did_ search before posting… not good enough).  
Second, now PyCall compiles, which is bliss - I have been struggling with this for a looooong time!

Unfortunately, I then proceed to the next problem. ENV[“PYTHON”] does not exist, so I am using the default Conda (if I understand). I can Pkg.add, Pkg.update and “using” PyPlot (which is why I needed PyCall). But trying to execute

```julia
x = range(0; stop=2*pi, length=1000); y = sin.(3 * x + 4 * cos.(2 * x));
plot(x, y, color="red", linewidth=2.0, linestyle="--")

```

gives an error

```julia
julia> plot(x,y)
ERROR: ArgumentError: hasproperty of NULL PyObject
Stacktrace:
 [1] pyhasproperty(::PyCall.PyObject, ::String) at C:\Users\philippem\.juliapro\JuliaPro_v1.1.0.1\packages\PyCall\ttONZ\src\PyCall.jl:356
 [2] hasproperty at C:\Users\philippem\.juliapro\JuliaPro_v1.1.0.1\packages\PyCall\ttONZ\src\PyCall.jl:362 [inlined]
 [3] #plot#85(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float4}}, ::Vararg{Any,N} where N) at C:\Users\philippem\.juliapro\JuliaPro_v1.1.0.1\packages\PyPlot\cdCMF\src\PyPlot.jl:174
 [4] plot(::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePrecision{Float64}}, ::Vararg{Any,N} where N) at C:\Users\philippem\.juliapro\JuliaPro_v1.1.0.1\package\PyPlot\cdCMF\src\PyPlot.jl:174
 [5] top-level scope at none:0

```

So… is my installation still faulty (probably…), or am I using PyPlot wrong?

---

<div class="post-metadata">

**Author:** ![Philippe\_Maincon1](https://avatars.discourse-cdn.com/v4/letter/p/ec9cab/32.png) [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Post date:** [July 17, 2019, 10:41am UTC](https://discourse.julialang.org/t/error-compiling-pycall/26415/5 "2019-07-17T10:41:45Z")

</div>

OK, I have been snooping around a bit:  
[https://github.com/JuliaPy/PyPlot.jl/issues/423](https://github.com/JuliaPy/PyPlot.jl/issues/423)  
Inspired by this I get

```julia
julia> PyPlot.PyCall.python
"C:\\Users\\philippem\\AppData\\Local\\Continuum\\Anaconda3\\python.exe"

```

while

```julia
julia> ENV["PYTHON"]
ERROR: KeyError: key "PYTHON" not found
Stacktrace:
 [1] (::getfield(Base, Symbol("##434#435")))(::String) at .\env.jl:76
 [2] access_env(::getfield(Base, Symbol("##434#435")), ::String) at .\env.jl:14
 [3] getindex(::Base.EnvDict, ::String) at .\env.jl:76
 [4] top-level scope at none:0

```

I wish to work with the Conda packaged with JuliaPro. I seem to have messed that up because I tried to connect to Anaconda in an earlier iteration.

How do I get PyPlot to use said Conda? Just set

```julia
PyPlot.PyCall.python = /.../.../Conda/.../Python.exe

```

Or is the procedure different?
