# General Usage

**URL:** https://discourse.julialang.org/c/usage/6.md?page=155

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 156

---

## [LaTeX rendering in the Julia REPL](https://discourse.julialang.org/t/latex-rendering-in-the-julia-repl/43473)

<div class="topic-metadata">

**Author:** [@GeneralPoxter](https://discourse.julialang.org/u/GeneralPoxter)\
**Replies:** 32\
**Last updated:** [June 26, 2024, 4:17pm UTC](https://discourse.julialang.org/t/latex-rendering-in-the-julia-repl/43473 "2024-06-26T16:17:52Z")

</div>

I watched the Latexify demonstration at JuliaCon here. It seems from the video that simply entering something like latexify("x/y") into the terminal will result in output that looks like proper LaTeX. However, when I t…

---

## [CI error: Path to conda environment is not valid](https://discourse.julialang.org/t/ci-error-path-to-conda-environment-is-not-valid/116264)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 1\
**Last updated:** [June 26, 2024, 4:05pm UTC](https://discourse.julialang.org/t/ci-error-path-to-conda-environment-is-not-valid/116264 "2024-06-26T16:05:59Z")

</div>

Today my integration tests fail with: Run julia-actions/julia-runtest@v1 Run echo "JULIA\_PKG\_SERVER\_REGISTRY\_PREFERENCE=${JULIA\_PKG\_SERVER\_REGISTRY\_PREFERENCE:-eager}" \>\> ${GITHUB\_ENV} Run # The Julia command that will …

---

## [Specify build version of JLL package](https://discourse.julialang.org/t/specify-build-version-of-jll-package/116185)

<div class="topic-metadata">

**Author:** [@ludvigak](https://discourse.julialang.org/u/ludvigak)\
**Replies:** 4\
**Last updated:** [June 26, 2024, 3:15pm UTC](https://discourse.julialang.org/t/specify-build-version-of-jll-package/116185 "2024-06-26T15:15:48Z")

</div>

If my package has a JLL dependency MyPkg\_jll with version dependency MyPkg\_jll="1.2.3" in the project file, then version v1.2.3+B will be installed, where B is the latest build version. Now, if build\_tarballs.jl of MyPk…

---

## [Vectorization of multivariate normal PDF](https://discourse.julialang.org/t/vectorization-of-multivariate-normal-pdf/116248)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 1\
**Last updated:** [June 26, 2024, 7:57am UTC](https://discourse.julialang.org/t/vectorization-of-multivariate-normal-pdf/116248 "2024-06-26T07:57:54Z")

</div>

I would like to compute the PDF of a multivariate normal distribution of given parameters for a number of input points. (eg MvNorm for several vectors at once) This is for a particle filter, many such computations going …

---

## [Inconsistency in Allocs reported by track-allocs vs BenchmarkTools](https://discourse.julialang.org/t/inconsistency-in-allocs-reported-by-track-allocs-vs-benchmarktools/116166)

<div class="topic-metadata">

**Author:** [@Spuriosity1](https://discourse.julialang.org/u/Spuriosity1)\
**Replies:** 5\
**Last updated:** [June 26, 2024, 5:19am UTC](https://discourse.julialang.org/t/inconsistency-in-allocs-reported-by-track-allocs-vs-benchmarktools/116166 "2024-06-26T05:19:49Z")

</div>

I have tried to write a low-overhead function that adds a number of Lorentzian peaks to a grid of intensities. When run under @benchmark, it reports “0 allocations”, but when run within my program, I get a large number o…

---

## [\`ENV\["JULIA\_DEBUG"\] == "MyModule" && expensive\_debug\_method()\` good practice?](https://discourse.julialang.org/t/env-julia-debug-mymodule-expensive-debug-method-good-practice/116197)

<div class="topic-metadata">

**Author:** [@maxkapur](https://discourse.julialang.org/u/maxkapur)\
**Replies:** 7\
**Last updated:** [June 25, 2024, 9:49pm UTC](https://discourse.julialang.org/t/env-julia-debug-mymodule-expensive-debug-method-good-practice/116197 "2024-06-25T21:49:09Z")

</div>

Will Julia compile away lines like ENV\["JULIA\_DEBUG"\] == "MyModule" && expensive\_debug\_method() when the environment variable is not set, or does the dictionary lookup happen at runtime? If the latter, is there a good …

---

## [Specifying analytical Jacobian in NonlinearProblem à la Optim.only\_fg!](https://discourse.julialang.org/t/specifying-analytical-jacobian-in-nonlinearproblem-a-la-optim-only-fg/115991)

<div class="topic-metadata">

**Author:** [@dieg0](https://discourse.julialang.org/u/dieg0)\
**Replies:** 1\
**Last updated:** [June 25, 2024, 6:55pm UTC](https://discourse.julialang.org/t/specifying-analytical-jacobian-in-nonlinearproblem-a-la-optim-only-fg/115991 "2024-06-25T18:55:15Z")

</div>

When minimizing a costly function f(x) using Optim.jl and providing the gradient \\nabla f(x), one can use Optim.only\_fg! to compute the gradient and the function itself within the same function to avoid repeating computa…

---

## [How to skip type parameters in function signature](https://discourse.julialang.org/t/how-to-skip-type-parameters-in-function-signature/106300)

<div class="topic-metadata">

**Author:** [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Replies:** 8\
**Last updated:** [June 25, 2024, 1:55pm UTC](https://discourse.julialang.org/t/how-to-skip-type-parameters-in-function-signature/106300 "2024-06-25T13:55:41Z")

</div>

I have a type such as: struct Foo{A,B} a::A b::B end And a method for foo where I want to use the type parameter A. Then I can write: mymethod(x::Foo{A,B}) where {A,B} = ... But since I don’t need B, I could …

---

## [Capturing the types of the values, from the type of a Named Tuple](https://discourse.julialang.org/t/capturing-the-types-of-the-values-from-the-type-of-a-named-tuple/116199)

<div class="topic-metadata">

**Author:** [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Replies:** 6\
**Last updated:** [June 25, 2024, 1:49pm UTC](https://discourse.julialang.org/t/capturing-the-types-of-the-values-from-the-type-of-a-named-tuple/116199 "2024-06-25T13:49:35Z")

</div>

Hi, Given the type of a NamedTuple, I want to make operations on the types of the values (or fields) of the type, ultimately to compute a new type and allocate memory. Here is a little code function see(::Type{NT}) wh…

---

## [RCall: internet routines cannot be loaded -\> can't install R packages](https://discourse.julialang.org/t/rcall-internet-routines-cannot-be-loaded-cant-install-r-packages/116202)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 1\
**Last updated:** [June 25, 2024, 1:29pm UTC](https://discourse.julialang.org/t/rcall-internet-routines-cannot-be-loaded-cant-install-r-packages/116202 "2024-06-25T13:29:27Z")

</div>

I have installer RCall making it point to my default R installation on Ubunu. If I open a R terminal and I install a R package I have no issues, but if I use RCall in Julia like: R\> install.packages('Rcpp', repos='http…

---

## [Macros and piping](https://discourse.julialang.org/t/macros-and-piping/116130)

<div class="topic-metadata">

**Author:** [@Lincoln\_Hannah](https://discourse.julialang.org/u/Lincoln_Hannah)\
**Replies:** 14\
**Last updated:** [June 25, 2024, 11:58am UTC](https://discourse.julialang.org/t/macros-and-piping/116130 "2024-06-25T11:58:57Z")

</div>

How come these two examples don’t work. using Pipe, Chain macro test(x) x end @pipe 1 |\> @test(\_) #works @pipe 1 |\> @test \_ #works @pipe 1 |\> @test #doesn't work @chain 1 begin @test(\_) …

---

## [Is Sys.free\_memory() "reliable"?](https://discourse.julialang.org/t/is-sys-free-memory-reliable/116159)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 6\
**Last updated:** [June 25, 2024, 11:58am UTC](https://discourse.julialang.org/t/is-sys-free-memory-reliable/116159 "2024-06-25T11:58:14Z")

</div>

I’m trying to add a custom error message for a package if the user inputs data such that the memory of the system will explode. For such, I use: if required\_memory \> 0.8 \* Sys.free\_memory() throw(.... appropriate er…

---

## [RCall cannot install R packages](https://discourse.julialang.org/t/rcall-cannot-install-r-packages/51624)

<div class="topic-metadata">

**Author:** [@compleat](https://discourse.julialang.org/u/compleat)\
**Replies:** 4\
**Last updated:** [June 25, 2024, 11:57am UTC](https://discourse.julialang.org/t/rcall-cannot-install-r-packages/51624 "2024-06-25T11:57:32Z")

</div>

Hi I have an issue with RCall.jl Firstly, thank you for this package, I have found RCall really useful. Unfortunately, I cannot install R packages when I am in ‘R’ mode. I get the error: Warning in install.packages("…

---

## [Putting Date objects on xticks using Plots.jl](https://discourse.julialang.org/t/putting-date-objects-on-xticks-using-plots-jl/116171)

<div class="topic-metadata">

**Author:** [@aziz\_ben](https://discourse.julialang.org/u/aziz_ben)\
**Replies:** 2\
**Last updated:** [June 25, 2024, 11:42am UTC](https://discourse.julialang.org/t/putting-date-objects-on-xticks-using-plots-jl/116171 "2024-06-25T11:42:00Z")

</div>

Hi, I tried to make a plot using Plots with dates under the ticks of the x axis but I ran into a problem. The dates are displayed in the plot in this format: yyyy/mm/ddT00:00:00. Does anyone know how to get rid of this?…

---

## [Is there a direct way to get the string of the output of \`show\`?](https://discourse.julialang.org/t/is-there-a-direct-way-to-get-the-string-of-the-output-of-show/116188)

<div class="topic-metadata">

**Author:** [@paalon](https://discourse.julialang.org/u/paalon)\
**Replies:** 8\
**Last updated:** [June 25, 2024, 9:23am UTC](https://discourse.julialang.org/t/is-there-a-direct-way-to-get-the-string-of-the-output-of-show/116188 "2024-06-25T09:23:55Z")

</div>

I need to write the following script: # typeof # 値の型を得る function print\_typeof(x) print("表現「") show(x) println("」の値の型は「", typeof(x), "」である。") end print\_typeof(true) print\_typeof(1) print\_typeof(1.0) print\_t…

---

## [Optimal way to broadcast over a container of funcs](https://discourse.julialang.org/t/optimal-way-to-broadcast-over-a-container-of-funcs/116156)

<div class="topic-metadata">

**Author:** [@miguelborrero](https://discourse.julialang.org/u/miguelborrero)\
**Replies:** 11\
**Last updated:** [June 25, 2024, 1:01am UTC](https://discourse.julialang.org/t/optimal-way-to-broadcast-over-a-container-of-funcs/116156 "2024-06-25T01:01:26Z")

</div>

Hi there, I have a vector (more generally: a list) of functions the map a vector to a vector and also a matrix where each row is to be populated by each of the functions. See below an example: function test() f\_vec…

---

## [Decomposing an EEG Signal from Scratch](https://discourse.julialang.org/t/decomposing-an-eeg-signal-from-scratch/115904)

<div class="topic-metadata">

**Author:** [@TheCedarPrince](https://discourse.julialang.org/u/TheCedarPrince)\
**Replies:** 22\
**Last updated:** [June 24, 2024, 9:00pm UTC](https://discourse.julialang.org/t/decomposing-an-eeg-signal-from-scratch/115904 "2024-06-24T21:00:08Z")

</div>

Hey folks! :wave: I’ve been recently tinkering with decomposing some EEG data into various visualizations and want to make sure I am going about things the right way (the data using is openly available from here). Here …

---

## [Define test error message programmatically](https://discourse.julialang.org/t/define-test-error-message-programmatically/116142)

<div class="topic-metadata">

**Author:** [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Replies:** 13\
**Last updated:** [June 24, 2024, 5:46pm UTC](https://discourse.julialang.org/t/define-test-error-message-programmatically/116142 "2024-06-24T17:46:21Z")

</div>

Is there a way for a test to display a custom error message, without giving up on the nice display of numerical values equality / comparison tests? The workaround in Custom error message from @test macro is only a parti…

---

## [Update Vector with dot Operator - Different Behavior when using Vector and Other Types](https://discourse.julialang.org/t/update-vector-with-dot-operator-different-behavior-when-using-vector-and-other-types/116138)

<div class="topic-metadata">

**Author:** [@Andy\_Zhang](https://discourse.julialang.org/u/Andy_Zhang)\
**Replies:** 1\
**Last updated:** [June 24, 2024, 12:38pm UTC](https://discourse.julialang.org/t/update-vector-with-dot-operator-different-behavior-when-using-vector-and-other-types/116138 "2024-06-24T12:38:10Z")

</div>

Here is a piece of code: v1 = \[2, 3, 5, 7, 11, 13, 17\] @show v1 v1\[1:3\] = \[1, 2, 3\] @show v1 v1\[1:3\] .= 0 @show v1 v1\[1:3\] .= \[4, 5, 6\] @show v1 v1\[1:3\] .= "1" Output: v1 = \[2, 3, 5, 7, 11, 13, 17\] v1 = \[1, 2, 3, 7, 1…

---

## [How to evaluate Python custom code in PythonCall?](https://discourse.julialang.org/t/how-to-evaluate-python-custom-code-in-pythoncall/116113)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 7\
**Last updated:** [June 24, 2024, 10:23am UTC](https://discourse.julialang.org/t/how-to-evaluate-python-custom-code-in-pythoncall/116113 "2024-06-24T10:23:27Z")

</div>

While I agree that most “call Python in Julia” refers to call existing libraries, I sometimes find it useful to be able to evaluate custom defined Python code from Julia. Which is the PythonCall equivalent to this PyCal…

---

## [Confusion about scope in try-catch blocks](https://discourse.julialang.org/t/confusion-about-scope-in-try-catch-blocks/115622)

<div class="topic-metadata">

**Author:** [@Tortar](https://discourse.julialang.org/u/Tortar)\
**Replies:** 22\
**Last updated:** [June 24, 2024, 9:07am UTC](https://discourse.julialang.org/t/confusion-about-scope-in-try-catch-blocks/115622 "2024-06-24T09:07:31Z")

</div>

Regarding scoping rules this used to trip me up a bit: Python: \>\>\> try: ... x = 2 ... except: ... pass ... \>\>\> x 2 Julia: julia\> try x = 2 catch end 2 julia\> x ERROR: UndefVarError:…

---

## [Julia and Programmable Calculators](https://discourse.julialang.org/t/julia-and-programmable-calculators/116117)

<div class="topic-metadata">

**Author:** [@Leviset](https://discourse.julialang.org/u/Leviset)\
**Replies:** 7\
**Last updated:** [June 24, 2024, 3:05am UTC](https://discourse.julialang.org/t/julia-and-programmable-calculators/116117 "2024-06-24T03:05:03Z")

</div>

2024-06-22T23:00:00Z (UTC) I’ve talked in earlier topics about ASM and Julia. Recently Texas Instruments have released the TI-84 Plus CE-T Programmable Calculator with Python installed. Is there a possibility that a v…

---

## [Scaling a sparse matrix row-wise and column-wise too slow](https://discourse.julialang.org/t/scaling-a-sparse-matrix-row-wise-and-column-wise-too-slow/115956)

<div class="topic-metadata">

**Author:** [@pitsianis](https://discourse.julialang.org/u/pitsianis)\
**Replies:** 20\
**Last updated:** [June 23, 2024, 9:17pm UTC](https://discourse.julialang.org/t/scaling-a-sparse-matrix-row-wise-and-column-wise-too-slow/115956 "2024-06-23T21:17:22Z")

</div>

I need to scale a sparse matrix row-wise and column-wise. That is S\[i,j\] = r\[i\] \* A\[i,j\] \* c\[j\] If I write it the way you’d see it in a math book, S = spdiagm(r) \* A \* spdiagm(c) the expression takes 8x times more th…

---

## [Understanding @report\_code output](https://discourse.julialang.org/t/understanding-report-code-output/116000)

<div class="topic-metadata">

**Author:** [@miguelborrero](https://discourse.julialang.org/u/miguelborrero)\
**Replies:** 3\
**Last updated:** [June 23, 2024, 6:56pm UTC](https://discourse.julialang.org/t/understanding-report-code-output/116000 "2024-06-23T18:56:25Z")

</div>

Hi there, This is my first time using JET.jl to fix the type-instability issues of my code. I am aware that maybe asking without a reproducible example might be a stretch but I will try anyways. My function takes as an…

---

## [How to wrap a Python function in a Julia package using PythonCall.jl](https://discourse.julialang.org/t/how-to-wrap-a-python-function-in-a-julia-package-using-pythoncall-jl/95101)

<div class="topic-metadata">

**Author:** [@Dale\_James\_Black](https://discourse.julialang.org/u/Dale_James_Black)\
**Replies:** 16\
**Last updated:** [June 23, 2024, 12:25pm UTC](https://discourse.julialang.org/t/how-to-wrap-a-python-function-in-a-julia-package-using-pythoncall-jl/95101 "2024-06-23T12:25:37Z")

</div>

I am developing a package that wants to wrap and re-export a Python function. The relevant code is below, and it works well within the same file it was called in, but it breaks when trying to test it in the package I am …

---

## [How to switch between function definitions for using CUDA.jl](https://discourse.julialang.org/t/how-to-switch-between-function-definitions-for-using-cuda-jl/115986)

<div class="topic-metadata">

**Author:** [@Cibin\_Joseph](https://discourse.julialang.org/u/Cibin_Joseph)\
**Replies:** 3\
**Last updated:** [June 23, 2024, 12:18pm UTC](https://discourse.julialang.org/t/how-to-switch-between-function-definitions-for-using-cuda-jl/115986 "2024-06-23T12:18:26Z")

</div>

I have two variants of a function: One that utilizes the CPU and an other that utilizes the GPU through CUDA.jl. I’d like to offer the user the option of switching between the two. I’ve tried using environment variables…

---

## [New CUDA.jl version breaks previously working Base functions?](https://discourse.julialang.org/t/new-cuda-jl-version-breaks-previously-working-base-functions/116102)

<div class="topic-metadata">

**Author:** [@pxshen](https://discourse.julialang.org/u/pxshen)\
**Replies:** 4\
**Last updated:** [June 23, 2024, 1:58am UTC](https://discourse.julialang.org/t/new-cuda-jl-version-breaks-previously-working-base-functions/116102 "2024-06-23T01:58:27Z")

</div>

New CUDA.jl version circa v5 seems to break many functions that previously worked with CuArrav. eg a = \[1 2; 3 4\] |\> cu diff(a; dims=1) now raises LLVM IR error. Why is this?

---

## [Repurposing memory fragments of a large arrays](https://discourse.julialang.org/t/repurposing-memory-fragments-of-a-large-arrays/116090)

<div class="topic-metadata">

**Author:** [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Replies:** 9\
**Last updated:** [June 22, 2024, 9:46pm UTC](https://discourse.julialang.org/t/repurposing-memory-fragments-of-a-large-arrays/116090 "2024-06-22T21:46:11Z")

</div>

I have some code, which allocates a larger array, which I store in a named tuple along with other pre-allocated arrays. To save memory, I would like to re-purpose this array tmp\_cpx to “host” two smaller arrays, since th…

---

## [Is write(filename, some\_string) discouraged?](https://discourse.julialang.org/t/is-write-filename-some-string-discouraged/115982)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 4\
**Last updated:** [June 22, 2024, 10:52pm UTC](https://discourse.julialang.org/t/is-write-filename-some-string-discouraged/115982 "2024-06-22T22:52:01Z")

</div>

In the I/O section of the current Julia manual, the only documented write method is write(io::IO, x), on this webpage: https://docs.julialang.org/en/v1/base/io-network/#Base.write If I type ?write the the REPL, I can s…

---

## [How to find out if precompilation during Pkg.add was successful?](https://discourse.julialang.org/t/how-to-find-out-if-precompilation-during-pkg-add-was-successful/116104)

<div class="topic-metadata">

**Author:** [@matthias314](https://discourse.julialang.org/u/matthias314)\
**Replies:** 2\
**Last updated:** [June 22, 2024, 9:38pm UTC](https://discourse.julialang.org/t/how-to-find-out-if-precompilation-during-pkg-add-was-successful/116104 "2024-06-22T21:38:56Z")

</div>

Assume some Julia code adds a package pkg via Pkg.add(pkg). How can subsequent code determine if the package precompiled successfully?

[Previous page](https://discourse.julialang.org/c/usage/6.md?page=154)

[Next page](https://discourse.julialang.org/c/usage/6.md?page=156)
