# What is the recommended path to install packages on Wolfram Cloud? [closed]

On Desktop, I can install a custom package in the Applications directory under AddOns. This path appears in $Path and loading the package is successful. On Cloud, I tried to install a package in "BaseApplications" like I would on Desktop, but the only way loading the package has worked is if I run Prepend[$ContextPath, "BaseApplications"] at the beginning of a notebook. The path to Base/Applications exists on the $Path. Can the context be set automatically? Where is one supposed to install a package? Is this a bug? • You can install them normally in $UserBaseDirectory/Applications just like in Desktop Mathematica I believe. – b3m2a1 May 25 '19 at 19:55
• Does it answer your question? mathematica.stackexchange.com/q/175543/5478? – Kuba May 26 '19 at 7:43
• This helps, but it seems there is a bug. I have checked the $Path and it contains the cloud path. I moved the package file to that location, but I have seen inconsistent results unless I run Prepend as mentioned. Even this fails on the mobile app sometimes – Dan Kowalczyk May 26 '19 at 16:47 • @DanKowalczyk it is hard to help without a clear description of steps that lead to a problem – Kuba Jun 3 '19 at 6:37 ## 1 Answer I made a mistake by trying to import the context that the file defines, not the file itself. D'oh! The package I tried to import is defined in a file named $UserBaseDirectory/Applications/Package.m. The context it defines is PackageMain. I was running Needs["PackageMain"] because as a newbie I thought imports must refer to the context, however this fails.

I am now able to import successfully by simply specifying the filename as Needs["Package"]. This works because the $Path contains $UserBaseDirectory/Applications/.

• You could expand on this giving a proper answer to your original question (basically saying that \$UserBaseDirectory` works) and then mention what happened to you. – b3m2a1 Jun 7 '19 at 17:23
• Thanks for reviewing this and for your suggestion. I added some more details. – Dan Kowalczyk Jun 8 '19 at 3:27