Answer
In general, packages need to be placed in the Applications
directory within $UserBaseDirectory
. $UserBaseDirectory
has different locations on different systems. With standard Mathematica, we can just evaluate $UserBaseDirectory
to find this location, e.g. on a Windows system:
$UserBaseDirectory
(* "C:\\Users\\JoeUser\\AppData\\Roaming\\Mathematica" *)
Also, SystemOpen[$UserBaseDirectory]
will open it in the system's file manager.
Note: not all packages follow the standard so be sure to read the package's documentation for package-specific installation instructions.
What about the cloud? (Note: I do not have access to Mathematica Online so I am going to work with the Programming Cloud, hoping that they're similar enough.) The value of $UserBaseDirectory
has less information about how to actually put files there, but we can navigate to Home > Base using the cloud's file manager:
Navigate to Applications and place the package there.
A package may be a single .m
or .wl
file, in which case doing this is simple, or it may come as a directory, which makes uploading more difficult. I have not found a way to upload a directory (please let me know if there's a way!), so I took the following approach instead: upload an archive and extract it using ExtractArchive
. Or we can download the file directly to the cloud using URLSave
. Using xAct as an example,
SetDirectory@FileNameJoin[{$UserBaseDirectory,"Applications"}]
URLSave["http://www.xact.es/download/xAct_1.1.1.tgz","xAct.tgz"]
ExtractArchive["xAct.tgz"];
DeleteFile["xAct.tgz"]
Now we have the xAct
directory within Base/Applications
, the package is installed.
How to install xAct specifically? xAct follows the standard installation procedure, so the above steps work. But unfortunately it is not compatible with Mathematica Online because it relies on separate executables, which are not supported in the cloud due to security reasons.
In short, this package won't work because it's written in a mix of Mathematica and C. Most packages written in pure Mathematica should work.
Comments
Post a Comment