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

Unable to add packages in Julia 1.3-RC2 #33382

Closed
pb866 opened this issue Sep 25, 2019 · 16 comments
Closed

Unable to add packages in Julia 1.3-RC2 #33382

pb866 opened this issue Sep 25, 2019 · 16 comments
Labels
packages Package management and loading

Comments

@pb866
Copy link

pb866 commented Sep 25, 2019

When trying to add packages in Julia 1.3-RC2, I get a SystemError (mktemp: No such file or directory) on MacOS. I tried to install several packages and all threw the same error. Also tested it on the latest nightly build (see version info below).

(v1.3) pkg> add DataFrames
 Resolving package versions...
ERROR: SystemError: mktemp: No such file or directory
Stacktrace:
 [1] #systemerror#44(::Nothing, ::typeof(systemerror), ::Symbol, ::Bool) at ./error.jl:134
 [2] systemerror at ./error.jl:134 [inlined]
 [3] #mktemp#16 at ./file.jl:533 [inlined]
 [4] mktemp at ./file.jl:531 [inlined] (repeats 2 times)
 [5] #probe_platform_engines!#15(::Bool, ::typeof(Pkg.PlatformEngines.probe_platform_engines!)) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Pkg/src/PlatformEngines.jl:264
 [6] probe_platform_engines! at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Pkg/src/PlatformEngines.jl:175 [inlined]
 [7] #download_source#73(::Bool, ::typeof(Pkg.Operations.download_source), ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}, ::Dict{Base.UUID,Array{String,1}}) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Pkg/src/Operations.jl:586
 [8] #download_source at ./none:0 [inlined]
 [9] #download_source#72 at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Pkg/src/Operations.jl:581 [inlined]
 [10] download_source at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Pkg/src/Operations.jl:579 [inlined]
 [11] #add#104(::Bool, ::Pkg.BinaryPlatforms.MacOS, ::typeof(Pkg.Operations.add), ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}, ::Array{Base.UUID,1}) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Pkg/src/Operations.jl:986
 [12] #add at ./none:0 [inlined]
 [13] #add#25(::Bool, ::Pkg.BinaryPlatforms.MacOS, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(Pkg.API.add), ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Pkg/src/API.jl:102
 [14] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Pkg/src/API.jl:72
 [15] do_add!(::Dict{Symbol,Any}, ::Array{Pkg.Types.PackageSpec,1}, ::Dict{Symbol,Any}) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Pkg/src/REPLMode.jl:505
 [16] #invokelatest#1(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(Base.invokelatest), ::Any, ::Any, ::Vararg{Any,N} where N) at ./essentials.jl:709
 [17] invokelatest(::Any, ::Any, ::Vararg{Any,N} where N) at ./essentials.jl:708
 [18] do_cmd!(::Pkg.REPLMode.Command, ::REPL.LineEditREPL) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Pkg/src/REPLMode.jl:412
 [19] #do_cmd#23(::Bool, ::typeof(Pkg.REPLMode.do_cmd), ::REPL.LineEditREPL, ::String) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Pkg/src/REPLMode.jl:391
 [20] do_cmd at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Pkg/src/REPLMode.jl:387 [inlined]
 [21] (::Pkg.REPLMode.var"##28#31"{REPL.LineEditREPL,REPL.LineEdit.Prompt})(::REPL.LineEdit.MIState, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Bool) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/Pkg/src/REPLMode.jl:619
 [22] #invokelatest#1 at ./essentials.jl:709 [inlined]
 [23] invokelatest at ./essentials.jl:708 [inlined]
 [24] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/REPL/src/LineEdit.jl:2306
 [25] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/REPL/src/REPL.jl:1045
 [26] run_repl(::REPL.AbstractREPL, ::Any) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.3/REPL/src/REPL.jl:201
 [27] (::Base.var"##774#776"{Bool,Bool,Bool,Bool})(::Module) at ./client.jl:390
 [28] #invokelatest#1 at ./essentials.jl:709 [inlined]
 [29] invokelatest at ./essentials.jl:708 [inlined]
 [30] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:374
 [31] exec_options(::Base.JLOptions) at ./client.jl:312
 [32] _start() at ./client.jl:468

I am using Julia 1.3-RC2 on MacOS Majave.

versioninfo()
Julia Version 1.3.0-rc2.0
Commit a04936e3e0 (2019-09-12 19:49 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.6.0)
  CPU: Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)

Or nightly build:

