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

Is PyScript module available for Windows?

Hi,

First, OVITO is a very excellent tool and it brings a lot of convinience for me.

I noticed that both Linux and MacOS versions of OVITO package provides PyScript module in the form of binary libraries (e.g. PyScript.so). But I haven't found corresponding libraries for Windows (i.e. PyScript.dll and others). Are these files reserved for Windows?

I also noticed that the PyScript module has been removed from the source code. Thus I tried to compile from an older version (commit 36c0e5a3932e3c10a561f559942d99e81d09cd8f) on Windows. However, I got some error like this.


C:/docking/ovito/src/ovito/pyscript/binding/PythonBinding.h:43:45: error: 'dllexport' implies default visibility, but 'struct pybind11::detail::type_caster<QString>' has already been declared with a different visibility
template<> struct OVITO_PYSCRIPT_EXPORT type_caster<QString> {
^~~~~~~~~~~~~~~~~~~~
C:/docking/ovito/src/ovito/pyscript/binding/PythonBinding.h:52:45: error: 'dllexport' implies default visibility, but 'struct pybind11::detail::type_caster<QUrl>' has already been declared with a different visibility
template<> struct OVITO_PYSCRIPT_EXPORT type_caster<QUrl> {
^~~~~~~~~~~~~~~~~
C:/docking/ovito/src/ovito/pyscript/binding/PythonBinding.h:61:45: error: 'dllexport' implies default visibility, but 'struct pybind11::detail::type_caster<QVariant>' has already been declared with a different visibility
template<> struct OVITO_PYSCRIPT_EXPORT type_caster<QVariant> {
^~~~~~~~~~~~~~~~~~~~~


Both MSVC-2017 and MinGW-7.3.0 are tried but similar results are obtained. So I wonder is it possible to compile the PyScript part from source for Windows? Thanks a lot.

-Zijian

Hi,

Please double check which version of OVITO you actually did download and install. As for Linux and macOS, the PyScript module is included in OVITO Pro for Windows. It is not part of OVITO Basic (on any platform).

Another way to obtain the OVITO Python module for Windows is to install the pip package we provide on PyPI in your Python interpreter, see https://pypi.org/project/ovito/

I don't have a good idea why you are getting that compilation error, sorry. Building the OVITO code base including the Python modules on the Windows platform is not an easy task and the process can easily break if the system environment is not exactly as it is supposed to be. Please understand that we cannot provide support for old versions of the source code anymore. I rather recommend that you make use of the pre-built binary packages we provide. If you run into any problems with these, let me know.

-Alex

Hi Alex,

Thank you for your response. Actually I want to use the function `ovito.vis.Viewport.create_widget` to create a widget in my PyQt/PySide project. For the pip package from PyPI, I found this error when calling this function

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\ovitotest\dock_env\python-3.7.4-embed-amd64\Lib/site-packages\ovito\vis\__init__.py", line 206, in _Viewport_create_widget
import ovito.plugins.PyScriptGui
ModuleNotFoundError: No module named 'ovito.plugins.PyScriptGui'

And for the binary package, I find ovito-2.9.0-win64 contains PyScript.dll file but ovito-pro-3.0.0-win64 does not. However Version 2.9.0 does not provide the create_widget function. That is why I tried to compile it from source. Did I miss some part of the package?

-Zijian