# Type problem running old julia codes

**URL:** <https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993>\
**Category:** General Usage\
**Tags:** question\
**Created:** [December 19, 2024, 1:30pm UTC](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993 "2024-12-19T13:30:36Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiang\_ming\_zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jiang_ming_zhang/32/204063_2.png) [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Post date:** [December 19, 2024, 1:30pm UTC](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993/1 "2024-12-19T13:30:36Z")

</div>

In running some old julia code (version 0.6.0), I encountered some error:

```julia
LoadError: UndefVarError: `T` not defined

```

The error comes from this line of code:

```julia
function ph_conjugate{T}(psi::Vector{T}, states::HaldaneSphereStatesListLLL)

```

I suspect that it is because the code is not compatible with the new versions of Julia.

Is it so? If yes, how to modify the code?

---

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [December 19, 2024, 1:45pm UTC](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993/2 "2024-12-19T13:45:55Z")

</div>

Yes, this changed going from version 0.6 to 0.7 (which became v1.0). After that the syntax `Foo{T}(...)` is reserved for type constructors. Regular function signatures must use the `where` clause like this:

```julia
function ph_conjugate(psi::Vector{T}, states::HaldaneSphereStatesListLLL) where {T}

```

See:

> <https://github.com/JuliaLang/julia/blob/master/HISTORY.md#julia-v070-release-notes>

(this link previews the 1.11 release notes, but the link should take you to the correct place)  
and

> **[Essentials · The Julia Language](https://docs.julialang.org/en/v1/base/base/#where)**
>
> Documentation for The Julia Language.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [December 19, 2024, 1:50pm UTC](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993/3 "2024-12-19T13:50:59Z")

</div>

If you just want to run it, you can install Julia 0.6 using:

```bash
juliaup add 0.6.0
juliaup default 0.6.0

```

If you want to port it to a new Julia version, perhaps change the title of your question?

---

<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:** [December 19, 2024, 3:46pm UTC](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993/4 "2024-12-19T15:46:56Z")

</div>

Related to what Uwe is suggesting here, you can try running your code on 0.7 - this should give you deprecation warning for all the things that changed between 0.6 and 0.7, which you can then fix up. Given that 0.7 became 1.0, there’s then a good chance that you can run your fixed up code on 1.11 (modulo breaking changes to packages that you’re using).

---

<div class="post-metadata">

**Author:** ![jiang\_ming\_zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jiang_ming_zhang/32/204063_2.png) [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Post date:** [December 20, 2024, 12:37am UTC](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993/5 "2024-12-20T00:37:30Z")

</div>

But how can I set my default back to the new version?

I am worried about the potential collision between the two versions.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [December 20, 2024, 5:07am UTC](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993/6 "2024-12-20T05:07:09Z")

</div>

> [@jiang\_ming\_zhang](#):
>
> But how can I set my default back to the new version?

```julia
juliaup default 1.11

```

or

```julia
juliaup default release

```

Or you keep the default to `release` and just run the old version with:

```julia
julia +0.6.0

```

You can even set defaults per folder:

```julia
juliaup override set 0.6.0 

```

sets a directory override for the current working directory to 0.6.0.

For more info see: [GitHub - JuliaLang/juliaup: Julia installer and version multiplexer](https://github.com/JuliaLang/juliaup?tab=readme-ov-file#using-juliaup)

---

<div class="post-metadata">

**Author:** ![jiang\_ming\_zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jiang_ming_zhang/32/204063_2.png) [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Post date:** [December 20, 2024, 5:47am UTC](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993/7 "2024-12-20T05:47:14Z")

</div>

where to run such commands?

cmd in windows? It does not work.

not in julia neither.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [December 20, 2024, 6:05am UTC](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993/8 "2024-12-20T06:05:27Z")

</div>

> [@jiang\_ming\_zhang](#):
>
> where to run such commands?

In the terminal. Of course you must have `juliaup` installed, otherwise it will not work.

```julia
winget install julia -s msstore

```

will install juliaup on Windows.

---

<div class="post-metadata">

**Author:** ![jiang\_ming\_zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jiang_ming_zhang/32/204063_2.png) [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Post date:** [December 20, 2024, 8:48am UTC](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993/9 "2024-12-20T08:48:04Z")

</div>

I have installed juliaup, but encountered another problem

```julia
C:\Users\jmzhang>julia add 0.6.0
Installing Julia 1.11.2+0.x64.w64.mingw32
^C
C:\Users\jmzhang>juliaup add 0.6.0
Error: '0.6.0' is not a valid Julia version or channel name.

C:\Users\jmzhang>juliaup add 0.6.0
Error: '0.6.0' is not a valid Julia version or channel name.

C:\Users\jmzhang>julia --version
Error: The Julia launcher failed to figure out which juliaup channel to use.

C:\Users\jmzhang>julia
Error: The Julia launcher failed to figure out which juliaup channel to use.

C:\Users\jmzhang>

```

Now I cannot even use julia. Possibly because of the mistake in

```julia
C:\Users\jmzhang>julia add 0.6.0
Installing Julia 1.11.2+0.x64.w64.mingw32
^C

```

---

<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:** [December 20, 2024, 9:07am UTC](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993/10 "2024-12-20T09:07:18Z")

</div>

> [@jiang\_ming\_zhang](#):
>
> ```julia
> C:\Users\jmzhang>juliaup add 0.6.0
> Error: '0.6.0' is not a valid Julia version or channel name.
> 
> ```

That’s because 0.6.0 is not a valid channel name:

```julia
~> juliaup list                                                                                                                       
 Channel Version
----------------------------------------------------
 0 0.7.0+0.x64.w64.mingw32
 0.7 0.7.0+0.x64.w64.mingw32
 0.7.0 0.7.0+0.x64.w64.mingw32
(...)

```

As I said above, if you are interested in running 0.6 code and using it in more recent, actually supported Julia releases, 0.7 is probably the most helpful version for you.

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [December 20, 2024, 9:12am UTC](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993/11 "2024-12-20T09:12:37Z")

</div>

Just curious, is there a rationale for juliaup only going as far back as 0.7? Considering how many minor versions are in v1 by now, is it much more of a burden to continue supporting more minor versions for v0, just for legacy code? I hadn’t learned Julia then, but a cursory look at old threads’ struggles to adjust to 0.7 would make me port things to v1 instead if the matching version is no longer an easy option.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [December 20, 2024, 9:33am UTC](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993/12 "2024-12-20T09:33:01Z")

</div>

At least on Linux, `juliaup` can install versions back to 0.3.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [December 20, 2024, 9:36am UTC](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993/13 "2024-12-20T09:36:12Z")

</div>

> [@jiang\_ming\_zhang](#):
>
> `C:\Users\jmzhang>julia add 0.6.0`

You typed `julia add 0.6.0`, but you need to type `juliaup add 0.6.0`.

Works fine on Linux:

```julia
ufechner@framework:~$ juliaup add 0.6.0
Installing Julia 0.6.0+0.x64.linux.gnu
ufechner@framework:~$ julia +0.6.0
               _
   _ _ _(_)_ | A fresh approach to technical computing
  (_) | (_) (_) | Documentation: https://docs.julialang.org
   _ _ _| |_ __ _ | Type "?help" for help.
  | | | | | | |/ _` | |
  | | |_| | | | (_| | | Version 0.6.0 (2017-06-19 13:05 UTC)
 _/ |\ __'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-pc-linux-gnu

julia> 

```

I just checked, and on Windows indeed 0.7.0 is the oldest available Julia version. Perhaps your code works on 0.7.0 ?

I created a bug report: [Julia 0.6.0 not available on Windows · Issue #1132 · JuliaLang/juliaup · GitHub](https://github.com/JuliaLang/juliaup/issues/1132)

---

<div class="post-metadata">

**Author:** ![jsjie](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jsjie/32/22477_2.png) [@jsjie](https://discourse.julialang.org/u/jsjie)\
**Post date:** [December 20, 2024, 9:47am UTC](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993/14 "2024-12-20T09:47:39Z")

</div>

Maybe irrelavant to this thread, but I just realise that a similar case indeed exists in python. While there are still some people using python 2.x, has anyone here worked with python 1.x or python 0.x? I believe they are no longer maintained now, though you can still get some of them, like [here for 0.9.1](https://github.com/smontanaro/python-0.9.1).  
My point is similar to Benny. Newer programming languages like python or Julia seem to put less emphasis on backward compatibility than old ones like Fortran, and according to [Semantic Versioning](https://semver.org/), the major version number is indeed reserved for this purpose (backward incompatibility). Besides, “Major version zero (0.y.z) is for initial development. Anything MAY change at any time. The public API SHOULD NOT be considered stable.”

In short:

1. It may not be a good idea to stick to legacy codes written in 0.x versions. It may be better to port them to newer versions.
2. For legacy code in 1.x versions and above, it may still be better to port them if the major version number have differed by larger than 1. For example, with Python 3 the current version, those code written in Python 1 should be ported instead of maintained. Luckily, Julia is still in 1.x and there are no such problems.

Unluckily, there may be much more codes written with Julia pre-1.0 than with python pre-2.0. I think the author of this thread has posed quite a lot of related problems in the forum, and I’m somehow curious about how large his legacy code base is.

---

<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:** [December 20, 2024, 10:48am UTC](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993/15 "2024-12-20T10:48:20Z")

</div>

That’s a surprise but I can reproduce this:

```julia
~> juliaup add 0.6.0                                                                                                                                                                         
Error: '0.6.0' is not a valid Julia version or channel name.

~> juliaup add 0.7.0                                                                                                                                                                       
Installing Julia 0.7.0+0.x64.w64.mingw32

~> ubuntu                                                                                                                                                                                    
Welcome to Ubuntu 22.04.5 LTS (GNU/Linux 5.15.167.4-microsoft-standard-WSL2 x86_64)

ngudat@PC-PW0AKFMK:~$ juliaup add 0.6.0
Installing Julia 0.6.0+0.x64.linux.gnu

```

I maintain my recommendation of installing 0.7 though (and even if you go for 0.6, just to `0.6` and not `0.6.0`, no reason not to use the latest patch release)

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [December 20, 2024, 10:52am UTC](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993/16 "2024-12-20T10:52:57Z")

</div>

For what it’s worth I cannot reproduce:

```julia
$ juliaup add 0.6.0
Installing Julia 0.6.0+0.x64.linux.gnu

```

---

<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:** [December 20, 2024, 11:09am UTC](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993/17 "2024-12-20T11:09:29Z")

</div>

Very odd - I thought maybe my `juliaup` was out of date, but `juliaup self update` says no updates available. I also can’t see any way to refresh the list of available versions.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [December 20, 2024, 12:01pm UTC](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993/18 "2024-12-20T12:01:39Z")

</div>

Julia 0.6.0 is available via juliaup for Linux, but not for Windows. Version 0.7.0 is the oldest version available for Windows.

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [December 20, 2024, 12:22pm UTC](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993/19 "2024-12-20T12:22:29Z")

</div>

> [@ufechner7](#):
>
> Julia 0.6.0 is available for Linux, but not for Windows

Just to clarify, this is about juliaup. [The old releases page](https://julialang.org/downloads/oldreleases/) seems to have binaries for almost everything (I did not check if the links still work). Interesting that macOS has v0.1, Windows showed up at v0.2, Linux at v0.3, I’d expect the order to be reversed.

---

<div class="post-metadata">

**Author:** ![jiang\_ming\_zhang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jiang_ming_zhang/32/204063_2.png) [@jiang\_ming\_zhang](https://discourse.julialang.org/u/jiang_ming_zhang)\
**Post date:** [December 23, 2024, 2:07am UTC](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993/20 "2024-12-23T02:07:48Z")

</div>

Now I want to switch back to my latest julia. It does not work.

```julia
C:\Users\jmzhang>juliaup default 1.10
Error: '1.10' is not an installed Julia version, run `juliaup add 1.10` first.

C:\Users\jmzhang>juliaup default 1.11
Error: '1.11' is not an installed Julia version, run `juliaup add 1.11` first.

C:\Users\jmzhang>juliaup default release
Error: 'release' is not an installed Julia version, run `juliaup add release` first.

C:\Users\jmzhang>julia --version
julia version 0.7.0

C:\Users\jmzhang>julia --install
ERROR: unknown option `--install`

C:\Users\jmzhang>juliaup status
 Default Channel Version Update
---------------------------------------------------
       * 0.7 0.7.0+0.x64.w64.mingw32

```

[Next page](https://discourse.julialang.org/t/type-problem-running-old-julia-codes/123993.md?page=2)
