Forum Navigation
You need to log in to create posts and topics.

Ovito package on Python

Hi,

 

I am trying to install the Ovito package in Python. I tried several ways : 1) pip install it for normal Python, 2) find it with PyCharm, or 3) install it in Anaconda.

  1. I run "pip install -U ovito". And it gives me this error when I try to import it:
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-91f48a8637d1> in <module>
----> 1 from ovito.io import *

/opt/anaconda3/lib/python3.7/site-packages/ovito/__init__.py in <module>
     17 
     18 # Load the native module with the core bindings.
---> 19 from .plugins.PyScript import (version, version_string, gui_mode, headless_mode, Scene, scene, dataset)
     20 from .plugins.PyScript import (Pipeline, RootSceneNode, PipelineObject, PipelineStatus)
     21 

/opt/anaconda3/lib/python3.7/site-packages/ovito/plugins/__init__.py in <module>
     16 
     17 # Load the C++ extension module containing the OVITO bindings.
---> 18 import ovito.plugins.ovito_bindings

ImportError: dlopen(/opt/anaconda3/lib/python3.7/site-packages/ovito/plugins/ovito_bindings.so, 2): Library not loaded: /Users/stuko/progs/ospray_install/lib/libospray.0.dylib
  Referenced from: /opt/anaconda3/lib/python3.7/site-packages/ovito/plugins/ovito_bindings.so
  Reason: image not found

2. Same error when I add ovito to the Python 3.8 environment on PyCharm.

3. And if I run conda install -c conda-forge ovito to download it on Anaconda, it just doesn't work and gives me.

Collecting package metadata (current_repodata.json): done

Solving environment: failed with initial frozen solve. Retrying with flexible solve.

Collecting package metadata (repodata.json): done

Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - ovito

Current channels:

  - https://conda.anaconda.org/conda-forge/osx-64

  - https://conda.anaconda.org/conda-forge/noarch

  - https://repo.anaconda.com/pkgs/main/osx-64

  - https://repo.anaconda.com/pkgs/main/noarch

  - https://repo.anaconda.com/pkgs/r/osx-64

  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you're

looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

 

I am on MacOS Mojave 10.14.6. And I am not sure which other information I should give to you. Do you have any idea ? Feel free to ask questions if you need more information.

 

Thank you in advance !

Vincent

Hi Vincent,

Thank you for your message. Indeed, the current Python package for macOS seems to be broken. I was able to reproduce the error. Unfortunately, I didn't notice the problem earlier, because it doesn't occur on my development machine.

I will try to find a solution now and write you again once we have a working version.

Note that we do not provide a Conda package for OVITO yet. In other words "conda install -c conda-forge ovito" is not going to give you our version of the OVITO module.

-Alex

I have identified and fixed an issue in the packaging script that generates the PyPI packages for macOS. New builds of these packages are now available on the PyPI server. Please upgrade your installation using pip install -U ovito, and give it another try. Let me know if you still encounter any problems.

Hi Alexander,

by the instaling newest version of OVITO (3.0.0.dev733) with anaconda in a clear environment, I experience the same import error.

I am using Windows OS. Have tried other versions of the OVITO and the result is the same.

I would like to start to use python version Ovito, but it seems I can't get further then import ovito after many attempts.

Python import ovito:

Python 3.8.2 | packaged by conda-forge | (default, Mar 23 2020, 17:32:17) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import ovito
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Archy\Anaconda3\envs\ovito\lib\site-packages\ovito\__init__.py", line 19, in <module>
from .plugins.PyScript import (version, version_string, gui_mode, headless_mode, Scene, scene, dataset, enable_logging)
File "C:\Users\Archy\Anaconda3\envs\ovito\lib\site-packages\ovito\plugins\__init__.py", line 18, in <module>
import ovito.plugins.ovito_bindings
ImportError: DLL load failed while importing ovito_bindings: The specified module could not be found.

My environment:

(ovito) C:\Users\Archy>conda list
# packages in environment at C:\Users\Archy\Anaconda3\envs\ovito:
#
# Name Version Build Channel
ca-certificates 2019.11.28 hecc5488_0 conda-forge
certifi 2019.11.28 py38h32f6830_1 conda-forge
numpy 1.18.2 pypi_0 pypi
openssl 1.1.1e hfa6e2cd_0 conda-forge
ovito 3.0.0.dev733 pypi_0 pypi
pip 20.0.2 py_2 conda-forge
pyside2 5.14.1 pypi_0 pypi
python 3.8.2 h5fd99cc_5_cpython conda-forge
python_abi 3.8 1_cp38 conda-forge
setuptools 46.1.1 py38h32f6830_0 conda-forge
shiboken2 5.14.1 pypi_0 pypi
sqlite 3.30.1 hfa6e2cd_0 conda-forge
vc 14.1 h0510ff6_4
vs2015_runtime 14.16.27012 hf0eaf9b_1
wheel 0.34.2 py_1 conda-forge
wincertstore 0.2 py38_1003 conda-forge

Hi Arturs,

I'm sorry for the late reply. I didn't get notified about your post, and noticed it just now.

I assume you've installed the ovito package in your Anaconda interpreter using the pip install command, right? I haven't tested this yet, but it will likely result in the same type of compatibility problem the author of the original post above was facing under macOS. The PyPI package of OVITO is generally not compatible with Anaconda/Miniconda interpreters (or rather other Python packages shipping with these interpreters).

The solution to this problem will be a native conda package of OVITO for the Anaconda/Miniconda environment. So far we only have it for Linux and macOS. Building one for the Windows operating system is a bit more complicated and I am working on it. I hope we will have it soon.

In the meantime you either have to work with a standard CPython interpreter for Windows from http://www.python.org and install the ovito package from PyPI, or just use OVITO's embedded interpreter ovitos.exe.

-Alex