Configure mopac calculator for ASE

I have some questions sbout the configuring mopac calculator for ASE when I try to follow the sample about the atomic simulation environment.
In:

 from ase.build import molecule
from ase.calculators.mopac import MOPAC
atoms = molecule('O2')
atoms.calc = MOPAC(label='O2')
atoms.get_potential_energy(atoms)

In: from ase.build import molecule
from ase.calculators.mopac import MOPAC
atoms = molecule('O2')
atoms.calc = MOPAC(label='O2')
atoms.get_potential_energy(atoms)

CalculationFailed                         Traceback (most recent call last)
Cell In[71], line 5
3 atoms = molecule('O2')
4 atoms.calc = MOPAC(label='O2')
----> 5 atoms.get_potential_energy(atoms)
File ~\AppData\Roaming\Python\Python311\site-packages\ase\atoms.py:728, in Atoms.get_potential_energy(self, force_consistent, apply_constraint)
726     raise RuntimeError('Atoms object has no calculator.')
727 if force_consistent:
--> 728     energy = self._calc.get_potential_energy(
729         self, force_consistent=force_consistent)
730 else:
731     energy = self._calc.get_potential_energy(self)
File ~\AppData\Roaming\Python\Python311\site-packages\ase\calculators\calculator.py:709, in Calculator.get_potential_energy(self, atoms, force_consistent)
708 def get_potential_energy(self, atoms=None, force_consistent=False):
--> 709     energy = self.get_property('energy', atoms)
710     if force_consistent:
711         if 'free_energy' not in self.results:
File ~\AppData\Roaming\Python\Python311\site-packages\ase\calculators\calculator.py:737, in Calculator.get_property(self, name, atoms, allow_calculation)
735     if not allow_calculation:
736         return None
--> 737     self.calculate(atoms, [name], system_changes)
739 if name not in self.results:
740     # For some reason the calculator was not able to do what we want,
741     # and that is OK.
742     raise PropertyNotImplementedError('{} not present in this '
743                                       'calculation'.format(name))
File ~\AppData\Roaming\Python\Python311\site-packages\ase\calculators\calculator.py:938, in FileIOCalculator.calculate(self, atoms, properties, system_changes)
934     path = os.path.abspath(self.directory)
935     msg = ('Calculator "{}" failed with command "{}" failed in '
936            '{} with error code {}'.format(self.name, command,
937                                           path, errorcode))
--> 938     raise CalculationFailed(msg)
940 self.read_results()
**CalculationFailed: Calculator "mopac" failed with command "mopac O2.mop 2> /dev/null" failed in C:\Users\Lewis with error code 1**