Mktempdir bug

Julia has an issue caused by mktempdir() that prevents precompiling of multiple packages on affected systems. This bug is three or more years old, yet is manifested sporadically, which is probably why it has not been fixed yet. I am looking for some workaround, perhaps, overloading the mktempdir() function, because at present it makes the Julia language unusable on affected computers.

1 Like

This issue is also present in the latest release 1.9.3, same error from libuv.jl:100

Julia is practically unusable on Windows 7 due to this, because it makes it impossible to install many popular packages, such as Images.jl . The issue is still present in 1.9.4 release.

Did you set the environment variable TMPDIR ?

julia> ENV["TMPDIR"] = joinpath(pwd(), "temporary")
"/home/mkitti/temporary"

julia> mkdir(ENV["TMPDIR"])
"temporary"

julia> mktempdir()
"/home/mkitti/temporary/jl_1AnfFW"

Also see GetTempPathW function (fileapi.h) - Win32 apps | Microsoft Learn

So perhaps change the environment variable TMP or TEMP.

Also libuv xref:
https://docs.libuv.org/en/v1.x/misc.html#c.uv_os_tmpdir

That does nothing whatsoever for the precompile error.

Did it change the location of the temporary directory?

No

Try these directions to see if changing the temporary directory location helps:

https://answers.microsoft.com/en-us/windows/forum/all/change-location-of-temp-files-folder-to-another/19f13330-dde1-404c-aa27-a76c0b450818

On what grounds do you expect that changing precompilation directory will make any difference?

The reported error is a file permission issue. Perhaps if you relocate the temporary directory to a directory where you more clearly have file permissions, there might not be a problem deleting the temporary files.

I was inspecting the source code, and there have been changes to this part of the Julia code that may resolve the issue.
In particular, it seems that this function should only warn if there an issue deleting these files. There have also been changes in this area with regard to precompilation.

Could you try the nightly builds and report the stacktrace if the error still occurs?