Failure to install third-party Python modules (Apple Silicon)

I tried installing scipy in the ovitos interpreter following these instructions by running the following command

/Applications/ -m pip install --user scipy

The installation appears to proceed as intended reporting

Successfully installed scipy-1.8.1

The subsequent import fails, however,

$ /Applications/
This is OVITO's interactive Python interpreter. Use quit() or Ctrl-D to exit.
>>> import scipy
Traceback (most recent call last):
  File "<console>", line 1, in <module>
ModuleNotFoundError: No module named 'scipy'

I suspect that this is related to insufficient rights to write to the /Applications/ directory. Specifically, running with --user gives the error

ERROR: Could not install packages due to an OSError: [Errno 30] Read-only file system: '/lib'

but changing the rights manually via chmod or using using sudo (both of which I would prefer to avoid) does not resolve the issue.

OVITO was installed via the standard route (download of DMG and drag and drop into Applications). Has anyone else encountered this problem and/or has suggestions for how to solve it?

Hi Paul,

  1. Importing a package that has been installed with the --user option doesn’t work for OVITO Pro’s embedded Python interpreter, because it is configured to ignore the user’s site-packages directory and the usual PYTHONPATH variable. That’s because it may be dangerous for the ovitos interpreter to import Python packages that were previously installed with and for a different, possibly incompatible CPython interpreter on the user’s system.

  2. Under normal circumstances it should not be a problem to install a package such as scipy using pip without the --user option under the /Applications/ directory. No special privileges or sudo rights are required for this – at least on my macOS 12 system. I’m not sure why you are getting this error message, which I haven’t seen before. Did you already try installing OVITO Pro in the Applications folder inside your user’s Home Folder instead of the system-wide Applications folder? Perhaps this could help avoid the error.

  3. As a last resort, you can extend sys.path within your Python script to import scipy from your user’s site-packages directory:

import sys, os
import scipy


Starting with release 3.7.9, OVITO Pro supports the installation of PyPI packages with the --user option. Packages will be installed under the user’s home directory, separate from the standard location used by external CPython interpreters.