# paraview-meshio-plugin.py not designed to run on windows or contains an error

**URL:** https://discourse.paraview.org/t/paraview-meshio-plugin-py-not-designed-to-run-on-windows-or-contains-an-error/5740
**Category:** ParaView Support
**Tags:** python
**Created:** [November 6, 2020, 8:03pm UTC](https://discourse.paraview.org/t/paraview-meshio-plugin-py-not-designed-to-run-on-windows-or-contains-an-error/5740 "2020-11-06T20:03:01Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![phb](https://discourse.paraview.org/user_avatar/discourse.paraview.org/phb/32/3663_2.png) [@phb](https://discourse.paraview.org/u/phb)
#### Post date: [November 6, 2020, 8:03pm UTC](https://discourse.paraview.org/t/paraview-meshio-plugin-py-not-designed-to-run-on-windows-or-contains-an-error/5740/1 "2020-11-06T20:03:01Z")

</div>

In order to load a gmsh .msh file into paraview on windows 10,  
I followed instructions from [https://github.com/nschloe/meshio](https://github.com/nschloe/meshio),  
and attempted to load new plugin paraview\_meshio\_plugin.py .

I tried using both the intel python interpreter, and the python 3.8 interpreter from the windows store.  
I made a passing attempt to use pvpython.exe, but the -m option appears to not be supported, so I didn’t fully pursue this path.

Both attempts lead to the same error message:

“\?\C:\Users…\share\paraview\_5.8\paraview-meshio-plugin.py is either not designed to run on Windows or it contains an error. Try installing the program again using the original installation media or contact your system administrator or the software vendor for support. Error status 0x000012f.”

Running ParaView version 5.81  
python library path C:\Program Files\ParaView 5.8.1-Windows-Python3.7-msvc2015-64bit\bin\lib

---

<div class="post-metadata">

### Author: ![phb](https://discourse.paraview.org/user_avatar/discourse.paraview.org/phb/32/3663_2.png) [@phb](https://discourse.paraview.org/u/phb)
#### Post date: [November 9, 2020, 8:07am UTC](https://discourse.paraview.org/t/paraview-meshio-plugin-py-not-designed-to-run-on-windows-or-contains-an-error/5740/2 "2020-11-09T08:07:06Z")

</div>

Additional information:

Line-by-line analysis of the plugin, using the ParaView python panel, suggests that the plugin crashes upon import of the meshio python package, when the meshio ` __init__.py ` function imports ` __about__.py` :

```auto
try:
    # Python 3.8
    from importlib import metadata
except ImportError:
    import importlib_metadata as metadata

```

A Stackoverflow entry ([https://stackoverflow.com/questions/59216175/importerror-cannot-import-name-metadata-from-importlib](https://stackoverflow.com/questions/59216175/importerror-cannot-import-name-metadata-from-importlib)) suggests

```auto
pipenv install jsonschema==3.0.2

```

as a workaround. I haven’t found jsonschema installed in Paraview python.

I would appreciate any hints for a workaround for getting the meshio plugin to function.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [November 9, 2020, 9:36am UTC](https://discourse.paraview.org/t/paraview-meshio-plugin-py-not-designed-to-run-on-windows-or-contains-an-error/5740/3 "2020-11-09T09:36:24Z")

</div>

I’ve never used this plugin from @nschloe, but I just want to mention that a new Gmsh plugin should be available in ParaView 5.10 (2021).

---

<div class="post-metadata">

### Author: ![nschloe](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nschloe/32/4759_2.png) [@nschloe](https://discourse.paraview.org/u/nschloe)
#### Post date: [November 9, 2020, 9:39am UTC](https://discourse.paraview.org/t/paraview-meshio-plugin-py-not-designed-to-run-on-windows-or-contains-an-error/5740/4 "2020-11-09T09:39:45Z")

</div>

Perhaps I should remove those ` __version__ ` shenanigans.

---

<div class="post-metadata">

### Author: ![nschloe](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nschloe/32/4759_2.png) [@nschloe](https://discourse.paraview.org/u/nschloe)
#### Post date: [November 9, 2020, 4:36pm UTC](https://discourse.paraview.org/t/paraview-meshio-plugin-py-not-designed-to-run-on-windows-or-contains-an-error/5740/5 "2020-11-09T16:36:53Z")

</div>

I’ve looking into it and removing `importlib` would be too intrusive for meshio. I don’t think `jsonschema` is the problem either. Without an error message, it’s hard to tell.

---

<div class="post-metadata">

### Author: ![phb](https://discourse.paraview.org/user_avatar/discourse.paraview.org/phb/32/3663_2.png) [@phb](https://discourse.paraview.org/u/phb)
#### Post date: [November 9, 2020, 5:27pm UTC](https://discourse.paraview.org/t/paraview-meshio-plugin-py-not-designed-to-run-on-windows-or-contains-an-error/5740/6 "2020-11-09T17:27:52Z")

</div>

Apologies for not fully reporting the error message earlier.

```auto
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] on win32
>>> from paraview.simple import *
>>> import meshio
Traceback (most recent call last):
  File "C:\Program Files\ParaView 5.8.1-Windows-Python3.7-msvc2015-64bit\bin\Lib\site-packages\meshio\ __about__.py", line 3, in <module>
    from importlib import metadata
ImportError: cannot import name 'metadata' from 'importlib' (C:\Program Files\ParaView 5.8.1-Windows-Python3.7-msvc2015-64bit\bin\lib\importlib\ __init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "C:\Program Files\ParaView 5.8.1-Windows-Python3.7-msvc2015-64bit\bin\Lib\site-packages\meshio\ __init__.py", line 1, in <module>
    from . import (
  File "C:\Program Files\ParaView 5.8.1-Windows-Python3.7-msvc2015-64bit\bin\Lib\site-packages\meshio\_cli\ __init__.py", line 1, in <module>
    from ._ascii import ascii
  File "C:\Program Files\ParaView 5.8.1-Windows-Python3.7-msvc2015-64bit\bin\Lib\site-packages\meshio\_cli\_ascii.py", line 5, in <module>
    from .. import ansys, flac3d, gmsh, mdpa, ply, stl, vtk, vtu, xdmf
  File "C:\Program Files\ParaView 5.8.1-Windows-Python3.7-msvc2015-64bit\bin\Lib\site-packages\meshio\ansys\ __init__.py", line 1, in <module>
    from ._ansys import read, write
  File "C:\Program Files\ParaView 5.8.1-Windows-Python3.7-msvc2015-64bit\bin\Lib\site-packages\meshio\ansys\_ansys.py", line 10, in <module>
    from .. __about__ import __version__
  File "C:\Program Files\ParaView 5.8.1-Windows-Python3.7-msvc2015-64bit\bin\Lib\site-packages\meshio\ __about__.py", line 5, in <module>
    import importlib_metadata as metadata
ModuleNotFoundError: No module named 'importlib_metadata'
>>> 

```

---

<div class="post-metadata">

### Author: ![nschloe](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nschloe/32/4759_2.png) [@nschloe](https://discourse.paraview.org/u/nschloe)
#### Post date: [November 9, 2020, 5:31pm UTC](https://discourse.paraview.org/t/paraview-meshio-plugin-py-not-designed-to-run-on-windows-or-contains-an-error/5740/7 "2020-11-09T17:31:14Z")

</div>

Can you also post the contents of

```auto
C:\Program Files\ParaView 5.8.1-Windows-Python3.7-msvc2015-64bit\bin\Lib\site-packages\meshio\ __about__.py

```

---

<div class="post-metadata">

### Author: ![phb](https://discourse.paraview.org/user_avatar/discourse.paraview.org/phb/32/3663_2.png) [@phb](https://discourse.paraview.org/u/phb)
#### Post date: [November 9, 2020, 5:59pm UTC](https://discourse.paraview.org/t/paraview-meshio-plugin-py-not-designed-to-run-on-windows-or-contains-an-error/5740/8 "2020-11-09T17:59:54Z")

</div>

A couple of things …  
First, the content of ` __about__.py`

```auto
    # Python 3.8
    from importlib import metadata
except ImportError:
    import importlib_metadata as metadata

try:
    __version__ = metadata.version("meshio")
except Exception:
    __version__ = "unknown"

```

Second, I downloaded source, and added a couple of packages to `C:\Program Files\ParaView 5.8.1-Windows-Python3.7-msvc2015-64bit\bin\Lib\site-packages`

package importlib\_metadata, extracting a directory from  
`https://github.com/python/importlib_metadata/tree/master/importlib_metadata`

package zipp, placing into a directory the contents of  
`https://github.com/jaraco/zipp`

At that point ```import meshio`` executed without complaint in the ParaView python window.  
However attempting to load the plugin generates error messages:

```auto
Generic Warning: In C:\bbd\8fbebceb\build\superbuild\paraview\src\Remoting\ServerManagerPython\vtkPVPythonAlgorithmPlugin.cxx, line 187
Failed to load Python plugin:
Failed to call `paraview.detail.pythonalgorithm.load_plugin`.

Traceback (most recent call last):
  File "C:\Program Files\ParaView 5.8.1-Windows-Python3.7-msvc2015-64bit\bin\Lib\site-packages\paraview\detail\pythonalgorithm.py", line 509, in load_plugin
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Program Files\ParaView 5.8.1-Windows-Python3.7-msvc2015-64bit\share\paraview-meshio-plugin.py", line 14, in <module>
    paraview_plugin_version = meshio. __version__
AttributeError: module 'meshio' has no attribute ' __version__'
ERROR: In C:\bbd\8fbebceb\build\superbuild\paraview\src\Remoting\Core\vtkPVPluginLoader.cxx, line 524
vtkPVPluginLoader (000002BB6EF08F90): %1 is not a valid Win32 application.

```

Thank you for your interest.

---

<div class="post-metadata">

### Author: ![nschloe](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nschloe/32/4759_2.png) [@nschloe](https://discourse.paraview.org/u/nschloe)
#### Post date: [November 9, 2020, 7:14pm UTC](https://discourse.paraview.org/t/paraview-meshio-plugin-py-not-designed-to-run-on-windows-or-contains-an-error/5740/9 "2020-11-09T19:14:19Z")

</div>

There’s a `try:` missing in your first code example, right?

If yes, I have no idea why the `ImportError` is not properly intercepted here.

---

<div class="post-metadata">

### Author: ![phb](https://discourse.paraview.org/user_avatar/discourse.paraview.org/phb/32/3663_2.png) [@phb](https://discourse.paraview.org/u/phb)
#### Post date: [November 9, 2020, 7:33pm UTC](https://discourse.paraview.org/t/paraview-meshio-plugin-py-not-designed-to-run-on-windows-or-contains-an-error/5740/10 "2020-11-09T19:33:09Z")

</div>

Yes ! you are right that the first code example should begin with `try:`

I have the idea that it has to do with python packaging, but I don’t know what to make of the clues.  
The readthedocs site for `importlib_metadata` ([https://importlib-metadata.readthedocs.io/en/latest/](https://importlib-metadata.readthedocs.io/en/latest/)) posts a release note:

```auto
## v2.0.0

2020-06-26

* `importlib_metadata` no longer presents a ` __version__ ` attribute. 
Consumers wishing to resolve the version of the package should query it directly 
with `importlib_metadata.version('importlib-metadata')` . Closes #71.

```

Since pip is not available for ParaView python, I downloaded source and moved the appropriate code to site-packages by copy-paste. There may be an important step missing, which pip would normally perform.
