Some of the objects in a Julia Package are not defined - julia

I am using Julia 1.8.1 in windows 10.
I add the SumOfSquare Package, but some of the objects are not defined.
For example, if I run:
using SumOfSquares
Symmetry
I get the error: UndefVarError: Symmetry not defined
I have updated the package, removed and then added it again, but none of them works.
However, I tested this in Linux, and it's totally fine in Linux.
What is the reason?
What should I do?

Related

How to install a Julia package if it fails to install / build on an M1 Mac?

I am trying to use the Twitter.jl package locally on my M1 Mac. However, when I try to install it, I get:
ERROR: Error building `DecFP`:
┌ Warning: Platform `arm64-apple-darwin21.2.0` is not an officially supported platform
└ # BinaryProvider ~/.julia/packages/BinaryProvider/U2dKK/src/PlatformNames.jl:450
ERROR: LoadError: KeyError: key "unknown" not found
DecFP looks like it's an up to date Julia package so I am not sure what the issue would be in this case.
I would like to get a general set of steps to resolve issues like this since I know this package isn't the only one that will have installation issues so hopefully this can be used to help others who have similar issues.
The issue is that Twitter.jl is pulling an old version of OAuth.jl which doesn't work on the M1. I have opened a PR so it pulls a newer version and it should work.
About these cases in general the steps are identifying what package is using BinaryProvider, in this case it's an old MbedTLS that was pulled by an old OAuth. The solutions are, if there is a newer version, change the compat bounds, and if there isn't then one has to build the needed binary using BinaryBuilder.jl and change the dependent packages to use it.
In most cases just opening an issue in github should be enough :).

Cannot install any package in Julia

I had used Julia some months back for a project, and didn't use it since. I hadn't faced problems back then. But now, I absolutely am not able to install any package.
(#v1.5) pkg> add Distributions
Resolving package versions...
ERROR: Unsatisfiable requirements detected for package Distributions [31c24e10]:
Distributions [31c24e10] log:
├─Distributions [31c24e10] has no known versions!
└─restricted to versions * by an explicit requirement — no versions left
Any package I install, I am getting the same error. How do I fix it?
This is the status of Pkg:
(#v1.5) pkg> status
Status `C:\Users\jaine\.julia\environments\v1.5\Project.toml`
[6e4b80f9] BenchmarkTools v0.5.0
[7073ff75] IJulia v1.21.2
[91a5bcdd] Plots v1.6.0
[438e738f] PyCall v1.91.4
[d330b81b] PyPlot v2.9.0
[2913bbd2] StatsBase v0.33.0
Given
├─Distributions [31c24e10] has no known versions!
it looks like you have a missing or corrupt package registry. The package manager will reinstall it for you if you delete .julia/registries and try to add the package again.
You can do this from within julia
rm(joinpath(homedir(), ".julia", "registries"), recursive=true, force=true)
These are indeed some of the more tricky situations to resolve so please bear with me as we work through this.
If you are not familiar with the basics of the package manager, it's worth a quick read to check out: https://julialang.github.io/Pkg.jl/v1/getting-started/
Assuming you are now in the Julia Repl, my general work flow for these issues is to remove everything it warns me about. The core problem here is that one of your existing packages is saying it needs a specific version of Distributions.jl but it's not able to add it. So, the first step would be to enter the pkg manager by doing ] and type rm Distributions.
Then, while still in the pkg mode, do resolve and add Distributions.
So the process is to just remove each package the Repl complains about until it stops complaining.
Note: If you run into something like this again, the worst-case scenario is to remove the project and manifest files for the specific Julia version you are using. If you navigate to ".julia/environments" you should be able to completely reset the Julia Env for a specific version there (that way you don't need to actually reinstall Julia).

what is the r version of the release of getOption("viewer")

I'm creating an r package and when I try to check it I have only one error saying that they can't find the function getOption("viewer") when it runs the examples. However when i try to run the examples manually it works and the function is acknowledged. That's why I'm just wondering if there could be a version problem in the building of the package since I specified it to be at 3.4.0.

When compiling R 3.4.4 in Linux, got this kind of errors: undefined reference to `pcre_jit_stack_alloc'

I tried compiling R 3.4.4 at a linux system (CentOS) locally (I don't have administrative right to the system). In make, I consistently got these errors:
grep.c:(.text+0xb2): undefined reference to pcre_jit_stack_alloc
grep.c:(.text+0xdd): undefined reference to pcre_assign_jit_stack
grep.o: In function do_strsplit:
grep.c:(.text+0x1f8a): undefined reference to pcre_free_study
grep.o: In function do_grep:
grep.c:(.text+0x3ca5): undefined reference to pcre_free_study
grep.o: In function do_gsub:
grep.c:(.text+0x85c6): undefined reference to pcre_free_study
grep.o: In function do_regexpr:
grep.c:(.text+0xb3e6): undefined reference to `pcre_free_study'
I encountered similar errors for R 3.4.3. I thought R 3.4.4 may not have this problem on that system but it turned out that I was wrong. I could successfully compile R 3.3.2 on the same system. I was also told that the pcre on the system is up to date (pcre/8.41/gcc/4.9.3).
What are the possible reasons for this kind of errors?
FYI for people trying the conda approach. I was able to install R-3.4.3 using conda install -c r r=3.4.3. I noticed, however, that it installed Microsoft R Open (MRO) instead of vanilla R.
This solves my problem for now. Thanks very much for the suggestion merv. I would still want to know why building R from source produces the errors mentioned in the post though.

What Julia error 'Unknown dependency for GARCH: NLopt' means?

Using Julia Studio (Win XP) and trying to add package DataFrames - how can the following error be resolved?
Unknown dependency for GARCH: NLopt
(How can I verify that a package was installed) Running dv = DataArray([1,2,3]) says DataArray not defined. So it seems stuck.
You're using a rather old version of julia (0.1.x) and the GARCH package doesn't support it. Try installing a development version from source (it takes a bit the first time, but should be quite automatic) or try a development binary.
Edit: Also, this issue may now be taken care of if you want to do Pkg.update() and try again.

Resources