# General Usage

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

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

**Page:** 82

---

## [LSP "Missing reference" woes](https://discourse.julialang.org/t/lsp-missing-reference-woes/98231)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 21\
**Last updated:** [March 8, 2025, 4:00am UTC](https://discourse.julialang.org/t/lsp-missing-reference-woes/98231 "2025-03-08T04:00:06Z")

</div>

Notice two2 = too (which is not defined). I do have the “missing references” enabled: Any idea what is wrong? Sublime Text (4). On windows.

---

## [How does CondaPkg achieve Pkg integration internally?](https://discourse.julialang.org/t/how-does-condapkg-achieve-pkg-integration-internally/126699)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 1\
**Last updated:** [March 8, 2025, 2:40am UTC](https://discourse.julialang.org/t/how-does-condapkg-achieve-pkg-integration-internally/126699 "2025-03-08T02:40:45Z")

</div>

Does CondaPkg override Pkg.add or Pkg.precompile to install Python dependencies listed in CondaPkg.toml when a user add or import a Julia package that uses CondaPkg? The process seems a little too magical, so I’d like to…

---

## [Code generation for docstrings](https://discourse.julialang.org/t/code-generation-for-docstrings/126696)

<div class="topic-metadata">

**Author:** [@bjarthur](https://discourse.julialang.org/u/bjarthur)\
**Replies:** 2\
**Last updated:** [March 7, 2025, 9:41pm UTC](https://discourse.julialang.org/t/code-generation-for-docstrings/126696 "2025-03-07T21:41:30Z")

</div>

i know how to create functions with code generation, but how does one simultaneously create docstrings? it seems a global variable is required. is there no better way? julia\> struct MyNumber; x::Float64; end julia\> f…

---

## [Installing package doesn't automatically run Pkg.build for dependencies](https://discourse.julialang.org/t/installing-package-doesnt-automatically-run-pkg-build-for-dependencies/126671)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 2\
**Last updated:** [March 7, 2025, 7:47pm UTC](https://discourse.julialang.org/t/installing-package-doesnt-automatically-run-pkg-build-for-dependencies/126671 "2025-03-07T19:47:42Z")

</div>

I’ve encountered a package which depends on another package which contains deps/build.jl. However, the parent package repo doesn’t have build.jl. When I use Pkg to add the parent package repo, the build step for the depe…

---

## [Idiom to preinitialize function parameters](https://discourse.julialang.org/t/idiom-to-preinitialize-function-parameters/126676)

<div class="topic-metadata">

**Author:** [@nilsbecker](https://discourse.julialang.org/u/nilsbecker)\
**Replies:** 6\
**Last updated:** [March 7, 2025, 6:27pm UTC](https://discourse.julialang.org/t/idiom-to-preinitialize-function-parameters/126676 "2025-03-07T18:27:04Z")

</div>

Coming from a language with curried function arguments, when I try to precompute some parameters for a function that is to be used in a hot loop, I end up with code like this: precompute = length function setup(input) …

---

## [Help in installing a Python Pkg with CondaPkg](https://discourse.julialang.org/t/help-in-installing-a-python-pkg-with-condapkg/126685)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 2\
**Last updated:** [March 7, 2025, 5:21pm UTC](https://discourse.julialang.org/t/help-in-installing-a-python-pkg-with-condapkg/126685 "2025-03-07T17:21:19Z")

</div>

In a Julia package of mine, I need to install the chelsea-cmip6 Python package for downloading climatic data. The developer of the python package suggest to install it (in Python) using pip. I have tried with the Julia…

---

## [Allocations on field access even though no abstract types are involved](https://discourse.julialang.org/t/allocations-on-field-access-even-though-no-abstract-types-are-involved/126672)

<div class="topic-metadata">

**Author:** [@nilsbecker](https://discourse.julialang.org/u/nilsbecker)\
**Replies:** 9\
**Last updated:** [March 7, 2025, 1:12pm UTC](https://discourse.julialang.org/t/allocations-on-field-access-even-though-no-abstract-types-are-involved/126672 "2025-03-07T13:12:18Z")

</div>

Hi, after reading the manual, I was thinking to avoid dynamic lookup by parametrizing my type for a function with attached data, like so: Original type: struct FunctionWithExtra{A} f::A extra end where f is su…

---

## [Is it OK to structure my packages like this (benign type piracy)?](https://discourse.julialang.org/t/is-it-ok-to-structure-my-packages-like-this-benign-type-piracy/126627)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 5\
**Last updated:** [March 6, 2025, 10:13pm UTC](https://discourse.julialang.org/t/is-it-ok-to-structure-my-packages-like-this-benign-type-piracy/126627 "2025-03-06T22:13:48Z")

</div>

Is this design OK? Is this supported by precompilation? What could go wrong? Could package extensions help here somehow, if necessary? The idea is basically to define a function with no methods in PackageA and only add …

---

## [Generate Protocol Buffer .proto file from struct definition](https://discourse.julialang.org/t/generate-protocol-buffer-proto-file-from-struct-definition/126650)

<div class="topic-metadata">

**Author:** [@lstagner](https://discourse.julialang.org/u/lstagner)\
**Replies:** 1\
**Last updated:** [March 6, 2025, 6:28pm UTC](https://discourse.julialang.org/t/generate-protocol-buffer-proto-file-from-struct-definition/126650 "2025-03-06T18:28:01Z")

</div>

I have a project that uses Protobuf but in the future I would like to be able to generate the .proto files from a julia struct. For example I would like to be able to take struct MyMessage a::Int32 b::Vector{Str…

---

## [Getting hold of error status from an external command?](https://discourse.julialang.org/t/getting-hold-of-error-status-from-an-external-command/126465)

<div class="topic-metadata">

**Author:** [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Replies:** 5\
**Last updated:** [March 6, 2025, 11:04pm UTC](https://discourse.julialang.org/t/getting-hold-of-error-status-from-an-external-command/126465 "2025-03-06T23:04:02Z")

</div>

I found the following old thread discussing the same problem. Is this proc = spawn(pipeline(ignorestatus(cmd))) still the best way to get hold of the exit code? I wish these commands (run() etc) had an option to retur…

---

## [Type instability for simple MLP call using ComponentArrays](https://discourse.julialang.org/t/type-instability-for-simple-mlp-call-using-componentarrays/126191)

<div class="topic-metadata">

**Author:** [@lasse](https://discourse.julialang.org/u/lasse)\
**Replies:** 2\
**Last updated:** [March 6, 2025, 5:17pm UTC](https://discourse.julialang.org/t/type-instability-for-simple-mlp-call-using-componentarrays/126191 "2025-03-06T17:17:58Z")

</div>

Hi, Is there a way to make Zygote gradients type stable when optimizing over a ComponentArray of parameters? If not - what is a good alternative that is compatible with the SciML ecosystem? Using @NamedTuple does as I …

---

## [Understanding \`mkpidlock\` and why it deletes my files](https://discourse.julialang.org/t/understanding-mkpidlock-and-why-it-deletes-my-files/120915)

<div class="topic-metadata">

**Author:** [@phx](https://discourse.julialang.org/u/phx)\
**Replies:** 1\
**Last updated:** [March 6, 2025, 4:27pm UTC](https://discourse.julialang.org/t/understanding-mkpidlock-and-why-it-deletes-my-files/120915 "2025-03-06T16:27:14Z")

</div>

I have multiple instances of a script that will need to write on a single file, so I was looking into locking the access to said file by using mkpidlock. Eventually I’ll want to use it with HDF5 files (which I know I can…

---

## [Symbolics: Keeping Array operations in derivatives](https://discourse.julialang.org/t/symbolics-keeping-array-operations-in-derivatives/126530)

<div class="topic-metadata">

**Author:** [@c\_sell](https://discourse.julialang.org/u/c_sell)\
**Replies:** 12\
**Last updated:** [March 6, 2025, 2:39pm UTC](https://discourse.julialang.org/t/symbolics-keeping-array-operations-in-derivatives/126530 "2025-03-06T14:39:41Z")

</div>

Hello, is there a way in julia symbolics keep the lazy array evaluation when computing derivatives. E.g. to get in 1 of the 2 examples below just J = 2\*A as return using Symbolics @variables A\[1:5,1:5\] Av = Symbolics.…

---

## [┌ Error: Error in the keymap](https://discourse.julialang.org/t/error-error-in-the-keymap/126629)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 1\
**Last updated:** [March 6, 2025, 11:50am UTC](https://discourse.julialang.org/t/error-error-in-the-keymap/126629 "2025-03-06T11:50:46Z")

</div>

I was unable, for now, to get a MWE, but maybe this bug is already known, or the stack trace helps someone to understand what’s going on. It is simply that when trying to complete commands with TAB, sometimes I get these…

---

## [CUDA.jl - When to synchronize](https://discourse.julialang.org/t/cuda-jl-when-to-synchronize/115576)

<div class="topic-metadata">

**Author:** [@Jason\_Meziere](https://discourse.julialang.org/u/Jason_Meziere)\
**Replies:** 11\
**Last updated:** [March 6, 2025, 6:53am UTC](https://discourse.julialang.org/t/cuda-jl-when-to-synchronize/115576 "2025-03-06T06:53:52Z")

</div>

The project I’m working on is run entirely on a GPU. What I mean by that is that there is no copying back and forth between the GPU and CPU until the very end. Along the way, I go through 5 main types of operations: Arr…

---

## [Makie: logscale ticks contains undesired \`1.0 x\`](https://discourse.julialang.org/t/makie-logscale-ticks-contains-undesired-1-0-x/126615)

<div class="topic-metadata">

**Author:** [@jling](https://discourse.julialang.org/u/jling)\
**Replies:** 1\
**Last updated:** [March 6, 2025, 4:41am UTC](https://discourse.julialang.org/t/makie-logscale-ticks-contains-undesired-1-0-x/126615 "2025-03-06T04:41:15Z")

</div>

scatter(1:9, 10 .^ (0:8); axis=(;yticks=10 .^ (0:8), yscale=log10))

---

## [C implementation of function being ~4 times faster even absence of allocs](https://discourse.julialang.org/t/c-implementation-of-function-being-4-times-faster-even-absence-of-allocs/126495)

<div class="topic-metadata">

**Author:** [@miguelborrero](https://discourse.julialang.org/u/miguelborrero)\
**Replies:** 28\
**Last updated:** [March 5, 2025, 10:42pm UTC](https://discourse.julialang.org/t/c-implementation-of-function-being-4-times-faster-even-absence-of-allocs/126495 "2025-03-05T22:42:57Z")

</div>

Hi there, I am in need to optimize as much as possible the function I will present here. I moved it from C to Julia for convenience since the operations around it become much easier but I am getting significantly worst …

---

## [How can I find out which packages are installed in the global environment?](https://discourse.julialang.org/t/how-can-i-find-out-which-packages-are-installed-in-the-global-environment/126575)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 2\
**Last updated:** [March 5, 2025, 8:20pm UTC](https://discourse.julialang.org/t/how-can-i-find-out-which-packages-are-installed-in-the-global-environment/126575 "2025-03-05T20:20:34Z")

</div>

If I have launched Julia with: julia --project I can find out the packages of the project with: using Pkg keys(Pkg.project().dependencies) But how can I find out which packages are installed globally?

---

## [\[ANN\] Introducing BaremetalPi.jl - A package to access Raspberry Pi peripherals without external libraries](https://discourse.julialang.org/t/ann-introducing-baremetalpi-jl-a-package-to-access-raspberry-pi-peripherals-without-external-libraries/41417)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 61\
**Last updated:** [March 5, 2025, 5:56pm UTC](https://discourse.julialang.org/t/ann-introducing-baremetalpi-jl-a-package-to-access-raspberry-pi-peripherals-without-external-libraries/41417 "2025-03-05T17:56:28Z")

</div>

Hi! As I posted here: Have a try Julia v1.4.2 for arm32bit, I was programming a package for Julia to access the Raspberry Pi peripherals without requiring external libraries. Currently, we have some nice packages to us…

---

## [How to make vegalite read my topojson file?](https://discourse.julialang.org/t/how-to-make-vegalite-read-my-topojson-file/34546)

<div class="topic-metadata">

**Author:** [@Aizzaac](https://discourse.julialang.org/u/Aizzaac)\
**Replies:** 18\
**Last updated:** [March 5, 2025, 3:39pm UTC](https://discourse.julialang.org/t/how-to-make-vegalite-read-my-topojson-file/34546 "2025-03-05T15:39:15Z")

</div>

I have a topojson file located in this path: "/home/juliana/roc/Data/Topojson/disa\_ONT\_region" I want to make a choropleth map, but I do not know how to call that file into my code. I know it has to go in “values” I h…

---

## [How to find the default webbrowser on Windows and Mac?](https://discourse.julialang.org/t/how-to-find-the-default-webbrowser-on-windows-and-mac/126573)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 1\
**Last updated:** [March 5, 2025, 11:01am UTC](https://discourse.julialang.org/t/how-to-find-the-default-webbrowser-on-windows-and-mac/126573 "2025-03-05T11:01:20Z")

</div>

In the help menu of our app we do: url = "https://albatross-kite-transport.github.io/VortexStepMethod.jl/dev" run(\`xdg-open $url\`) to open the default web browser with the given URL. This works on Linux, but how can t…

---

## [Versions of the documentation with Documenter.jl](https://discourse.julialang.org/t/versions-of-the-documentation-with-documenter-jl/126548)

<div class="topic-metadata">

**Author:** [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Replies:** 2\
**Last updated:** [March 5, 2025, 6:36am UTC](https://discourse.julialang.org/t/versions-of-the-documentation-with-documenter-jl/126548 "2025-03-05T06:36:26Z")

</div>

We made several new releases of our package VortexStepMethod.jl , but they do not appear in the menu of the documentation. See: Since v0.1 we also released 1.0 and 1.0.1 and 1.1. Any idea how to make new versions ap…

---

## [Bug: Value of module level global variable set from ENV does not work](https://discourse.julialang.org/t/bug-value-of-module-level-global-variable-set-from-env-does-not-work/126525)

<div class="topic-metadata">

**Author:** [@world-peace](https://discourse.julialang.org/u/world-peace)\
**Replies:** 10\
**Last updated:** [March 4, 2025, 11:47pm UTC](https://discourse.julialang.org/t/bug-value-of-module-level-global-variable-set-from-env-does-not-work/126525 "2025-03-04T23:47:31Z")

</div>

Example code: module example global\_const\_variable::String = get(ENV, "GLOBAL\_CONST", "hello\_world") function print\_global\_const\_variable() global global\_const\_variable println(global\_const\_variable) end end …

---

## [My Julia code is slower than Python and Matlab](https://discourse.julialang.org/t/my-julia-code-is-slower-than-python-and-matlab/126476)

<div class="topic-metadata">

**Author:** [@Yuntian\_Zhao](https://discourse.julialang.org/u/Yuntian_Zhao)\
**Replies:** 26\
**Last updated:** [March 4, 2025, 7:40pm UTC](https://discourse.julialang.org/t/my-julia-code-is-slower-than-python-and-matlab/126476 "2025-03-04T19:40:15Z")

</div>

I am solving an HJB equation in economics using Julia, but I am experiencing performance issues. My Julia implementation takes about 90 seconds, slower than Python (~76s) and significantly slower than MATLAB (~39s). I’m …

---

## [Autodiffing through DE.jl ODEproblem wrt neural network parameters in reverse mode](https://discourse.julialang.org/t/autodiffing-through-de-jl-odeproblem-wrt-neural-network-parameters-in-reverse-mode/126537)

<div class="topic-metadata">

**Author:** [@dameka](https://discourse.julialang.org/u/dameka)\
**Replies:** 1\
**Last updated:** [March 4, 2025, 10:12pm UTC](https://discourse.julialang.org/t/autodiffing-through-de-jl-odeproblem-wrt-neural-network-parameters-in-reverse-mode/126537 "2025-03-04T22:12:46Z")

</div>

I’m trying to take the gradient of a loss function (which includes solving an ODEproblem with DifferentialEquations.jl) with respect to the parameters of a neural network. I was able to get ForwardDiff working for this, …

---

## [Could type ambiguity based on \`Union\` of concrete types be eliminated?](https://discourse.julialang.org/t/could-type-ambiguity-based-on-union-of-concrete-types-be-eliminated/126221)

<div class="topic-metadata">

**Author:** [@frankwswang](https://discourse.julialang.org/u/frankwswang)\
**Replies:** 4\
**Last updated:** [March 4, 2025, 6:03pm UTC](https://discourse.julialang.org/t/could-type-ambiguity-based-on-union-of-concrete-types-be-eliminated/126221 "2025-03-04T18:03:47Z")

</div>

MWE: julia\> foo(::Union{Int, Float64}, ::AbstractArray, ::AbstractArray) = 1 foo (generic function with 1 method) julia\> foo(::Int, ::Any, ::Any) = 2 foo (generic function with 2 methods) julia\> foo(1, \[1\], \[1\]) ERROR…

---

## [Chained keyword assignment in function call leaks scope](https://discourse.julialang.org/t/chained-keyword-assignment-in-function-call-leaks-scope/126531)

<div class="topic-metadata">

**Author:** [@ncxst](https://discourse.julialang.org/u/ncxst)\
**Replies:** 1\
**Last updated:** [March 4, 2025, 3:29pm UTC](https://discourse.julialang.org/t/chained-keyword-assignment-in-function-call-leaks-scope/126531 "2025-03-04T15:29:08Z")

</div>

I tried to do a chained keyword assignment in a function call and got the following behavior julia\> function params(;kwargs...) for kw in kwargs println(kw) end end params (ge…

---

## [Investigate long compile times](https://discourse.julialang.org/t/investigate-long-compile-times/119019)

<div class="topic-metadata">

**Author:** [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Replies:** 12\
**Last updated:** [March 4, 2025, 11:44am UTC](https://discourse.julialang.org/t/investigate-long-compile-times/119019 "2025-03-04T11:44:13Z")

</div>

Hi, Can someone give me hint on why the following call takes ~2mn to compile please? If you have an idea of the culprit and suggestions, I’d be very happy to hear them :smiley: Thanks a lot for your help, fold\_po\_coll…

---

## [Makie scatter and errorbar combine in legend?](https://discourse.julialang.org/t/makie-scatter-and-errorbar-combine-in-legend/126424)

<div class="topic-metadata">

**Author:** [@jling](https://discourse.julialang.org/u/jling)\
**Replies:** 4\
**Last updated:** [March 4, 2025, 10:57am UTC](https://discourse.julialang.org/t/makie-scatter-and-errorbar-combine-in-legend/126424 "2025-03-04T10:57:50Z")

</div>

Since errorbar does not take marker option, in order to make a plot the documentation recommend something like: errorbars!(xs, ys, higherrors, color = :red) # same low and high error # plot position scatters so low and…

---

## [How to get doc string of function programmatically?](https://discourse.julialang.org/t/how-to-get-doc-string-of-function-programmatically/126513)

<div class="topic-metadata">

**Author:** [@miles-1](https://discourse.julialang.org/u/miles-1)\
**Replies:** 2\
**Last updated:** [March 4, 2025, 12:05am UTC](https://discourse.julialang.org/t/how-to-get-doc-string-of-function-programmatically/126513 "2025-03-04T00:05:30Z")

</div>

I’m trying to make a function that will get the doc string of a given function. I am confused why there is an issue in the code below: using Markdown: plain function get\_doc\_string( f::Function )::String return…

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

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