Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am facing a problem in loading the package. My code is working in Mathematica but after deploying it into CDF, it is unable to load the package and shows error.

The code was not even working in Mathematica when I evaluated it for the first time but when I evaluated it one more time it worked.

I got help from this stackexchange question

And now it is working in Notebook but not in CDF, after relaunching the Mathematica Kernel.

share|improve this question

As I understand, three things are needed:

  • Explicitly list the contexts of the functions that are in the package. For example, if you are using the function f in package test call it test`f[] instead of just f[].

  • Call Needs on the package inside the initialization option for the Manipulate that makes up your CDF. I would recommend calling needs with the syntax that gives the full file path to the package. For example: Initialization->{Needs["Plambda","filepathhere"]}`

  • Place the package inside the installation directory for CDFPlayer under AddOns\Applications. For example under windows:

    C:\Program Files\Wolfram Research\Wolfram CDF

My honest recommendation is that you create a simple example package and CDF and try to get this to work before getting a real world example working. The example will be much easier to debug and think about.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.