I am trying to run a wolfram script on my windows cmd prompt. The script (available here) uses the function Facial Features of Mathematica. It is important to highlight that I need to process this operation to analyse a very large number of images.

I am using the following code: wolframscript.exe -f script.wls folder_with_movie_frames output.json (to access my workspace:here)

This code does work for a limited number of images (total size < 2MB).

But as soon as I run it through a larger number of files (>10MB), I get error messages. Note that the nature of the messages varies.

I sometimes get:

FacialFeatures::nneverr: An internal error occurred during a neural net evaluation. Please try again.


The product exited because an error occurred. For a product older than 12.1, this can mean that the product is unregistered.


The product exited because of a license error.


No more memory available. Mathematica kernel has shut down.

At times, a JSON file is created, but it remains empty.

As suggested by members of the community, I doubt this is a license issue.I am using Mathematica 12.3, for which I purchased the license less than a week ago. My personal account on wolfram.com indicates that my license is active indeed.

The next possible option would be that my system is too weak. Here are the details of my system:

  • RAM: 8,00 Go
  • Processor: Intel(R) Core(TM) [email protected],2904MHZ
  • While running the command, I try to limit the activities of my laptop (to optimise RAM usage)

Task manager while running the task

I have tested the operation with several samples of photos to analyse:

  • Sample size: 568Ko (9 photos) --> Successful analysis in 2mn (JSON output: 241Ko)
  • Sample size: 1.14Mo (19 photos) --> Successful analysis in 7mn (JSON output: 556Ko)
  • Sample size: 10.3Mo (171 photos) --> It did not work

Do you think my system is not powerful enough for such operations?

Can I overcome this limitation?

Sincerely, Hugo.

  • $\begingroup$ I think it's possible the license-related stuff is a red herring. In the Transpose error mesage, it's very suspicious that the last value displayed is $Failed, and that it works with a subset of your images and not all of them. Perhaps there is an issue with one or some of your images? $\endgroup$
    – Carl Lange
    Sep 2, 2021 at 10:04
  • $\begingroup$ "Is there any way to check if there is indeed a license problem?" Contacting WRI would be the standard way. $\endgroup$
    – Michael E2
    Sep 3, 2021 at 1:15
  • $\begingroup$ Hello. Thank you for your answer. There was actually a very easy way to check if my license is active: it is indicated on my account on wolfram.com. I checked, and I confirm that my license is active indeed. (i'm editing my question accordingly) $\endgroup$
    – HugoRD
    Sep 3, 2021 at 3:32
  • $\begingroup$ Do you think you can post the code of a minimum working example of your issue? $\endgroup$
    – Carl Lange
    Sep 3, 2021 at 8:29
  • $\begingroup$ Hello Carl, yes i'd be happy to post the code. But I'm not sure I understand what I should share. The code I run on the Windows cmd prompt(wolframscript.exe -f script.wls folder_with_movie_frames output.json)? Or maybe the code of the wolfram script (here:community.wolfram.com/groups/-/m/t/2288529)? Or anything else? $\endgroup$
    – HugoRD
    Sep 3, 2021 at 10:41

1 Answer 1


With your code you force the WolframKernel to keep all the files of one directory in memory due to the "FacialFeatures[Import/@pathImgs, features]". This can lead to huge amounts of memory allocated by the Kernel: for a directory containing 2088 files the kernel allocated beyond 17GB - on a machine with 16GB RAM (Mathematica v13.1, Mac OS 12.6.4), obviously this took ages as the OS was forced to swap more than anything else.

pathImgs = FileNames[All, pathToFolder];

extract = formatFacialFeatures /@ Transpose@{ FileNameTake/@pathImgs,FacialFeatures[Import/@pathImgs, features]};

Export[pathToJSON, extract];

If you partition the pathImgs like so:

pathImgs = Partition[FileNames[All, pathToFolder], UpTo@40];

and then

extract = 
    formatFacialFeatures /@ 
         FileNameTake /@ #, 
         FacialFeatures[Import /@ #, features]

Export[pathToJSON, Join @@ extract];

the kernel never went beyond 1GB of RAM. It still takes quite some time to finish, but there's no swapping and the machine can still be used for other tasks in the meantime :)

Kind regards, Roland


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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