PhysicalConstants package with Julia 1.0.1.1?

Hello,

I’ve been using thePhysicalConstants.jl package for some time now, and greatly appreciate the ability to define CGS or MKS units. We use CGS units in astrophysics.

The PhysicalConstants package was developed about 3 years ago - I think Julia was in beta? I’ve been able to install and use it up to Julia 1.0.1.


However, I can’t seem to install it with Julia 1.0.1.1. Is there a way around this error? Also, I would appreciate any recommendations for similar packages.

That package seems to be abandoned, however there is another package with the same name that is still under active development:

https://github.com/JuliaPhysics/PhysicalConstants.jl

This new package fully hooks into the Unitful.jl ecosystem, so it should be possible to convert the constants into whichever unit system suits you best.

2 Likes

My download experience for Unitful:

Press Enter to start Julia.
Starting Julia...
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.0.1 (2018-09-29)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(JuliaPro_v1.0.1.1) pkg> st
    Status `J:\JuliaPro-1.0.1.1\pkgs-1.0.1.1\environments\JuliaPro_v1.0.1.1\Project.toml`
  [c52e3926] Atom v0.7.6
  [682c06a0] JSON v0.19.0
  [e5e0dc1b] Juno v0.5.3

(JuliaPro_v1.0.1.1) pkg> add Unitful
  Updating registry at `J:\JuliaPro-1.0.1.1\pkgs-1.0.1.1\registries\JuliaPro`
  Updating git-repo `https://pkg.juliacomputing.com/registry/JuliaPro`
ERROR: The following package names could not be resolved:
 * Unitful (not found in project, manifest or registry)
Please specify by known `name=uuid`.

(JuliaPro_v1.0.1.1) pkg>

Use:

JuliaPro-v1.0.1.1

Windows 10 - x64

1 Like

Apparently JuliaPro does not come with the General package registry, so you only have access to a subset of packages.

1 Like

Yes, JuliaRun uses a smaller registry of supported packages. We do need to

a) document this better
b) document the list of packages
c) document a way to switching to the General registry.

All of this is forthcoming. Apologies for the trouble, but we wanted to get the bits out while we round out the documentation around it.

Regards

Avik

1 Like

Where does the Julia Computing registry live?

So can I change the Julia_Pkg_Server in JuliaPro?

It appears that you can switch to the General registry in JuliaPro by deleting the following folder:

C:\Users\Name\AppData\Local\JuliaPro-1.0.1.1\pkgs-1.0.1.1\registries

Next time you use add <package> it will clone the General registry before attempting to install the requested package.

It really, really, really, really would be a good idea to flag the specialist package registry to Juliapro users. I have just spent half a day wondering what had gone wrong.

I am a bit bewildered as to what the logic for a different registry is?

1 Like

Everytime I see the headline Julia 1.0.1.1 I think there has been a new minor-minor release of Julia. Then I realize it’s just JuliaPro.

1 Like

We do want JuliaPro to track the version of Julia it is bundled with, but yet also have something distinguish it from base Julia. Hence the slightly longer version number. But I’m happy to hear suggestions of doing that better – I realise four digits makes it a bit too long and awkward.

1 Like

In Debian they use x.y.z-r, where x.y.z is the version of the unmodified upstream package, r is the Debian revision: 1.0.1-1. The - in place of the . makes it a bit clearer the difference. Another option, always stolen from Debian packages naming, is to append “+pro” and then the revision number: 1.0.1+pro1. A bit more verbose, but unambiguous.

What is nice is that, contrary to 1.0.1.1, both 1.0.1-1 and 1.0.1+pro1 are valid VersionNumber:

julia> dump(v"1.0.1-1")
VersionNumber
  major: UInt32 0x00000001
  minor: UInt32 0x00000000
  patch: UInt32 0x00000001
  prerelease: Tuple{UInt64}
    1: UInt64 0x0000000000000001
  build: Tuple{} ()

julia> dump(v"1.0.1+pro1")
VersionNumber
  major: UInt32 0x00000001
  minor: UInt32 0x00000000
  patch: UInt32 0x00000001
  prerelease: Tuple{} ()
  build: Tuple{String}
    1: String "pro1"

julia> dump(v"1.0.1.1")
ERROR: LoadError: ArgumentError: invalid version string: 1.0.1.1
Stacktrace:
 [1] VersionNumber(::String) at ./version.jl:111
 [2] @v_str(::LineNumberNode, ::Module, ::Any) at ./version.jl:138
in expression starting at REPL[10]:100:
3 Likes

For the record, the first version of PhysicalConstants.jl has been release (see the announcement).

1 Like

Thanks. I’ll note that I liked Andrew Collier’s version because it permitted users to specify CGS or MKS units.

That package literally knows nothing of units, just provides the values of constants in different unit systems. You have to manually do any conversion.

PhysicalConstants.jl relies on Unitful.jl for dealing with units, which is more robust and less error-prone. Maybe within Unitful.jl there could be a way to choose a base unit system, but I don’t have a strong feeling about this. I just want to be able to use a constant without constantly checking that I’m not messing up units