Python wrapping of gmsh is quite messy. There are many python wrappers, they all work slightly differently and a few of those that I tried fail in various ways.
pygmsh is a quite simple one, which uses an installed gmsh executable and it seems to work for me. For example, this generates a mesh:
Hi Andras,
Sorry for asking a question about pygmsh. What if you want to load a geometry from file and not create it using the opencascade. I searched much in the google but couldnt find anything on this? Could you guide me please. any related documentation which can help me.
pip has not been exposing main for a really long time (since pip 9.x; while current pip version is 19.x). You can use the current pip API or the slicer.util helper function that you have found.
By the way, you should not need numpy-stl for loading/saving models. You can use slicer.util.loadModel('something.stl') and slicer.util.saveNode('something2.stl') instead.
Hi everyone,
I tried to install matplotlib in slicer 5.3.0 and 5.1.0, returns a lot error like this, too long to paste
import pip
pip.main([‘install’, ‘matplotlib’])
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with ‘-m pip’ instead of running pip directly.
— Logging error —
Traceback (most recent call last):
File “”, line 60, in emit
KeyError: 15
Call stack:
File “D:\Slicer 5.3.0-2022-12-16\lib\Python\Lib\code.py”, line 258, in push
more = self.runsource(source, self.filename)
File “D:\Slicer 5.3.0-2022-12-16\lib\Python\Lib\code.py”, line 74, in runsource
self.runcode(code)
File “D:\Slicer 5.3.0-2022-12-16\lib\Python\Lib\code.py”, line 90, in runcode
exec(code, self.locals)
File “”, line 1, in
File “D:\Slicer 5.3.0-2022-12-16\lib\Python\Lib\site-packages\pip_init_.py”, line 13, in main
return wrapper(args)
File “D:\Slicer 5.3.0-2022-12-16\lib\Python\Lib\site-packages\pip_internal\utils\entrypoints.py”, line 43, in wrapper
return main(args)
File “D:\Slicer 5.3.0-2022-12-16\lib\Python\Lib\site-packages\pip_internal\cli\main.py”, line 55, in main
cmd_name, cmd_args = parse_command(args)
File “D:\Slicer 5.3.0-2022-12-16\lib\Python\Lib\site-packages\pip_internal\cli\main_parser.py”, line 79, in parse_command
general_options, args_else = parser.parse_args(args)
File “D:\Slicer 5.3.0-2022-12-16\lib\Python\Lib\optparse.py”, line 1371, in parse_args
values = self.get_default_values()
File “D:\Slicer 5.3.0-2022-12-16\lib\Python\Lib\site-packages\pip_internal\cli\parser.py”, line 279, in get_default_values
self.config.load()
…
…
packages\pip_internal\cli\base_command.py", line 216, in main
self.handle_pip_version_check(options)
File “D:\Slicer 5.3.0-2022-12-16\lib\Python\Lib\site-packages\pip_internal\cli\req_command.py”, line 190, in handle_pip_version_check
pip_self_version_check(session, options)
File “D:\Slicer 5.3.0-2022-12-16\lib\Python\Lib\site-packages\pip_internal\self_outdated_check.py”, line 238, in pip_self_version_check
logger.warning(“There was an error checking the latest version of pip.”)
File "D:\Slicer 5.3.0-2022-12-16\lib\Python\Lib\logging_init.py", line 1458, in warning
self.log(WARNING, msg, args, **kwargs)
File "D:\Slicer 5.3.0-2022-12-16\lib\Python\Lib\logging_init.py", line 1589, in log
self.handle(record)
File "D:\Slicer 5.3.0-2022-12-16\lib\Python\Lib\logging_init.py", line 1599, in handle
self.callHandlers(record)
File "D:\Slicer 5.3.0-2022-12-16\lib\Python\Lib\logging_init.py", line 1661, in callHandlers
hdlr.handle(record)
File "D:\Slicer 5.3.0-2022-12-16\lib\Python\Lib\logging_init.py", line 952, in handle
self.emit(record)
File “D:\Slicer 5.3.0-2022-12-16\lib\Python\Lib\site-packages\pip_internal\utils\logging.py”, line 179, in emit
self.handleError(record)
Message: ‘There was an error checking the latest version of pip.’
Arguments: ()
1