versioninfo()
Julia Version 1.4.0-DEV.193
Commit 187ee96d83 (2019-09-23 15:15 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
@KristofferC
Copy link
Member

So mktemp() doesn't work for you?

@pb866
Copy link
Author

pb866 commented Sep 25, 2019

I suppose so. I typed mktemp() and got the same error message:

ERROR: SystemError: mktemp: No such file or directory
Stacktrace:
 [1] #systemerror#44(::Nothing, ::typeof(systemerror), ::Symbol, ::Bool) at ./error.jl:142
 [2] #mktemp#18 at ./error.jl:142 [inlined]
 [3] mktemp at ./file.jl:534 [inlined] (repeats 2 times)
 [4] top-level scope at REPL[4]:1

@KristofferC
Copy link
Member

But that works on 1.2?

@pb866
Copy link
Author

pb866 commented Sep 25, 2019

Yes, works on all previous versions (1.2 and prior).

@KristofferC
Copy link
Member

KristofferC commented Sep 25, 2019

If you do

@eval Base.Filesystem begin
function mktemp(parent::AbstractString=tempdir(); cleanup::Bool=true)
    @show b = joinpath(parent, temp_prefix * "XXXXXX")
    @show p = ccall(:mkstemp, Int32, (Cstring,), b) # modifies b
    @show b
    systemerror(:mktemp, p == -1)
    # cleanup && temp_cleanup_later(b)
    return (b, fdio(p, true))
end
end

mktemp()

what does it output on 1.2 vs 1.3-rc2 respectively?

@pb866
Copy link
Author

pb866 commented Sep 25, 2019

v1.2:

julia> @eval Base.Filesystem begin
       function mktemp(parent::AbstractString=tempdir(); cleanup::Bool=true)
           @show b = joinpath(parent, temp_prefix * "XXXXXX")
           @show p = ccall(:mkstemp, Int32, (Cstring,), b) # modifies b
           @show b
           systemerror(:mktemp, p == -1)
           # cleanup && temp_cleanup_later(b)
           return (b, fdio(p, true))
       end
       end
mktemp (generic function with 5 methods)

julia> mktemp()
b = joinpath(parent, temp_prefix * "XXXXXX") = "/var/tmp/jl_XXXXXX"
p = ccall(:mkstemp, Int32, (Cstring,), b) = 21
b = "/var/tmp/jl_0mwOtU"
("/var/tmp/jl_0mwOtU", IOStream(<fd 21>))

v1.3-RC2:

julia> @eval Base.Filesystem begin
       function mktemp(parent::AbstractString=tempdir(); cleanup::Bool=true)
           @show b = joinpath(parent, temp_prefix * "XXXXXX")
           @show p = ccall(:mkstemp, Int32, (Cstring,), b) # modifies b
           @show b
           systemerror(:mktemp, p == -1)
           # cleanup && temp_cleanup_later(b)
           return (b, fdio(p, true))
       end
       end
mktemp (generic function with 4 methods)

julia> mktemp()
b = joinpath(parent, temp_prefix * "XXXXXX") = "/Users/peter/.tmp/jl_XXXXXX"
p = ccall(:mkstemp, Int32, (Cstring,), b) = -1
b = "/Users/peter/.tmp/jl_i0cGAH"
ERROR: SystemError: mktemp: No such file or directory
Stacktrace:
 [1] #systemerror#44(::Nothing, ::typeof(systemerror), ::Symbol, ::Bool) at ./error.jl:134
 [2] #mktemp#22 at ./error.jl:134 [inlined]
 [3] mktemp at ./REPL[1]:3 [inlined] (repeats 2 times)
 [4] top-level scope at REPL[2]:1

@pb866
Copy link
Author

pb866 commented Sep 25, 2019

I think, I just see the problem. There is no folder /Users/peter/, my home folder is called /Users/home/. Any idea, where the wrong home folder comes from? Anything, I could have done to overwrite this and forgot about this? All I did though, downloading the binaries and trying to add packages...

@fredrikekre
Copy link
Member

Looks like it's tempdir() that returns different results, so #31434 is probably related.

@pb866
Copy link
Author

pb866 commented Sep 25, 2019

Yes, you're right:

julia> homedir()
"/Users/home"

julia> tempdir()
"/Users/peter/.tmp"

@KristofferC
Copy link
Member

KristofferC commented Sep 25, 2019

From http://docs.libuv.org/en/v1.x/misc.html

Gets the temp directory. On Windows, uv_os_tmpdir() uses GetTempPathW(). On all other operating systems, uv_os_tmpdir() uses the first environment variable found in the ordered list TMPDIR, TMP, TEMP, and TEMPDIR. If none of these are found, the path “/tmp” is used, or, on Android, “/data/local/tmp” is used.

Do you have one of those temp variables set?

@pb866
Copy link
Author

pb866 commented Sep 25, 2019

I think, I once overwrote tempdir manually, because I had problems with too long folder names, when they were created automatically. I can't remember, how I did it though, I am not very familiar with these things. Where would I overwrite the tempdir?

@KristofferC
Copy link
Member

KristofferC commented Sep 25, 2019

Maybe in .julia/config/startup.jl? Or in your .bashrc or equivalent.

@pb866
Copy link
Author

pb866 commented Sep 25, 2019

Yes, it was an outdated path in my bashrc and my own stupidity. I just wasn't expecting this kind of mistake as everything was working just fine with the previous versions. Thank you a lot for the very fast help. So, I am closing this issue.

@pb866 pb866 closed this as completed Sep 25, 2019
@StefanKarpinski
Copy link
Member

Should we try to create tempdir() if it doesn't exist? I'm not sure that would be a preferable behavior in this situation. We could at least give a clearer error message in the case that it doesn't exist and warn that one of those environment variables is set.

@StefanKarpinski
Copy link
Member

Reopening to discuss handling this situation more gracefully.

@ViralBShah
Copy link
Member

Close?

@ViralBShah ViralBShah added the packages Package management and loading label Mar 14, 2022
@ViralBShah ViralBShah reopened this Sep 6, 2022
@vtjnash vtjnash closed this as completed Feb 10, 2024
N5N3 pushed a commit that referenced this issue Feb 13, 2024
Potential more graceful handling of
#33382. I thought about
creating the directory if it doesn't exist, but that seems aa bit
questionable. Probably better to let the user know about the situation
in a clear way so they can mitigate it. An even better improvement would
be if we could tell them which environment variable to look at. I tried
setting `TEMP` in the environment on macOS but it didn't seem to have
any effect on the result.

---------

Co-authored-by: Jameson Nash <vtjnash@gmail.com>
Co-authored-by: Dilum Aluthge <dilum@aluthge.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages Package management and loading
Projects
None yet
Development

No branches or pull requests

6 participants