Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BoundsError: attempt to access 1024-element Array{UInt8,1} at index [Base.OneTo(1040)] #746

Closed
adamryczkowski opened this issue Feb 3, 2020 · 1 comment · Fixed by #749

Comments

@adamryczkowski
Copy link

adamryczkowski commented Feb 3, 2020

To reproduce:

  1. Make sure python is available in the current path
  2. See the screenshot:
 $ python
Python 3.7.6 (default, Feb  2 2020, 18:45:16) 
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
 $ which python
/home/Adama-docs/Adam/linux/tmp/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/python-3.7.6-s7ival66jsjhz57vm3wmooik6rkiitwm/bin/python
 $ julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.3.1 (2019-12-30)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> import Pkg

julia> ENV["PYTHON"]="/home/Adama-docs/Adam/linux/tmp/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/python-3.7.6-s7ival66jsjhz57vm3wmooik6rkiitwm/bin/python"
"/home/Adama-docs/Adam/linux/tmp/spack/opt/spack/linux-ubuntu18.04-skylake/gcc-7.5.0/python-3.7.6-s7ival66jsjhz57vm3wmooik6rkiitwm/bin/python"

julia> Pkg.build("PyCall")
  Building Conda ─→ `~/.julia/packages/Conda/kLXeC/deps/build.log`
  Building PyCall → `~/.julia/packages/PyCall/ttONZ/deps/build.log`
false

julia> using PyCall
[ Info: Precompiling PyCall [438e738f-606a-5dbb-bf0a-cddfbfd45ab0]
ERROR: LoadError: LoadError: BoundsError: attempt to access 1024-element Array{UInt8,1} at index [Base.OneTo(1040)]
Stacktrace:
 [1] throw_boundserror(::Array{UInt8,1}, ::Tuple{Base.OneTo{Int64}}) at ./abstractarray.jl:538
 [2] checkbounds at ./abstractarray.jl:503 [inlined]
 [3] copyto!(::Array{UInt8,1}, ::Base.ReinterpretArray{UInt8,1,Int32,Array{Int32,1}}) at ./multidimensional.jl:902
 [4] _preserveas!(::Array{UInt8,1}, ::Type{Cwstring}, ::String) at /home/adam/.julia/packages/PyCall/ttONZ/deps/depsutils.jl:68
 [5] Py_SetPythonHome(::Ptr{Nothing}, ::VersionNumber, ::String) at /home/adam/.julia/packages/PyCall/ttONZ/deps/depsutils.jl:36
 [6] top-level scope at /home/adam/.julia/packages/PyCall/ttONZ/src/startup.jl:49
 [7] include at ./boot.jl:328 [inlined]
 [8] include_relative(::Module, ::String) at ./loading.jl:1105
 [9] include at ./Base.jl:31 [inlined]
 [10] include(::String) at /home/adam/.julia/packages/PyCall/ttONZ/src/PyCall.jl:1
 [11] top-level scope at /home/adam/.julia/packages/PyCall/ttONZ/src/PyCall.jl:41
 [12] include at ./boot.jl:328 [inlined]
 [13] include_relative(::Module, ::String) at ./loading.jl:1105
 [14] include(::Module, ::String) at ./Base.jl:31
 [15] top-level scope at none:2
 [16] eval at ./boot.jl:330 [inlined]
 [17] eval(::Expr) at ./client.jl:425
 [18] top-level scope at ./none:3
in expression starting at /home/adam/.julia/packages/PyCall/ttONZ/src/startup.jl:41
in expression starting at /home/adam/.julia/packages/PyCall/ttONZ/src/PyCall.jl:41
ERROR: Failed to precompile PyCall [438e738f-606a-5dbb-bf0a-cddfbfd45ab0] to /home/adam/.julia/compiled/v1.3/PyCall/GkzkC_fBzCS.ji.
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1283
 [3] _require(::Base.PkgId) at ./loading.jl:1024
 [4] require(::Base.PkgId) at ./loading.jl:922
 [5] require(::Module, ::Symbol) at ./loading.jl:917

julia> 

I have the same error when I try python from conda. I use Ubuntu 18.04.4.

I am also able to reproduce the same error on different machine (also Ubuntu 18.04.4)

@stevengj
Copy link
Member

The _preserveas! here should presumaby resize the buffer as needed.

https://github.com/JuliaPy/PyCall.jl/blob/79d5141bc433bbfd2db22678a58a47a292629a2c/deps/depsutils.jl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants