# Is there any way to check the installation time of a package?

**URL:** <https://discourse.julialang.org/t/is-there-any-way-to-check-the-installation-time-of-a-package/100509>\
**Category:** General Usage\
**Tags:** question, package\
**Created:** [June 18, 2023, 7:54am UTC](https://discourse.julialang.org/t/is-there-any-way-to-check-the-installation-time-of-a-package/100509 "2023-06-18T07:54:07Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![WuSiren](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wusiren/32/42529_2.png) [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Post date:** [June 18, 2023, 7:54am UTC](https://discourse.julialang.org/t/is-there-any-way-to-check-the-installation-time-of-a-package/100509/1 "2023-06-18T07:54:07Z")

</div>

I can’t remember under what circumstance I installed a certain package. Is there any way to check its installation time to help me recall that? Besides, when the number of packages grows is there any good solution to managing them? For example, can I add some custom comments for each package?

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [June 18, 2023, 8:07am UTC](https://discourse.julialang.org/t/is-there-any-way-to-check-the-installation-time-of-a-package/100509/2 "2023-06-18T08:07:01Z")

</div>

If you manage your code in a git repository, the git history and commit messages answer your questions affirmatively

---

<div class="post-metadata">

**Author:** ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Post date:** [June 18, 2023, 8:18am UTC](https://discourse.julialang.org/t/is-there-any-way-to-check-the-installation-time-of-a-package/100509/3 "2023-06-18T08:18:14Z")

</div>

If you isolate each project you work into his own environment (simple and “cheap” in Julia) you can comment on the Project.toml file to add a note on why/when you installed (added) a certain package, but the project file doesn’t track automatically the installation date.

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [June 18, 2023, 3:29pm UTC](https://discourse.julialang.org/t/is-there-any-way-to-check-the-installation-time-of-a-package/100509/4 "2023-06-18T15:29:35Z")

</div>

Things you can do:

- go through the REPL history and search for add ThatPkg
- look in your .julia folder when the folder for that package was created

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [June 18, 2023, 4:05pm UTC](https://discourse.julialang.org/t/is-there-any-way-to-check-the-installation-time-of-a-package/100509/5 "2023-06-18T16:05:37Z")

</div>

> [@sylvaticus](#):
>
> If you isolate each project you work into his own environment (simple and “cheap” in Julia)

This is the most important answer. Julia packages are not meant to be installed in your base environment `@v1.9`. Instead you should probably use one environment per project, as described in the (very read-worthy) [documentation of Pkg.jl](https://pkgdocs.julialang.org/v1/).

As an additional thought, Julia developers frequently load packages with `using MyPackage`, which is not a great idea because it puts every package export into the namespace, the same way `from mypackage import *` behaves in Python. If you want to keep track of why you use a certain package, a good habit is to always document which functions and types you take from which package: `using MyPackage: Type1, Type2, fun1, fun2, fun3`

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [June 18, 2023, 4:30pm UTC](https://discourse.julialang.org/t/is-there-any-way-to-check-the-installation-time-of-a-package/100509/6 "2023-06-18T16:30:49Z")

</div>

Check your `.julia/logs` folder. In particular `.julia/logs/repl_history.jl`.

Here’s an utility function to search through it.

```julia
julia> using REPL

julia> function search_repl_hist(query, mode = r".*")
           replhist = REPL.find_hist_file()
           time_line = ""
           mode_line = ""
           result = String[]
           for line in eachline(replhist)
               if startswith(line, "# time")
                   time_line = line
               elseif startswith(line, "# mode")
                   mode_line = line
               elseif contains(line, query)
                   if contains(mode_line, mode) 
                       push!(result, time_line)
                       push!(result, mode_line)
                       push!(result, line)
                   end
               end
           end
           result .|> println
           result
       end

```

Here’s how to use it.

```julia
julia> search_repl_hist("Interpolations");
# time: 2022-06-29 02:29:02 EDT
# mode: julia
	        itp = Interpolations.GriddedInterpolation{
# time: 2022-06-29 02:29:24 EDT
# mode: julia
	        itp = Interpolations.GriddedInterpolation{
# time: 2022-06-29 02:29:42 EDT
# mode: julia
	import Interpolations: tcollect, itpflag, dimension_wis_vec, coefficients, value_weights, shape, tail
# time: 2022-06-29 02:30:21 EDT
# mode: julia
	        itp = Interpolations.GriddedInterpolation{

julia> search_repl_hist(r"^\s+add Interpolations", "pkg");
# time: 2020-04-15 14:40:06 CDT
# mode: pkg
	add Interpolations
# time: 2020-06-17 14:29:14 CDT
# mode: pkg
	add Interpolations

```

---

<div class="post-metadata">

**Author:** ![WuSiren](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wusiren/32/42529_2.png) [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Post date:** [June 19, 2023, 5:25am UTC](https://discourse.julialang.org/t/is-there-any-way-to-check-the-installation-time-of-a-package/100509/7 "2023-06-19T05:25:27Z")

</div>

Thanks! That’s a good idea!

---

<div class="post-metadata">

**Author:** ![WuSiren](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wusiren/32/42529_2.png) [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Post date:** [June 19, 2023, 5:40am UTC](https://discourse.julialang.org/t/is-there-any-way-to-check-the-installation-time-of-a-package/100509/8 "2023-06-19T05:40:10Z")

</div>

> [@gdalle](#):
>
> This is the most important answer. Julia packages are not meant to be installed in your base environment . `@v1.9`Instead you should probably use one environment per project, as described in the (very read-worthy) [documentation of Pkg.jl](https://pkgdocs.julialang.org/v1/).

Thanks! I am just planning to learn how to manage different environments in Julia. Hope it helps.

---

<div class="post-metadata">

**Author:** ![WuSiren](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wusiren/32/42529_2.png) [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Post date:** [June 19, 2023, 5:46am UTC](https://discourse.julialang.org/t/is-there-any-way-to-check-the-installation-time-of-a-package/100509/9 "2023-06-19T05:46:30Z")

</div>

Thanks!

Do you know the correct encoding for `.julia/logs/repl_history.jl`? It shows garbled code:

```julia
# time: 2023-05-26 14:18:18 ÖÐ¹ú±ê×¼Ê±¼ä
# mode: pkg
	add StableRNGs

```

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [June 19, 2023, 6:39am UTC](https://discourse.julialang.org/t/is-there-any-way-to-check-the-installation-time-of-a-package/100509/10 "2023-06-19T06:39:01Z")

</div>

The last characters should represent your timezone. The code that generates that line is below.

> <https://github.com/JuliaLang/julia/blob/90521dd63913aafc08eabbe2f4f8e0806cfeecb9/stdlib/REPL/src/REPL.jl#LL648C15-L648C60>

The Julia code originates from this call.

```julia
Libc.strftime("%Y-%m-%d %H:%M:%S %Z", time())

```

That in turn calls the C routine `wcsftime`:  
[https://cplusplus.com/reference/cwchar/wcsftime/](https://cplusplus.com/reference/cwchar/wcsftime/)

My guess is that GB 18030 is being misinterpreted as UTF-16.

```julia
julia> using StringEncodings

julia> decode(UInt8.(transcode(UInt16, "ÖÐ¹ú±ê×¼Ê±¼ä")), "GB18030")
"中国标准时间"

```

---

<div class="post-metadata">

**Author:** ![WuSiren](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wusiren/32/42529_2.png) [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Post date:** [June 19, 2023, 7:44am UTC](https://discourse.julialang.org/t/is-there-any-way-to-check-the-installation-time-of-a-package/100509/11 "2023-06-19T07:44:32Z")

</div>

Thank you very much!
