New Install but Macro @vectorize_1arg not found

Hi, I have just installed Julia but I have a script with @vectorize_1arg Macro that it says is not defined. But looking at the Julia documentation it should be in the base install. Do I need any other packages, I already installed Compat, JLD and PyPlot, maybe that caused problems?

Thanks,

Matt

That script is probably written for an old version of Julia. The @vectorize_1arg macro does not exist anymore. You probably want to read up on broadcasting.

1 Like

The most reliable way to update a script which was written for an older version of Julia is:

  1. Download the version of Julia for which the script was written from https://julialang.org/downloads/oldreleases/ . If you don’t know which version to choose, you may be able to guess from the date. @vectorize_1arg was present in Julia 0.5, so that would be my best guess.
  2. Run the script with that version of Julia and make sure it works. If you get an deprecation warnings, fix them.
  3. Download the next Julia release: from 0.5, go to 0.6
  4. Run the script again with the new version of Julia and make sure it works. If you get any deprecation warnings, fix them.
  5. From Julia 0.6, go to Julia 0.7, then Julia 1.0, testing and fixing any deprecation warnings every time.

I realize that this sounds tedious (it may be), but it should reliably get arbitrarily old Julia code working correctly. The key is that every Julia version has helpful warnings to help you upgrade code from the previous Julia version, but if you try to skip directly from an older version to the latest one, you’ll miss those helpful warnings. That’s exactly what happened in your case: you are skipping from old code (probably Julia 0.5-era) to Julia 1.4, and so the compiler can’t easily tell you how to fix your code.

2 Likes

Thanks guys, yes that makes sense it was from around 2017 I downloaded from Github.

I guess it is a quick fix with using a dot product, which is what I think the broadcasting function does.

Good idea to run the old Julia compilers thanks for that.

Matt

Hey Robin,

I am trying to install older versions of Julia 0.3 and 0.6 which install ok but the problem I am having is installing packages for them. JLD doesn’t seem to be available directly from Github, maybe manually I could do it but not sure if that is a straight download to some Packages folder. I read a post about the manifest and project.toml files that also need modifying ?

Thanks,

Matt