Error compiling PyCall

Hi guys,

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

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

  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

 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!!! :grinning:

Philippe

1 Like

You could be seeing something similar to 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:

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.)

GREAT!
First I agree my issue is probably the same as JuliaPro installation error spawning "Temp\python.exe" · Issue #688 · JuliaPy/PyCall.jl · GitHub (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

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> 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?

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

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

while

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

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

Or is the procedure different?