I tried installing
scipy in the
ovitos interpreter following these instructions by running the following command
/Applications/Ovito.app/Contents/MacOS/ovitos -m pip install --user scipy
The installation appears to proceed as intended reporting
Successfully installed scipy-1.8.1
The subsequent import fails, however,
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/Ovito.app/Contents/MacOS 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?
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.
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/Ovito.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ 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.
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
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.