# General Usage

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

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

**Page:** 744

---

## [Package name conflicts](https://discourse.julialang.org/t/package-name-conflicts/40921)

<div class="topic-metadata">

**Author:** [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Replies:** 1\
**Last updated:** [June 7, 2020, 11:10am UTC](https://discourse.julialang.org/t/package-name-conflicts/40921 "2020-06-07T11:10:59Z")

</div>

A recent discussion in another thread made me wonder: what are the limitations of the support for duplicated package names, and the practical problems of their possible existence? In the documentation of Pkg and in the J…

---

## [Makie Problem](https://discourse.julialang.org/t/makie-problem/40917)

<div class="topic-metadata">

**Author:** [@Jojo\_Dad](https://discourse.julialang.org/u/Jojo_Dad)\
**Replies:** 1\
**Last updated:** [June 7, 2020, 9:17am UTC](https://discourse.julialang.org/t/makie-problem/40917 "2020-06-07T09:17:09Z")

</div>

When I run import Pkg; Pkg.add("Makie") using Makie I get InitError: could not load library "/Users/jojo/.julia/artifacts/dbb254dca678145c7d79410e96da494cc94f8a13/lib/libavdevice.58.5.100.dylib" dlopen(/Users/jojo/.ju…

---

## [Simplifying Constructors](https://discourse.julialang.org/t/simplifying-constructors/40907)

<div class="topic-metadata">

**Author:** [@virtualgraham](https://discourse.julialang.org/u/virtualgraham)\
**Replies:** 3\
**Last updated:** [June 7, 2020, 7:20am UTC](https://discourse.julialang.org/t/simplifying-constructors/40907 "2020-06-07T07:20:21Z")

</div>

Is there a better way to define a constructor that allows for optional params or a small amount of logic without having to rewrite all the properties three times? mutable struct AcRepertoireIrreducibilityAnalysis \<: Ord…

---

## [Can not convert an object of type Tuple{Int64, Int64} to an object of type Tuple{}](https://discourse.julialang.org/t/can-not-convert-an-object-of-type-tuple-int64-int64-to-an-object-of-type-tuple/22990)

<div class="topic-metadata">

**Author:** [@bsnyh](https://discourse.julialang.org/u/bsnyh)\
**Replies:** 9\
**Last updated:** [June 7, 2020, 3:08am UTC](https://discourse.julialang.org/t/can-not-convert-an-object-of-type-tuple-int64-int64-to-an-object-of-type-tuple/22990 "2020-06-07T03:08:30Z")

</div>

mutable struct myTp a::Vector{Int64} b::Tuple{Int64} #myTp() = new(\[\], ()) myTp(a,b) = new(a,b) end function main() c=myTp(\[1,2,3\],(4,5,6)) end main() Can anyone let me know why?

---

## [Why isn't the "setrounding" function working the way I expect?](https://discourse.julialang.org/t/why-isnt-the-setrounding-function-working-the-way-i-expect/40891)

<div class="topic-metadata">

**Author:** [@Lucas\_Queiroz](https://discourse.julialang.org/u/Lucas_Queiroz)\
**Replies:** 13\
**Last updated:** [June 7, 2020, 3:07am UTC](https://discourse.julialang.org/t/why-isnt-the-setrounding-function-working-the-way-i-expect/40891 "2020-06-07T03:07:06Z")

</div>

Why does Julia rounds 0.3 down in my code? julia\> setrounding(BigFloat, RoundUp) MPFRRoundUp::MPFRRoundingMode = 2 julia\> BigFloat(0.3) 0.299999999999999988897769753748434595763683319091796875

---

## [easy way to solve problems with tridiagonal matrix](https://discourse.julialang.org/t/easy-way-to-solve-problems-with-tridiagonal-matrix/15715)

<div class="topic-metadata">

**Author:** [@sahaskn1](https://discourse.julialang.org/u/sahaskn1)\
**Replies:** 4\
**Last updated:** [June 7, 2020, 2:18am UTC](https://discourse.julialang.org/t/easy-way-to-solve-problems-with-tridiagonal-matrix/15715 "2020-06-07T02:18:23Z")

</div>

I’m learning JuliaLang as an alternative to python for its speed. I would like to know if there exist functions in julia for tridiagonal matrix problem typically encountered in quantum kinetic energy operator in coordina…

---

## [Setting Julia version for JupyterLab](https://discourse.julialang.org/t/setting-julia-version-for-jupyterlab/40901)

<div class="topic-metadata">

**Author:** [@pauljurczak](https://discourse.julialang.org/u/pauljurczak)\
**Replies:** 2\
**Last updated:** [June 7, 2020, 1:47am UTC](https://discourse.julialang.org/t/setting-julia-version-for-jupyterlab/40901 "2020-06-07T01:47:35Z")

</div>

I have 2 versions of Julia installed, but only one is visible in JupyterLab. How do I make both of them visible or select the visible one?

---

## [Dependency Struggle in Local Registry](https://discourse.julialang.org/t/dependency-struggle-in-local-registry/40570)

<div class="topic-metadata">

**Author:** [@cortner](https://discourse.julialang.org/u/cortner)\
**Replies:** 4\
**Last updated:** [June 6, 2020, 9:11pm UTC](https://discourse.julialang.org/t/dependency-struggle-in-local-registry/40570 "2020-06-06T21:11:30Z")

</div>

I’m part of a small group maintaining our own registry for packages that are too specialised or not mature enough for General. Occasionally there are hiccups in managing dependencies, and here is another one - I hope som…

---

## [Passing a local to @cfunction fails](https://discourse.julialang.org/t/passing-a-local-to-cfunction-fails/40815)

<div class="topic-metadata">

**Author:** [@nabla](https://discourse.julialang.org/u/nabla)\
**Replies:** 6\
**Last updated:** [June 6, 2020, 8:01pm UTC](https://discourse.julialang.org/t/passing-a-local-to-cfunction-fails/40815 "2020-06-06T20:01:59Z")

</div>

I want to pass a local function via @cfunction to a library, but can’t do it. (This function is a callback, and should store some data as it’s called). Minimal non-working example of what I would like: const badlocalda…

---

## [Linear Algebra with custom scalar product](https://discourse.julialang.org/t/linear-algebra-with-custom-scalar-product/40836)

<div class="topic-metadata">

**Author:** [@Mikhail\_Kagalenko](https://discourse.julialang.org/u/Mikhail_Kagalenko)\
**Replies:** 7\
**Last updated:** [June 6, 2020, 6:33pm UTC](https://discourse.julialang.org/t/linear-algebra-with-custom-scalar-product/40836 "2020-06-06T18:33:01Z")

</div>

Borrowing an example from the popular talk, let’s say I want to use LinearAlgebra.qr() , but with three-argument dot() introduced in Julia 1.4. So I need to define my own CustomVector that carries within it the middle ar…

---

## [Specifying a branch of a package in Project.toml](https://discourse.julialang.org/t/specifying-a-branch-of-a-package-in-project-toml/32101)

<div class="topic-metadata">

**Author:** [@Sheemon7](https://discourse.julialang.org/u/Sheemon7)\
**Replies:** 2\
**Last updated:** [June 6, 2020, 5:00pm UTC](https://discourse.julialang.org/t/specifying-a-branch-of-a-package-in-project-toml/32101 "2020-06-06T17:00:36Z")

</div>

Is it possible to force a specific development branch of a package in Project.toml file?

---

## [Reducing BitArray with xor](https://discourse.julialang.org/t/reducing-bitarray-with-xor/20354)

<div class="topic-metadata">

**Author:** [@ethomag](https://discourse.julialang.org/u/ethomag)\
**Replies:** 5\
**Last updated:** [June 6, 2020, 3:26pm UTC](https://discourse.julialang.org/t/reducing-bitarray-with-xor/20354 "2020-06-06T15:26:37Z")

</div>

I am trying to xor a number of BitArray{1} vectors julia\> a=BitArray(\[1 1;1 0\]) 2×2 BitArray{2}: true true true false julia\> reduce(⊻, a, dims=1) ERROR: MethodError: no method matching reducedim\_init(::typeof(id…

---

## [AOT Compiling? Performance Comparison](https://discourse.julialang.org/t/aot-compiling-performance-comparison/40870)

<div class="topic-metadata">

**Author:** [@ok\_ok](https://discourse.julialang.org/u/ok_ok)\
**Replies:** 3\
**Last updated:** [June 6, 2020, 3:08pm UTC](https://discourse.julialang.org/t/aot-compiling-performance-comparison/40870 "2020-06-06T15:08:08Z")

</div>

Hello Guys, i want to make a Comparison between OOP and Functional Programming. For my Performance Part i wrote an Algorithm in C++ which can run on N threads. I want to write the same code (the logic behind) in Julia a…

---

## [Problem with loops or to modify the argumments of a function](https://discourse.julialang.org/t/problem-with-loops-or-to-modify-the-argumments-of-a-function/40834)

<div class="topic-metadata">

**Author:** [@Josa9321](https://discourse.julialang.org/u/Josa9321)\
**Replies:** 6\
**Last updated:** [June 6, 2020, 12:21am UTC](https://discourse.julialang.org/t/problem-with-loops-or-to-modify-the-argumments-of-a-function/40834 "2020-06-06T00:21:53Z")

</div>

I’m coding a Genetic Algorithm. When i put: new\_generation = \[crossing(population\[p\[1\]\], population\[p\[2\]\]) for p in parents\] My code works just fine, but I think that line, always declaring a new vector to every iterat…

---

## [Can I add multiple package's SnoopCompile precompile scripts to one?](https://discourse.julialang.org/t/can-i-add-multiple-packages-snoopcompile-precompile-scripts-to-one/40832)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 3\
**Last updated:** [June 5, 2020, 11:27pm UTC](https://discourse.julialang.org/t/can-i-add-multiple-packages-snoopcompile-precompile-scripts-to-one/40832 "2020-06-05T23:27:42Z")

</div>

I’m trying to better understand SnoopCompile. It seems @snooping on my package creates alot of precompile statements in other modules, and my gut feeling is that for my case these are the really important ones in terms o…

---

## [New Julia User Cannot Add any Packages](https://discourse.julialang.org/t/new-julia-user-cannot-add-any-packages/40365)

<div class="topic-metadata">

**Author:** [@CosmoProf](https://discourse.julialang.org/u/CosmoProf)\
**Replies:** 13\
**Last updated:** [June 5, 2020, 8:19pm UTC](https://discourse.julialang.org/t/new-julia-user-cannot-add-any-packages/40365 "2020-06-05T20:19:35Z")

</div>

Hi, I’ve tried installing Julia on multiple computer systems, and I keep getting error messages whenever I try to add any packages. Everything seems to go wrong after downloading “MbedTLS”, I tried methods suggested all…

---

## [Why can I not add methods to a function with a value?](https://discourse.julialang.org/t/why-can-i-not-add-methods-to-a-function-with-a-value/40819)

<div class="topic-metadata">

**Author:** [@derikk](https://discourse.julialang.org/u/derikk)\
**Replies:** 4\
**Last updated:** [June 5, 2020, 4:14pm UTC](https://discourse.julialang.org/t/why-can-i-not-add-methods-to-a-function-with-a-value/40819 "2020-06-05T16:14:18Z")

</div>

I was trying to add a method to a function that accepts strings but not integers to convert integers to strings if necessary. For instance, given f = reverse, I get 16 methods, none of which apply to numerical types. N…

---

## [Where is julia specific documentation for Jupyter notebook?](https://discourse.julialang.org/t/where-is-julia-specific-documentation-for-jupyter-notebook/40749)

<div class="topic-metadata">

**Author:** [@devel-chm](https://discourse.julialang.org/u/devel-chm)\
**Replies:** 11\
**Last updated:** [June 5, 2020, 4:12pm UTC](https://discourse.julialang.org/t/where-is-julia-specific-documentation-for-jupyter-notebook/40749 "2020-06-05T16:12:23Z")

</div>

I have been using the Jupyter notebook interface to learn Julia and to document what I have learned and done/fixed. I had started with the julia REPL from a mintty terminal (cygwin) on win7 but was not able to iterate a…

---

## [(Not) concatenating arrays](https://discourse.julialang.org/t/not-concatenating-arrays/40803)

<div class="topic-metadata">

**Author:** [@sparrowhawk](https://discourse.julialang.org/u/sparrowhawk)\
**Replies:** 3\
**Last updated:** [June 5, 2020, 1:54pm UTC](https://discourse.julialang.org/t/not-concatenating-arrays/40803 "2020-06-05T13:54:21Z")

</div>

I have a large Vector{Float64} called x, a few elements of which remain unchanged within a loop. I would like the remaining elements to reflect the values in another array b, before passing on to a function within the lo…

---

## [Parallel reductions on CPUs with different speeds](https://discourse.julialang.org/t/parallel-reductions-on-cpus-with-different-speeds/40722)

<div class="topic-metadata">

**Author:** [@hcarlsso](https://discourse.julialang.org/u/hcarlsso)\
**Replies:** 6\
**Last updated:** [June 5, 2020, 1:34pm UTC](https://discourse.julialang.org/t/parallel-reductions-on-cpus-with-different-speeds/40722 "2020-06-05T13:34:02Z")

</div>

I am looking for how to “load balance” parallel reduction on multiple CPUs that have different speeds. The following snippet illustrates the problem: using Distributed addprocs(3) res = @time @distributed (+) for (t, n…

---

## [Mac or Windows for better Julia experience?](https://discourse.julialang.org/t/mac-or-windows-for-better-julia-experience/40404)

<div class="topic-metadata">

**Author:** [@Alvaro\_Jose\_Gonzalez](https://discourse.julialang.org/u/Alvaro_Jose_Gonzalez)\
**Replies:** 19\
**Last updated:** [June 5, 2020, 12:45pm UTC](https://discourse.julialang.org/t/mac-or-windows-for-better-julia-experience/40404 "2020-06-05T12:45:19Z")

</div>

Hello All, I have been working with Julia on Windows for about 3 years, more specifically with JuMP for energy systems optimization. There has always been a pain to install some packages and some “unusual tricks” are r…

---

## [Contourplot on a Sphere in Makie.jl](https://discourse.julialang.org/t/contourplot-on-a-sphere-in-makie-jl/40801)

<div class="topic-metadata">

**Author:** [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Replies:** 0\
**Last updated:** [June 5, 2020, 10:37am UTC](https://discourse.julialang.org/t/contourplot-on-a-sphere-in-makie-jl/40801 "2020-06-05T10:37:16Z")

</div>

I recently tried to get started with Makie, since I love the approach and it seems to be fairly huge in features. However, I sometimes struggle in details I have some data on a sphere, let’s say I have a function F defi…

---

## [Difference between @view and view](https://discourse.julialang.org/t/difference-between-view-and-view/40798)

<div class="topic-metadata">

**Author:** [@sparrowhawk](https://discourse.julialang.org/u/sparrowhawk)\
**Replies:** 2\
**Last updated:** [June 5, 2020, 9:27am UTC](https://discourse.julialang.org/t/difference-between-view-and-view/40798 "2020-06-05T09:27:38Z")

</div>

If A = \[1,2; 3 4\] What is the difference between b = view(A, :, 1) and b = @view A\[:,1\] Is the macro form just shorthand for the other? Thanks

---

## [OutOfMemory(): How to inspect environment memory?](https://discourse.julialang.org/t/outofmemory-how-to-inspect-environment-memory/40738)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 7\
**Last updated:** [June 5, 2020, 8:12am UTC](https://discourse.julialang.org/t/outofmemory-how-to-inspect-environment-memory/40738 "2020-06-05T08:12:43Z")

</div>

I run into an OutOfMemory error when running an algorithm several times. Everything happens inside functions so I don’t understand why and I would like to inspect what has accumulated in the memory. The error is triggere…

---

## [“using” expression not at top level](https://discourse.julialang.org/t/using-expression-not-at-top-level/40657)

<div class="topic-metadata">

**Author:** [@stv1314](https://discourse.julialang.org/u/stv1314)\
**Replies:** 4\
**Last updated:** [June 5, 2020, 6:55am UTC](https://discourse.julialang.org/t/using-expression-not-at-top-level/40657 "2020-06-05T06:55:11Z")

</div>

Can any body tell me what’s wrong with this?

---

## [Include a C++ function in a Stan code](https://discourse.julialang.org/t/include-a-c-function-in-a-stan-code/40782)

<div class="topic-metadata">

**Author:** [@99dB](https://discourse.julialang.org/u/99dB)\
**Replies:** 2\
**Last updated:** [June 5, 2020, 4:11am UTC](https://discourse.julialang.org/t/include-a-c-function-in-a-stan-code/40782 "2020-06-05T04:11:39Z")

</div>

Dear all, I need to include a C++ function in a stan code but I don’t know how I can do it. The function is remainder and then I include the associated library but I get this error: SystemError: opening file "\<cmath\>"…

---

## [How Julia call Pybind11 code?](https://discourse.julialang.org/t/how-julia-call-pybind11-code/40787)

<div class="topic-metadata">

**Author:** [@agdkyang](https://discourse.julialang.org/u/agdkyang)\
**Replies:** 1\
**Last updated:** [June 5, 2020, 3:51am UTC](https://discourse.julialang.org/t/how-julia-call-pybind11-code/40787 "2020-06-05T03:51:15Z")

</div>

Pybind11 code : #include \<pybind11/embed.h\> #include namespace py = pybind11; extern “C”{ int init() { py::scoped\_interpreter python; auto math = py::module::import(“math”); double root\_two = math.attr(“sqrt”)(2…

---

## [Best performance using dictionaries, functions and modules](https://discourse.julialang.org/t/best-performance-using-dictionaries-functions-and-modules/40673)

<div class="topic-metadata">

**Author:** [@Joey](https://discourse.julialang.org/u/Joey)\
**Replies:** 8\
**Last updated:** [June 5, 2020, 3:39am UTC](https://discourse.julialang.org/t/best-performance-using-dictionaries-functions-and-modules/40673 "2020-06-05T03:39:20Z")

</div>

Hi everyone, I’m currently working on a program and need some help for better performance. As I switched from MATLAB to Julia, I don’t know if I am writting in a good way. I tried to write it similarly to MATLAB’s fashi…

---

## [Unable to save Unitful unit into a JLD file](https://discourse.julialang.org/t/unable-to-save-unitful-unit-into-a-jld-file/40706)

<div class="topic-metadata">

**Author:** [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)\
**Replies:** 9\
**Last updated:** [June 5, 2020, 2:51am UTC](https://discourse.julialang.org/t/unable-to-save-unitful-unit-into-a-jld-file/40706 "2020-06-05T02:51:38Z")

</div>

I am writing an application where the user may choose the length unit from among those provided by the Unitful package. I create a struct where the chosen length unit is stored in one of the fields. I found that when I…

---

## [DataFrames Package: \`getindex(df::DataFrame, col\_inds::Union{AbstractVector, Regex, Not})\` is deprecated](https://discourse.julialang.org/t/dataframes-package-getindex-df-dataframe-col-inds-union-abstractvector-regex-not-is-deprecated/40744)

<div class="topic-metadata">

**Author:** [@aebk2015](https://discourse.julialang.org/u/aebk2015)\
**Replies:** 8\
**Last updated:** [June 4, 2020, 10:53pm UTC](https://discourse.julialang.org/t/dataframes-package-getindex-df-dataframe-col-inds-union-abstractvector-regex-not-is-deprecated/40744 "2020-06-04T22:53:22Z")

</div>

I just started reading Julia for Machine Learning. and I am getting a series of deprecated warning just from the DataFrames package: The dataset the book uses for this example has to do with the strength of Wi-Fi sign…

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

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