# General Usage

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

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

**Page:** 589

---

## [Why does worker throw error when importing local package on master process?](https://discourse.julialang.org/t/why-does-worker-throw-error-when-importing-local-package-on-master-process/62748)

<div class="topic-metadata">

**Author:** [@lukeburns](https://discourse.julialang.org/u/lukeburns)\
**Replies:** 3\
**Last updated:** [June 11, 2021, 4:39pm UTC](https://discourse.julialang.org/t/why-does-worker-throw-error-when-importing-local-package-on-master-process/62748 "2021-06-11T16:39:10Z")

</div>

If I add processes after importing a local package, things work as expected: julia\> using Pkg julia\> Pkg.activate(".") Activating environment at \`~/MyPackage/Project.toml\` julia\> using Distributed julia\> julia\> using …

---

## [Pkg.add"Genie") Exception calling "DownloadFile" with "2" argument(s): "The remote server returned an error: (403) Forbidden."](https://discourse.julialang.org/t/pkg-add-genie-exception-calling-downloadfile-with-2-argument-s-the-remote-server-returned-an-error-403-forbidden/62747)

<div class="topic-metadata">

**Author:** [@bww00](https://discourse.julialang.org/u/bww00)\
**Replies:** 0\
**Last updated:** [June 11, 2021, 3:50pm UTC](https://discourse.julialang.org/t/pkg-add-genie-exception-calling-downloadfile-with-2-argument-s-the-remote-server-returned-an-error-403-forbidden/62747 "2021-06-11T15:50:57Z")

</div>

Got this error on Pkg.add(“Genie”) julia\> Pkg.add(“Genie”) Resolving package versions… Installed JuliaInterpreter ─ v0.8.18 Downloading artifact: Nettle Exception calling “DownloadFile” with “2” argument(s): “The re…

---

## [Precompiling Interpolations.jl failing](https://discourse.julialang.org/t/precompiling-interpolations-jl-failing/60090)

<div class="topic-metadata">

**Author:** [@timmm](https://discourse.julialang.org/u/timmm)\
**Replies:** 6\
**Last updated:** [June 11, 2021, 1:59pm UTC](https://discourse.julialang.org/t/precompiling-interpolations-jl-failing/60090 "2021-06-11T13:59:34Z")

</div>

Using Julia 1.6: using Interpolations \[ Info: Precompiling Interpolations \[a98d9a8b-a2ab-59e6-89dd-64a1c18fca59\] ERROR: LoadError: LoadError: UndefVarError: SA not defined Stacktrace: \[1\] top-level scope @ C:\\User…

---

## [Optim: return inverse Hessian](https://discourse.julialang.org/t/optim-return-inverse-hessian/62709)

<div class="topic-metadata">

**Author:** [@yingqiuz](https://discourse.julialang.org/u/yingqiuz)\
**Replies:** 0\
**Last updated:** [June 11, 2021, 12:03am UTC](https://discourse.julialang.org/t/optim-return-inverse-hessian/62709 "2021-06-11T00:03:52Z")

</div>

Hi all I am using Optim.jl BFGS() to optimise a function. I would like the function to return the negative Hessian, for example function f(x) return (1.0 - x\[1\])^2 + 100.0 \* (x\[2\] - x\[1\]^2)^2 end function g!(storag…

---

## [Flux: gradient of Chain returns nothing](https://discourse.julialang.org/t/flux-gradient-of-chain-returns-nothing/62725)

<div class="topic-metadata">

**Author:** [@jgbrasier](https://discourse.julialang.org/u/jgbrasier)\
**Replies:** 1\
**Last updated:** [June 11, 2021, 9:37am UTC](https://discourse.julialang.org/t/flux-gradient-of-chain-returns-nothing/62725 "2021-06-11T09:37:27Z")

</div>

I have defined a MLP (multi layer perceptron) with the Chain command, and this MLP is wrapped in a mutable structure. The gradient of this Chain (2 layer dense NN) returns nothing. Is this a bug, or am I doing this the …

---

## [@lorem\_ipsum for generating code](https://discourse.julialang.org/t/lorem-ipsum-for-generating-code/62723)

<div class="topic-metadata">

**Author:** [@Impressium](https://discourse.julialang.org/u/Impressium)\
**Replies:** 0\
**Last updated:** [June 11, 2021, 8:07am UTC](https://discourse.julialang.org/t/lorem-ipsum-for-generating-code/62723 "2021-06-11T08:07:30Z")

</div>

Hey all :slight\_smile: Does anyone know a package which implements a @lorem\_ipsum for generating working code with no side effects. This code would optimally deleted from the compiler. thx

---

## [\`(x, y)\` works but \`x =\> y\` doesn't](https://discourse.julialang.org/t/x-y-works-but-x-y-doesnt/62703)

<div class="topic-metadata">

**Author:** [@Samuel\_Ainsworth](https://discourse.julialang.org/u/Samuel_Ainsworth)\
**Replies:** 17\
**Last updated:** [June 11, 2021, 12:42am UTC](https://discourse.julialang.org/t/x-y-works-but-x-y-doesnt/62703 "2021-06-11T00:42:47Z")

</div>

This really seems like a bug to me, but perhaps I’m missing some kind of obscure difference between (x, y) and x =\> y syntax… import Base: ==, big import IntervalArithmetic: Interval struct Foo \<: Real v end # Neces…

---

## [Chaining in named arguments](https://discourse.julialang.org/t/chaining-in-named-arguments/62696)

<div class="topic-metadata">

**Author:** [@tlienart](https://discourse.julialang.org/u/tlienart)\
**Replies:** 2\
**Last updated:** [June 10, 2021, 11:00pm UTC](https://discourse.julialang.org/t/chaining-in-named-arguments/62696 "2021-06-10T23:00:54Z")

</div>

I stumbled upon this when trying to debug something that had happened for a user: foo(; x=1, y=1) = print("x: $x, y: $y") foo() # x: 1, y: 1 foo(; x=y=0) # x: 0, y: 1 initially I thought that the last one would just f…

---

## [Problem with 3d graph](https://discourse.julialang.org/t/problem-with-3d-graph/62700)

<div class="topic-metadata">

**Author:** [@klamar33](https://discourse.julialang.org/u/klamar33)\
**Replies:** 0\
**Last updated:** [June 10, 2021, 8:44pm UTC](https://discourse.julialang.org/t/problem-with-3d-graph/62700 "2021-06-10T20:44:46Z")

</div>

I have a project where I have to show the magnus effect on a flying ball. I created a graph in 3d, unfortunately I don’t know how to change the code to make the graph rotate, I also wanted to add a background, does anyon…

---

## [Sparse Matrix with CUDA.jl](https://discourse.julialang.org/t/sparse-matrix-with-cuda-jl/62627)

<div class="topic-metadata">

**Author:** [@boutor2](https://discourse.julialang.org/u/boutor2)\
**Replies:** 3\
**Last updated:** [June 10, 2021, 4:14pm UTC](https://discourse.julialang.org/t/sparse-matrix-with-cuda-jl/62627 "2021-06-10T16:14:32Z")

</div>

Hi everyone, I am looking for the most performant way to create a CuArray where coefficients are 0 everywhere but 1 at specified indices. An easy way to do that with regular arrays would be a = randn(1000,1000) imin = …

---

## [Scope and Inlining](https://discourse.julialang.org/t/scope-and-inlining/62694)

<div class="topic-metadata">

**Author:** [@MaximilianJHuber](https://discourse.julialang.org/u/MaximilianJHuber)\
**Replies:** 3\
**Last updated:** [June 10, 2021, 7:15pm UTC](https://discourse.julialang.org/t/scope-and-inlining/62694 "2021-06-10T19:15:28Z")

</div>

I stumbled across a case of bad practice that resulted in an error, but I am not sure why. function g(y) function f(x) f = x \* y return f end f(y) f(y) end g(0.2) I really should not d…

---

## [Does Julia have the Python equivalent of ValueError?](https://discourse.julialang.org/t/does-julia-have-the-python-equivalent-of-valueerror/62684)

<div class="topic-metadata">

**Author:** [@anon60034542](https://discourse.julialang.org/u/anon60034542)\
**Replies:** 11\
**Last updated:** [June 10, 2021, 6:39pm UTC](https://discourse.julialang.org/t/does-julia-have-the-python-equivalent-of-valueerror/62684 "2021-06-10T18:39:04Z")

</div>

In Python, a specific exception exists called ValueError: Raised when an operation or function receives an argument that has the right type but an inappropriate value, and the situation is not described by a more preci…

---

## [An embarrassingly parallel problem: threads or MPI?](https://discourse.julialang.org/t/an-embarrassingly-parallel-problem-threads-or-mpi/48049)

<div class="topic-metadata">

**Author:** [@mcreel](https://discourse.julialang.org/u/mcreel)\
**Replies:** 14\
**Last updated:** [June 10, 2021, 6:10pm UTC](https://discourse.julialang.org/t/an-embarrassingly-parallel-problem-threads-or-mpi/48049 "2021-06-10T18:10:31Z")

</div>

Monte Carlo is one of the archetypal embarrassingly parallel problems. I have been wondering for some time what’s the fastest way to do Monte Carlo in Julia, for problems where each replication has enough cost to make pa…

---

## [Overuse of memory leads to computer freeze](https://discourse.julialang.org/t/overuse-of-memory-leads-to-computer-freeze/62671)

<div class="topic-metadata">

**Author:** [@theogf](https://discourse.julialang.org/u/theogf)\
**Replies:** 10\
**Last updated:** [June 10, 2021, 3:26pm UTC](https://discourse.julialang.org/t/overuse-of-memory-leads-to-computer-freeze/62671 "2021-06-10T15:26:07Z")

</div>

I have a memory issue. On my small laptop (8Gb RAM) when I build overly big matrices I get a nice OutOfMemory error, the function is stopped and all is well. However on my desktop (~48Gb RAM) overly big matrices will ta…

---

## [PyCall setup for pickle consistency between machines](https://discourse.julialang.org/t/pycall-setup-for-pickle-consistency-between-machines/62679)

<div class="topic-metadata">

**Author:** [@crinders](https://discourse.julialang.org/u/crinders)\
**Replies:** 0\
**Last updated:** [June 10, 2021, 2:16pm UTC](https://discourse.julialang.org/t/pycall-setup-for-pickle-consistency-between-machines/62679 "2021-06-10T14:16:15Z")

</div>

I have a pickled file with 2 arrays. The first array is a floating point array, the second is a UInt8 array. On one machine pickle.load(F) twice loads both arrays, while on the other it does not. Instead I get ERROR: Py…

---

## [Strange behavior of CuDeviceArrays](https://discourse.julialang.org/t/strange-behavior-of-cudevicearrays/62568)

<div class="topic-metadata">

**Author:** [@fedoroff](https://discourse.julialang.org/u/fedoroff)\
**Replies:** 7\
**Last updated:** [June 10, 2021, 11:22am UTC](https://discourse.julialang.org/t/strange-behavior-of-cudevicearrays/62568 "2021-06-10T11:22:05Z")

</div>

I am playing around with passing of custom structures containing arrays into CUDA kernels. In order to be able to access these structure’s arrays inside the kernels, I convert them to CuDeviceArrays using cudaconvert fu…

---

## [Is it worth trying to speed up setindex for arrays of numbers where an array is overwritten with another?](https://discourse.julialang.org/t/is-it-worth-trying-to-speed-up-setindex-for-arrays-of-numbers-where-an-array-is-overwritten-with-another/62665)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 0\
**Last updated:** [June 10, 2021, 10:05am UTC](https://discourse.julialang.org/t/is-it-worth-trying-to-speed-up-setindex-for-arrays-of-numbers-where-an-array-is-overwritten-with-another/62665 "2021-06-10T10:05:39Z")

</div>

Arrays of numbers (often bitstype) are fairly common in numerical work, eg Array{Float64}. I’m thinking of an operation such as julia\> a = ones(1000, 1000); julia\> b = copy(a); julia\> @btime $a\[:,:\] = $b; 1.877 ms …

---

## [How to save a 24 bit wav file?](https://discourse.julialang.org/t/how-to-save-a-24-bit-wav-file/62583)

<div class="topic-metadata">

**Author:** [@D\_A](https://discourse.julialang.org/u/D_A)\
**Replies:** 3\
**Last updated:** [June 10, 2021, 10:49am UTC](https://discourse.julialang.org/t/how-to-save-a-24-bit-wav-file/62583 "2021-06-10T10:49:14Z")

</div>

Hello, After opening a wav file (24 bit depth) with the LibSndFile library (and not WAV because I get InexactError when reading some files that are opened well with LibSndFile), the data is in 32 bit format (Q0f31 (alia…

---

## [Discussion: Parallel reductions using semidirect products](https://discourse.julialang.org/t/discussion-parallel-reductions-using-semidirect-products/62654)

<div class="topic-metadata">

**Author:** [@tkf](https://discourse.julialang.org/u/tkf)\
**Replies:** 0\
**Last updated:** [June 10, 2021, 2:55am UTC](https://discourse.julialang.org/t/discussion-parallel-reductions-using-semidirect-products/62654 "2021-06-10T02:55:38Z")

</div>

Hi, I just wrote a discussion on Parallel reductions using semidirect products: Solutions to many parallel programming problems can be reduced to a well-designed monoid. As such, interesting parallel solution sometimes…

---

## [Can't install Julia on work PC. No Github access or General Registry. Solutions?](https://discourse.julialang.org/t/cant-install-julia-on-work-pc-no-github-access-or-general-registry-solutions/62653)

<div class="topic-metadata">

**Author:** [@liviomaya](https://discourse.julialang.org/u/liviomaya)\
**Replies:** 6\
**Last updated:** [June 10, 2021, 5:08am UTC](https://discourse.julialang.org/t/cant-install-julia-on-work-pc-no-github-access-or-general-registry-solutions/62653 "2021-06-10T05:08:41Z")

</div>

I love using Julia and want to use it on work. But my company blocks access to most Github repositories. Moreover, when I install Julia, I do not even get the general registry - probably some other website blocked. And e…

---

## [Implementing iterative algorithms using Base.Iterators concepts](https://discourse.julialang.org/t/implementing-iterative-algorithms-using-base-iterators-concepts/62575)

<div class="topic-metadata">

**Author:** [@imcinerney](https://discourse.julialang.org/u/imcinerney)\
**Replies:** 3\
**Last updated:** [June 10, 2021, 4:24am UTC](https://discourse.julialang.org/t/implementing-iterative-algorithms-using-base-iterators-concepts/62575 "2021-06-10T04:24:24Z")

</div>

I was noticing that some packages implement their iterative algorithms using the Base.Iterators methods by defining the algorithm iteration inside an iterate function and then using that to iterate it. Others implement e…

---

## [Sparse linear algebra question lu(::SparseMatrixCSC)](https://discourse.julialang.org/t/sparse-linear-algebra-question-lu-sparsematrixcsc/62625)

<div class="topic-metadata">

**Author:** [@Thomas](https://discourse.julialang.org/u/Thomas)\
**Replies:** 1\
**Last updated:** [June 9, 2021, 2:44pm UTC](https://discourse.julialang.org/t/sparse-linear-algebra-question-lu-sparsematrixcsc/62625 "2021-06-09T14:44:07Z")

</div>

I got this strange error using SparseArrays M = sprand(3,16,0.5) lu(M) lu(M’) ERROR: MethodError: no method matching lu!(::SparseMatrixCSC{Float64, Int64}, ::Val{true}; check=true) Does anybody know why?

---

## [What is the easiest way to read ABC notation files in Julia?Example\`\`\`X:1T:Alex](https://discourse.julialang.org/t/what-is-the-easiest-way-to-read-abc-notation-files-in-julia-example-xalex/55880)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 0\
**Last updated:** [February 23, 2021, 7:42pm UTC](https://discourse.julialang.org/t/what-is-the-easiest-way-to-read-abc-notation-files-in-julia-example-xalex/55880 "2021-02-23T19:42:25Z")

</div>

What is the easiest way to read ABC notation files in Julia? Example X:1 T:Alexander's Z: id:dc-hornpipe-1 M:C| L:1/8 K:D Major (3ABc|dAFA DFAd|fdcd FAdf|gfge fefd|(3efe (3dcB A2 (3ABc|! dAFA DFAd|fdcd FAdf|gfge fefd|(…

---

## [Which Solution Does \`\\\` Return?](https://discourse.julialang.org/t/which-solution-does-return/61902)

<div class="topic-metadata">

**Author:** [@RoyiAvital](https://discourse.julialang.org/u/RoyiAvital)\
**Replies:** 1\
**Last updated:** [June 10, 2021, 1:30am UTC](https://discourse.julialang.org/t/which-solution-does-return/61902 "2021-06-10T01:30:02Z")

</div>

I saw this insightful discussion on Slack (Made some editing for clarity): @baggepinnen : The \\ (Operator) should produce the minimum norm solution if many exist, and that’s what it does. @RoyiAvital : I am not su…

---

## [Logging with custom messages](https://discourse.julialang.org/t/logging-with-custom-messages/62637)

<div class="topic-metadata">

**Author:** [@Enrique](https://discourse.julialang.org/u/Enrique)\
**Replies:** 2\
**Last updated:** [June 10, 2021, 1:27am UTC](https://discourse.julialang.org/t/logging-with-custom-messages/62637 "2021-06-10T01:27:26Z")

</div>

Hello Julia community, I read the logging documentation, but I am still struggling to create a custom logger. Basically, what I want to do is to replicate what I do in python, that is, to create a logger on info level, …

---

## [Subtract the Column Wise Mean of a Large Matrix](https://discourse.julialang.org/t/subtract-the-column-wise-mean-of-a-large-matrix/61740)

<div class="topic-metadata">

**Author:** [@RoyiAvital](https://discourse.julialang.org/u/RoyiAvital)\
**Replies:** 0\
**Last updated:** [May 24, 2021, 7:04pm UTC](https://discourse.julialang.org/t/subtract-the-column-wise-mean-of-a-large-matrix/61740 "2021-05-24T19:04:07Z")

</div>

As a service to export from a nice discussion (Not by me) in Slack. I need to take a large matrix and subtract the mean columnwise and inplace. Is there a fast way to do this? By columnwise I mean taking the mean o…

---

## [Optim.jl vs scipy.optimize once again](https://discourse.julialang.org/t/optim-jl-vs-scipy-optimize-once-again/61661)

<div class="topic-metadata">

**Author:** [@rht](https://discourse.julialang.org/u/rht)\
**Replies:** 54\
**Last updated:** [June 10, 2021, 12:23am UTC](https://discourse.julialang.org/t/optim-jl-vs-scipy-optimize-once-again/61661 "2021-06-10T00:23:27Z")

</div>

I have been using Python’s scipy.optimize.minimize(method="LBFGSB") for my research, and have been looking to speed the code because it doesn’t scale. And so I tried to rewrite my code in Julia using Optim.jl, with Opti…

---

## [Array processing](https://discourse.julialang.org/t/array-processing/62643)

<div class="topic-metadata">

**Author:** [@neophytedave](https://discourse.julialang.org/u/neophytedave)\
**Replies:** 1\
**Last updated:** [June 9, 2021, 8:24pm UTC](https://discourse.julialang.org/t/array-processing/62643 "2021-06-09T20:24:01Z")

</div>

Please see Vocabulary/ArrayProcessing - J Wiki. How do Julia and (I suppose) other languages deal with this?

---

## [JuliaPro bug where screen goes black](https://discourse.julialang.org/t/juliapro-bug-where-screen-goes-black/62640)

<div class="topic-metadata">

**Author:** [@rezabayani](https://discourse.julialang.org/u/rezabayani)\
**Replies:** 1\
**Last updated:** [June 9, 2021, 7:50pm UTC](https://discourse.julialang.org/t/juliapro-bug-where-screen-goes-black/62640 "2021-06-09T19:50:49Z")

</div>

I have been using JuliaPro version 1.5.1-4 for a couple weeks now and I encounter this frustrating bug where after working a while on some .jl file, when I try to preview the values of a vector/array/…, the code disappea…

---

## [Iterating over a Tree recursively with Base.iterate](https://discourse.julialang.org/t/iterating-over-a-tree-recursively-with-base-iterate/62512)

<div class="topic-metadata">

**Author:** [@BALLsyman](https://discourse.julialang.org/u/BALLsyman)\
**Replies:** 8\
**Last updated:** [June 9, 2021, 7:42pm UTC](https://discourse.julialang.org/t/iterating-over-a-tree-recursively-with-base-iterate/62512 "2021-06-09T19:42:10Z")

</div>

I want to implement Base.iterate so that it can recursively iterate over a tree - it seems to me that gives the best performance. The type is defined as follows: mutable struct node next::Union{node,Missing} fi…

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

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