# Error when "using Symbolics"

**URL:** <https://discourse.julialang.org/t/error-when-using-symbolics/109899>\
**Category:** New to Julia\
**Created:** [February 7, 2024, 10:46pm UTC](https://discourse.julialang.org/t/error-when-using-symbolics/109899 "2024-02-07T22:46:50Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![brombo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brombo/32/47867_2.png) [@brombo](https://discourse.julialang.org/u/brombo)\
**Post date:** [February 7, 2024, 10:46pm UTC](https://discourse.julialang.org/t/error-when-using-symbolics/109899/1 "2024-02-07T22:46:51Z")

</div>

I am trying to use the “Symbolics” package but when I have a program that consists only of the line “using Symbolics” I get the error -

WARNING: Method definition isapprox(IntervalSets.AbstractInterval{T} where T, IntervalSets.AbstractInterval{T} where T) in module IntervalSets at /home/brombo/.julia/packages/IntervalSets/viB6k/src/IntervalSets.jl:144 overwritten in module DomainSets at /home/brombo/.julia/packages/DomainSets/aafhp/src/domains/interval.jl:52.  
ERROR: Method overwriting is not permitted during Module precompilation. Use ` __precompile__ (false)` to opt-out of precompilation.  
WARNING: Method definition isapprox(IntervalSets.AbstractInterval{T} where T, IntervalSets.AbstractInterval{T} where T) in module IntervalSets at /home/brombo/.julia/packages/IntervalSets/viB6k/src/IntervalSets.jl:144 overwritten in module DomainSets at /home/brombo/.julia/packages/DomainSets/aafhp/src/domains/interval.jl:52.  
ERROR: Method overwriting is not permitted during Module precompilation. Use ` __precompile__ (false)` to opt-out of precompilation.

I don’t have a clue as to what to due next. Note I am running on ubuntu 22.04.  
I installed julia with “sudo snap install --classic julia” and “Pkg.add(“Symbolics”)” to add the symbolics package. I very ignorant with regard to julia. What should I do next.

---

<div class="post-metadata">

**Author:** ![jar1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jar1](https://discourse.julialang.org/u/jar1)\
**Post date:** [February 8, 2024, 12:24am UTC](https://discourse.julialang.org/t/error-when-using-symbolics/109899/2 "2024-02-08T00:24:25Z")

</div>

In Julia please run `versioninfo()` and `import Pkg; Pkg.status()` and report the results here.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [February 8, 2024, 10:36am UTC](https://discourse.julialang.org/t/error-when-using-symbolics/109899/3 "2024-02-08T10:36:19Z")

</div>

Those are just warnings. Did you have an error at all?

---

<div class="post-metadata">

**Author:** ![brombo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brombo/32/47867_2.png) [@brombo](https://discourse.julialang.org/u/brombo)\
**Post date:** [February 8, 2024, 12:35pm UTC](https://discourse.julialang.org/t/error-when-using-symbolics/109899/4 "2024-02-08T12:35:34Z")

</div>

ERROR: Method overwriting is not permitted during Module precompilation. Use ` __precompile__ (false)` to opt-out of precompilation.

ERROR: Method overwriting is not permitted during Module precompilation. Use ` __precompile__ (false)` to opt-out of precompilation.

I don’t know how to use ` __precompile__ (false)`. Where do you put the statement?

---

<div class="post-metadata">

**Author:** ![brombo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brombo/32/47867_2.png) [@brombo](https://discourse.julialang.org/u/brombo)\
**Post date:** [February 8, 2024, 12:37pm UTC](https://discourse.julialang.org/t/error-when-using-symbolics/109899/5 "2024-02-08T12:37:09Z")

</div>

Julia Version 1.10.0  
Commit 3120989f39b (2023-12-25 18:01 UTC)  
Build Info:  
Official [https://julialang.org/](https://julialang.org/) release  
Platform Info:  
OS: Linux (x86\_64-linux-gnu)  
CPU: 24 × AMD Ryzen 9 5900X 12-Core Processor  
WORD\_SIZE: 64  
LIBM: libopenlibm  
LLVM: libLLVM-15.0.7 (ORCJIT, znver3)  
Threads: 1 on 24 virtual cores

Status `~/.julia/environments/v1.10/Project.toml`  
[77e5a97a] AsyPlots v0.2.1  
[b964fa9f] LaTeXStrings v1.3.1  
[266f59ce] LaTeXTabulars v0.1.3  
[d2208f48] LatexPrint v1.1.0  
⌅ [23fbe1c1] Latexify v0.15.21  
[e9d8d322] Metatheory v2.0.2  
[9b87118b] PackageCompiler v2.1.17  
⌃ [91a5bcdd] Plots v1.40.0  
⌅ [d1185830] SymbolicUtils v0.11.3  
⌃ [0c5d862f] Symbolics v0.1.32  
Info Packages marked with ⌃ and ⌅ have new versions available. Those with ⌃ may be upgradable, but those with ⌅ are restricted by compatibility constraints from upgrading. To see why use `status --outdated`  
WARNING: Method definition isapprox(IntervalSets.AbstractInterval{T} where T, IntervalSets.AbstractInterval{T} where T) in module IntervalSets at /home/brombo/.julia/packages/IntervalSets/viB6k/src/IntervalSets.jl:144 overwritten in module DomainSets at /home/brombo/.julia/packages/DomainSets/aafhp/src/domains/interval.jl:52.  
ERROR: Method overwriting is not permitted during Module precompilation. Use ` __precompile__ (false)` to opt-out of precompilation.  
WARNING: Method definition isapprox(IntervalSets.AbstractInterval{T} where T, IntervalSets.AbstractInterval{T} where T) in module IntervalSets at /home/brombo/.julia/packages/IntervalSets/viB6k/src/IntervalSets.jl:144 overwritten in module DomainSets at /home/brombo/.julia/packages/DomainSets/aafhp/src/domains/interval.jl:52.  
ERROR: Method overwriting is not permitted during Module precompilation. Use ` __precompile__ (false)` to opt-out of precompilation.

---

<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:** [February 8, 2024, 1:17pm UTC](https://discourse.julialang.org/t/error-when-using-symbolics/109899/6 "2024-02-08T13:17:24Z")

</div>

> [@brombo](#):
>
> `⌃ [0c5d862f] Symbolics v0.1.32`

There’s your problem - the current Symbolics release is 5.16, so your version is way out of date. Do `]add Symbolics@5` to find out what’s blocking the update and remove that.

Even better, don’t install all your packages into the default environment but into project-specific environments instead to minimise version conflicts:

[https://pkgdocs.julialang.org/v1/environments/](https://pkgdocs.julialang.org/v1/environments/)

---

<div class="post-metadata">

**Author:** ![brombo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brombo/32/47867_2.png) [@brombo](https://discourse.julialang.org/u/brombo)\
**Post date:** [February 8, 2024, 1:38pm UTC](https://discourse.julialang.org/t/error-when-using-symbolics/109899/7 "2024-02-08T13:38:08Z")

</div>

I don’t know what you mean by `"]add Symbolics@5" that shows up in my email. Where and how do I input``"]add Symbolics@5" ?`

---

<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:** [February 8, 2024, 2:03pm UTC](https://discourse.julialang.org/t/error-when-using-symbolics/109899/8 "2024-02-08T14:03:55Z")

</div>

In the Julia REPL after just running `julia`.

You can also do the following.

```julia-repl
julia> using Pkg

julia> pkg"add Symbolics@5"

```

If that does not work, try this.

```julia-repl
julia> using Pkg

julia> pkg"activate @symbolics"

julia> pkg"add Symbolics"

julia> using Symbolics

```

In your script, you would then need to run the following.

```julia
using Pkg
Pkg.activate("symbolics", shared = true)
using Symbolics

```

---

<div class="post-metadata">

**Author:** ![brombo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brombo/32/47867_2.png) [@brombo](https://discourse.julialang.org/u/brombo)\
**Post date:** [February 8, 2024, 2:50pm UTC](https://discourse.julialang.org/t/error-when-using-symbolics/109899/9 "2024-02-08T14:50:04Z")

</div>

Thank you, your second suggestion worked.

---

<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:** [February 8, 2024, 8:17pm UTC](https://discourse.julialang.org/t/error-when-using-symbolics/109899/10 "2024-02-08T20:17:06Z")

</div>

To explain why this works, your original environment had many packages causing version incompatibilities. You ended up with an old version of Symbolics.jl.

By creating a new environment with just the packages you want, you reduce the potential conflicts.

---

<div class="post-metadata">

**Author:** ![brombo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brombo/32/47867_2.png) [@brombo](https://discourse.julialang.org/u/brombo)\
**Post date:** [February 9, 2024, 4:13pm UTC](https://discourse.julialang.org/t/error-when-using-symbolics/109899/11 "2024-02-09T16:13:51Z")

</div>

Please note that my background python and sympy and am trying to learn to use Symbolics.jl to accomplish sympy type tasks. I am trying to define a struct that has @variables as members. Here is my code -

#!/snap/bin/julia

using Pkg  
Pkg.activate(“symbolics”, shared = true)  
using Symbolics  
using SymbolicUtils

@variables W

struct Pdop  
vargs  
nargs::Int  
end

function prt(x::Pdop)  
println(x.vargs,’ ',x.nargs)  
end

function

pdx = Pdop(W,2)  
prt(pdx)

I don’t know what type vargs should be or how to make this legal. Also is there any way to give a variable an alias when printing like a LaTeX string. For example in sympy I can define -

th = symbol(r’\theta\_{el}')

Is there an equivalent in Symbolics.jl?

---

<div class="post-metadata">

**Author:** ![jar1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jar1](https://discourse.julialang.org/u/jar1)\
**Post date:** [February 9, 2024, 8:14pm UTC](https://discourse.julialang.org/t/error-when-using-symbolics/109899/12 "2024-02-09T20:14:27Z")

</div>

On Discourse please enclose your code with triple backticks

````julia
```
like this 
```

````

so it’s formatted like code and easier to read.

In julia you usually don’t need to put type annotations in function signatures

```julia
function prt(x)

```

is just fine.

To define another name for a variable you can do

```julia
julia> @variables θ
1-element Vector{Num}:
 θ

julia> const th = θ
θ

```

> [@brombo](#):
>
> I don’t know what type vargs should b

You can make it parametric like this

```julia
julia> struct Pdop{T}
           vargs::T
           nargs::Int
       end

```

> [@brombo](#):
>
> Please note that my background python and sympy and am trying to learn to use [Symbolics.jl](https://juliahub.com/ui/Packages/Symbolics) to accomplish sympy type tasks.

Fyi at this point sympy is much more mature and capable than Symbolics.jl, so don’t expect too much.

---

<div class="post-metadata">

**Author:** ![brombo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/brombo/32/47867_2.png) [@brombo](https://discourse.julialang.org/u/brombo)\
**Post date:** [February 9, 2024, 9:29pm UTC](https://discourse.julialang.org/t/error-when-using-symbolics/109899/13 "2024-02-09T21:29:24Z")

</div>

Thank you. Lots of things are becoming much clearer to me. At the moment what I want to use from Symbolic are the capability for algebraic manipulation, differentiation, and simplification.
