It does not apply to using a different julia version (if you need that, use StableRNGs.jl).
Got it, thanks for clarifying.
My confusion in that sentence was related to this part of the Pkg.jl
documentation, which says that you can also specify a julia version in Package.toml
:
Compatibility for a dependency is entered in the Project.toml
file as for example:
[compat]
julia = "1.0"
Example = "0.4.3"
I had thought the statement about reproducibility of random numbers meant that if I included a julia version as above, then I would get the same sequence of random numbers. If that’s not actually true, then what is the intended use-case for this?
[compat]
julia = "1.0"
No, that should definitely work (no minor julia release should be breaking) - what kind of error do you get? Please post it in full.
In theory, some package could have set an upper bound on the julia version, though that shouldn’t be the case (unless it’s upperbounding to the next major version, i.e. all 1.x.y are ok but 2.x are not).
My project has a lot of code, so I tried to whittle it down to a minimal-ish working example.
It has something to do with the Manifest.toml
(which is too large to post). Leaving the Project.toml
was sufficient and necessary to reproduce the error. So perhaps I am doing something wrong in how I am using Project.toml
?
Files:
# ./TestingVersions2/Project.toml
name = "TestingVersions"
uuid = "494561fa-ca9a-11ea-03a1-2d0453b7d2f0"
authors = ["torgo"]
version = "1.0.0"
[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
GLM = "38e38edf-8417-5370-95a0-9cbb8c7f171a"
Gurobi = "2e9cd046-0924-5485-92f1-d5272153d98b"
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36"
MathOptFormat = "f4570300-c277-12e8-125c-4912f86ce65d"
MathOptInterface = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
Sobol = "ed01d8cd-4d21-5b2a-85b4-cc3bdc58bad4"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
[compat]
CSV = "= 0.5.26"
CategoricalArrays = "= 0.7.7"
DataFrames = "= 0.20.2"
Distributions = "= 0.23.1"
GLM = "= 1.3.8"
Gurobi = "= 0.7.4"
JuMP = "= 0.20.1"
MathOptFormat = "= 0.4.0"
MathOptInterface = "= 0.9.7"
Parameters = "= 0.12.0"
Roots = "= 0.8.4"
Sobol = "= 1.3.0"
StatsBase = "= 0.32.2"
julia = "= 1.1"
# ./TestingVersions2/src/TestingVersions.jl
module TestingVersions
using DataFrames
function testing_df_assignment()
df = DataFrame(a = rand(2))
df[:, :b] .= 2
end
export testing_df_assignment
end
First I run this in Julia 1.1.0:
using Pkg
Pkg.activate(".")
Pkg.instantiate()
using TestingVersions
testing_df_assignment()
I get the expected output:
2-element Array{Int64,1}:
2
2
and a Manifest.toml
is generated.
Then I go to Julia 1.6.0.
The same sequence of commands produces:
ERROR: MethodError: no method matching ndims(::Type{DataFrames.LazyNewColDataFrame{Symbol}})
Closest candidates are:
ndims(::DataFrames.DataFrameRow) at /home/at/.julia/packages/DataFrames/S3ZFo/src/dataframerow/dataframerow.jl:166
ndims(::Base.Iterators.ProductIterator) at iterators.jl:967
ndims(::AbstractChar) at char.jl:191
Any idea what I am missing?