PyCall.jl
PyCall.jl copied to clipboard
Build error on Raspberry Pi
I'm trying to use PyCall on a Raspberry Pi...
Currently I'm getting these errors from these commands:
(v1.2) pkg> build PyCall
Building Conda ─→ `~/.julia/packages/Conda/kLXeC/deps/build.log`
Building PyCall → `~/.julia/packages/PyCall/ttONZ/deps/build.log`
┌ Error: Error building `PyCall`:
│ Traceback (most recent call last):
│ File "<string>", line 1, in <module>
│ ModuleNotFoundError: No module named 'distutils.sysconfig'
│ ERROR: LoadError: No system-wide Python was found; got the following error:
│ ProcessFailedException(Base.Process[Process(setenv(`python3 -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'))"`,["TEXTDOMAIN=Linux-PAM", "XDG_SESSION_CLASS=user", "PWD=/home/pi", "XDG_SESSION_TYPE=tty", "SHLVL=1", "LANG=en_GB.UTF-8", "PATH=/home/pi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games", "NO_AT_BRIDGE=1", "DISPLAY=localhost:10.0", "OPENBLAS_MAIN_FREE=1", "LOGNAME=pi", "SSH_CONNECTION=192.168.0.131 50202 192.168.0.143 22", "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus", "XDG_SESSION_ID=c2", "SSH_CLIENT=192.168.0.131 50202 22", "_=/usr/local/bin/julia", "XDG_RUNTIME_DIR=/run/user/1000", "MAIL=/var/mail/pi", "LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:", "TERM=xterm", "USER=pi", "SHELL=/bin/bash", "HOME=/home/pi", "JULIA_LOAD_PATH=@:/tmp/jl_i1EZEh", "SSH_TTY=/dev/pts/0", "PYTHONIOENCODING=UTF-8"]), ProcessExited(1))])
│ Stacktrace:
│ [1] error(::String, ::String) at ./error.jl:42
│ [2] top-level scope at /home/pi/.julia/packages/PyCall/ttONZ/deps/build.jl:77
│ [3] include at ./boot.jl:328 [inlined]
│ [4] include_relative(::Module, ::String) at ./loading.jl:1094
│ [5] include(::Module, ::String) at ./Base.jl:31
│ [6] include(::String) at ./client.jl:431
│ [7] top-level scope at none:5
│ in expression starting at /home/pi/.julia/packages/PyCall/ttONZ/deps/build.jl:43
│ caused by [exception 1]
│ failed process: Process(setenv(`python3 -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'))"`,["TEXTDOMAIN=Linux-PAM", "XDG_SESSION_CLASS=user", "PWD=/home/pi", "XDG_SESSION_TYPE=tty", "SHLVL=1", "LANG=en_GB.UTF-8", "PATH=/home/pi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games", "NO_AT_BRIDGE=1", "DISPLAY=localhost:10.0", "OPENBLAS_MAIN_FREE=1" … "XDG_RUNTIME_DIR=/run/user/1000", "MAIL=/var/mail/pi", "LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:", "TERM=xterm", "USER=pi", "SHELL=/bin/bash", "HOME=/home/pi", "JULIA_LOAD_PATH=@:/tmp/jl_i1EZEh", "SSH_TTY=/dev/pts/0", "PYTHONIOENCODING=UTF-8"]), ProcessExited(1)) [1]
│
│ Stacktrace:
│ [1] pipeline_error at ./process.jl:813 [inlined]
│ [2] read(::Cmd) at ./process.jl:700
│ [3] read(::Cmd, ::Type{String}) at ./process.jl:709
│ [4] pyvar(::String, ::String, ::String) at /home/pi/.julia/packages/PyCall/ttONZ/deps/buildutils.jl:6
│ [5] pyconfigvar at /home/pi/.julia/packages/PyCall/ttONZ/deps/buildutils.jl:8 [inlined]
│ [6] pyconfigvar(::String, ::String, ::String) at /home/pi/.julia/packages/PyCall/ttONZ/deps/buildutils.jl:9
│ [7] top-level scope at /home/pi/.julia/packages/PyCall/ttONZ/deps/build.jl:45
│ [8] include at ./boot.jl:328 [inlined]
│ [9] include_relative(::Module, ::String) at ./loading.jl:1094
│ [10] include(::Module, ::String) at ./Base.jl:31
│ [11] include(::String) at ./client.jl:431
│ [12] top-level scope at none:5
└ @ Pkg.Operations /buildworker/worker/package_linuxarmv7l/build/usr/share/julia/stdlib/v1.2/Pkg/src/backwards_compatible_isolation.jl:647
and...
julia> ENV["PYTHON"] = ""
""
(v1.2) pkg> build PyCall
Building Conda ─→ `~/.julia/packages/Conda/kLXeC/deps/build.log`
Building PyCall → `~/.julia/packages/PyCall/ttONZ/deps/build.log`
┌ Error: Error building `PyCall`:
│ ERROR: LoadError: No system-wide Python was found; got the following error:
│ UseCondaPython()
│ Stacktrace:
│ [1] error(::String, ::String) at ./error.jl:42
│ [2] top-level scope at /home/pi/.julia/packages/PyCall/ttONZ/deps/build.jl:77
│ [3] include at ./boot.jl:328 [inlined]
│ [4] include_relative(::Module, ::String) at ./loading.jl:1094
│ [5] include(::Module, ::String) at ./Base.jl:31
│ [6] include(::String) at ./client.jl:431
│ [7] top-level scope at none:5
│ in expression starting at /home/pi/.julia/packages/PyCall/ttONZ/deps/build.jl:43
│ caused by [exception 1]
│ UseCondaPython()
│ Stacktrace:
│ [1] top-level scope at /home/pi/.julia/packages/PyCall/ttONZ/deps/build.jl:51
│ [2] include at ./boot.jl:328 [inlined]
│ [3] include_relative(::Module, ::String) at ./loading.jl:1094
│ [4] include(::Module, ::String) at ./Base.jl:31
│ [5] include(::String) at ./client.jl:431
│ [6] top-level scope at none:5
└ @ Pkg.Operations /buildworker/worker/package_linuxarmv7l/build/usr/share/julia/stdlib/v1.2/Pkg/src/backwards_compatible_isolation.jl:647
and finally:
julia> using Conda
[ Info: Recompiling stale cache file /home/pi/.julia/compiled/v1.2/Conda/WZE3U.ji for Conda [8f4d0f93-b110-5947-807f-2305c1781a2d]
julia> Conda.add("numpy")
[ Info: Downloading miniconda installer ...
[ Info: Installing miniconda ...
PREFIX=/home/pi/.julia/conda/3
reinstalling: python-3.7.1-h0371630_7 ...
/home/pi/.julia/conda/3/installer.sh: 373: /home/pi/.julia/conda/3/installer.sh: /home/pi/.julia/conda/3/pkgs/python-3.7.1-h0371630_7/bin/python: Exec format error
ERROR: failed process: Process(`/home/pi/.julia/conda/3/installer.sh -b -f -p /home/pi/.julia/conda/3`, ProcessExited(1)) [1]
I am experiencing the exact same issue ... BUT if I install Pyhton myself it is working :) "sudo apt-get install python3"; in Julia: ENV["PYTHON"] ="/usr/bin/python3"; Pkg.build("PyCall").
So the problem is acutally comming from Conda.jl not being able to install Minicoda. PyCall works just fine.
Another hint for orthers using a RaspberryPi: berryconda is another alternative to the python environment provided by Devian. I had some troubles e.g. installing oct2py using pip but it work just fine using berryconda. I can recommend using berryconda together with PyCall.jl
Just another option:
$ sudo apt-get install python3-distutils
fixed it for me.
Switching Conda.jl to use Miniforge as explained in https://github.com/JuliaPy/Conda.jl#using-miniforge makes PyCall error instead of building:
Error building `PyCall`:
ERROR: LoadError: No system-wide Python was found; got the following error:
UseCondaPython()
Stacktrace:
[1] error(::String, ::String)
@ Base ./error.jl:42
[2] top-level scope
@ ~/.julia/packages/PyCall/BD546/deps/build.jl:77
[3] include(fname::String)
@ Base.MainInclude ./client.jl:444
[4] top-level scope
@ none:5
in expression starting at /home/aaron/.julia/packages/PyCall/BD546/deps/build.jl:43
caused by: UseCondaPython()
Stacktrace:
[1] top-level scope
@ ~/.julia/packages/PyCall/BD546/deps/build.jl:51
[2] include(fname::String)
@ Base.MainInclude ./client.jl:444
[3] top-level scope