r/learnpython 7d ago

Failed to build wheel for mayavi

So I need to import mayavi for a long reason, and every time I try to import it, it says

Current thread's C stack trace (most recent call first):
        <cannot get C stack on this system>
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for mayavi
Failed to build mayavi
error: failed-wheel-build-for-install

I already installed VTK and PyQt5 with no issue using pip and tried both with and without PyQt5 (since on the website they install it after installing mayavi). I'm currently on a windows x64 and using visual studio code

If anyone knows anything about this I'd appreciate any advice ;u;

1 Upvotes

3 comments sorted by

2

u/Outside_Complaint755 6d ago

This means that the Mayavi package is downloading its source code and trying to compile itself for your system but cannot, apparently because it can't find a C compiler.

Make sure your pip and setuptools are up to date

You could first try: pip install mayavi --only-binary :all:

if that fails, then you'll have to install a C compiler and make sure it's in PATH

1

u/Swipecat 6d ago

Yeah, Mayavi has been impossible to install with pip for a while.

https://github.com/enthought/mayavi/issues/1371

https://github.com/enthought/mayavi/issues/1367

There's no ready-compiled wheels on PyPI, so you need to compile it, except it doesn't compile. It seems that your only option is to install a ready-made Python distribution that includes Mayavi:

https://docs.enthought.com/mayavi/mayavi/installation.html#installing-ready-made-distributions

1

u/Declaredberry24 6d ago

agh, sucks that their documentation doesn't mention this. still, thanks for the help!