How to fix LoadError for loading Escher in julia? - julia

I'm a beginner to julia and I'm having the problem for loading Escher in julia. Every time when I wanted to import the Package Escher it always has the problems saying:
WARNING: could not import Base.writemime into Escher
ERROR: LoadError: LoadError: syntax: ""A Tile is the basic currency in Escher.
Most of the functions in the Escher API take Tiles
among other things as arguments, and return a Tile as the result.
Tiles are immutable: once created there is no way to mutate them.
"" is not a valid function argument name
Does anyone know how to fix it? Thanks. By the way I'm using julia v0.7. I've tried in julia 1.0 before and it also didn't work.

Related

Julia doesn't find packages in depot_path anymore

I have a problem with using packages in Julia. It has worked before, and I'm not really sure why this has changed or how to troubleshoot.
I have a folder
/my_path/julia/packages
with Julia packages. For example, there is a folder
/my_path/julia/packages/FFTW/
with the FFTW package.
Further, I have changed the depot path to point at this directory by assigning JULIA_DEPOT_PATH before starting julia, so that
Base.DEPOT_PATH = ["/my_path/julia/"]
However, if I run
julia> using FFTW
I get the following error message:
ERROR: ArgumentError: Package FFTW not found in current path:
- Run `import Pkg; Pkg.add("FFTW")` to install the FFTW package.
Any idea how I can troubleshoot or fix this?
Manipulating Base.DEPOT_PATH does not seem like a good idea.
The code proposed by #cmc will does not work (at least on Julia 1.3.1):
julia> Base.DEPOT_PATH = ["/some/path"]
ERROR: cannot assign variables in other modules
There is a workaround:
Base.DEPOT_PATH[1] = "/some/path"
However, the correct way is to assign the JULIA_DEPOT_PATH system variable before starting Julia, Windows:
set JULIA_DEPOT_PATH=c:\some\path
or
set JULIA_DEPOT_PATH=c:\some\path1;c:\some\path2
Linux/OSX:
export JULIA_DEPOT_PATH=/some/path
or
export JULIA_DEPOT_PATH=/some/path1:/some/path2
Unless you have a specific reason to do so (and if this is the case I'd be interested to hear it!), you don't need to fiddle with the DEPOT_PATH or LOAD_PATH variables: using Julia's package manager should be enough to cover your needs most of the time.
In this specific instance, have you tried to do what the error message suggests?
julia> import Pkg
julia> Pkg.add("FFTW")
LOAD_PATH, not DEPOT_PATH, will modify code loading.
You want to do something like push!(LOAD_PATH, /my_path/julia/packages).
I will echo #ffevotte and strongly suggest to not modify LOAD_PATH unless necessary. The benefits of organizing dependencies into Pkg environments far outweigh the small overhead of declaring them explicitly through Pkg.add.

Mamba package and JuMP package Model warning

i have a piece of code where i'm using JuMPand Mambaand both of them export Model.
When i run the code first i get a warning : both Mamba and JuMP export "Model"; uses of it in module QuantumRelay must be qualified, therefore en Error is raised which is :
ERROR: UndefVarError: Model not defined
i need both of the packages Mamba for the MCMC simulation for simulationg draws from a probability distribution and the other for Linear programming.
you can find the package or the code on this link:
https://github.com/marouanehanhasse/Quantum_Relay
check the QuantumRelay module .
Apologizes in advance, because i couldn't post the code here since i'm still new on this community.
In Julia, the using and import keywords are used to bring bindings from another module into the current scope.
using M brings all exported bindings from M directly into scope. If M defines and exports a function my_function, you can use my_function directly in your code after the using statement.
import M imports only the binding M, so you will use M.my_function.
If you want to avoid name clashes as you have with Mamba and JuMP, import at least one of them, and then specify the qualified name, Mamba.Model, JuMP.Model. Subjectively, this also makes your code clearer to read for someone not familiar with both packages and what they export.
Details and other ways to use using and import can be found in the Julia documentation.

JULIA : LoadError: UndefVarError: add_vertex! not defined

I am trying to create a simple type of Graph before putting more efforts on the bigger one I will have to create with data implementation and I figured out that add_vertex! was exactly what I needed to add a special type of vertex into my graph.
Here is the simple example I tried and I get the reply that add_vertex! is not defined..
module VSRPGraphModule
using Graphs, LightGraphs, MetaGraphs
g = DiGraph()
println(g)
v=ExVertex(1,"ex")
port=VSRPPort()
FillPort(port,"La Havane",10)
v.attributes["port"]=port
println(v.attributes["port"].name)
add_vertex!(g,v)
println(g)
end
And the codes stops at the add_vertex! line returning:
LoadError: UndefVarError: add_vertex! not defined
I did Pkg.update()
I did put the package into julia.
I really don't know why it is not working, is it a problem of the new Julia version 0.6.9 ?
Thanks in advance for your help !
tl;dr Try just using LightGraphs + MetaGraphs (not Graphs).
LightGraphs and Graphs are separate packages and I don't think they work together. IIRC Graphs is no longer maintained so if you can then just use LightGraphs.
Regardless, if you try to use two packages that export the same method (add_vertex!) you'll need to specify which one you want to call.
e.g. Graphs.add_vertex! or LightGraphs.add_vertex!.

Julia: pcaeig(X) yields "UndefVarError: fliplr not defined"

I am trying to get the eigenvector to do pca (principal component analysis). The package, DimensionalityReduction.jl offers a command that should do that very thing, pcaeig(X) where X is some matrix. My code is as follows
using DataFrames
using DimensionalityReduction
data = readtable("Midterm Data.csv")
T=size(data)[1]
n=size(data)[2]
erates = convert(Array,data[1:T,2:n])
eigvec = pcaeig(erates)
I do apologize that the formatting is bad, I don't quite remember how to put the code in a quote. Anyways, when I try to run this code, I get the following error: "UndefVarError: fliplr not defined". Now, to my knowledge, fliplr is a command used to flip a matrix (not a variable). It is also saying that the error is happening in the code for the package (not my code). Does this mean that I am out of luck and cannot use this package until it gets patched? If so, does anyone else know another method to get the eigenvector for pca?
As it says in the README of DimensionalityReduction, the package is deprecated:
The DimensionalityReduction package is deprecated. It is superseded by a new package MultivariateStats.
The package does not work on recent versions of Julia and will not be updated to do so in the future. Use MultivariateStats instead.

ArgParse #add_arg_table not recognized in Julia

I'm using Julia v0.3.9 right now. I recently updated all my packages (I haven't opened Julia in a couple months), including ArgParse. The macro #add_arg_table isn't recognized though. In particular, I tried running example code here, but I get the following error:
ERROR: #add_arg_table not defined
in include at /Applications/Julia-0.3.9.app/Contents/Resources/julia/lib/julia/sys.dylib
in include_from_node1 at /Applications/Julia-0.3.9.app/Contents/Resources/julia/lib/julia/sys.dylib`
while loading /Users/Uthsav/Desktop/Walking The Interactome Work/arg.jl, in expression starting on line 42
This is essentially the problem I'm having in my own code. I looked but couldn't find any information about this besides what it says on the Github, which is that the macro #add_arg_table should still work. Any help would be greatly appreciated. Thanks a lot!

Resources