Search code examples
pythonmatplotlibpip32-bit

Issue installing matplotlib on Python 32-bit


I'm trying to install Matplotlib on a 32-bit version of Python. When I run pip install matplotlib, I get the following error when it tries to "Prepare metadata."

      WARNING: Failed to activate VS environment: Could not find C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe

      ..\meson.build:1:0: ERROR: Unknown compiler(s): [['icl'], ['cl'], ['cc'], ['gcc'], ['clang'], ['clang-cl'], ['pgcc']]
      The following exception(s) were encountered:
      Running `icl ""` gave "[WinError 2] The system cannot find the file specified"
      Running `cl /?` gave "[WinError 2] The system cannot find the file specified"
      Running `cc --version` gave "[WinError 2] The system cannot find the file specified"
      Running `gcc --version` gave "[WinError 2] The system cannot find the file specified"
      Running `clang --version` gave "[WinError 2] The system cannot find the file specified"
      Running `clang-cl /?` gave "[WinError 2] The system cannot find the file specified"
      Running `pgcc --version` gave "[WinError 2] The system cannot find the file specified"

I really just want this to work on any 32-bit version of Python. This is on Python 3.9.1, but I've tried the most recent version of Python and I get the same error. I've tried different Matplotlib versions too. Really early Matplotlib versions (2.0.x,1.4.3) give me a different error, but it still doesn't work. Thanks for your help!


Solution

  • I had this same issue and here's how I solved it.

    Originally, I wanted to use Numpy, Scipy, Matplotlib, PyQt, and pyinstaller on a 32-bit version of Python. I've found out these libraries need to have "wheels" (I don't know what that actually is) that are compatible with 32-bit Python. That means that on pypi.org under "Download Files" of the specific library's version, there needs to be a file listed that goes like "library-version-pythoncompatibility-win32.whl". This means that it can be installed on a 32-bit version of python.

    Additionally, the libraries I listed aren't very robust in terms of 32-bit versions of python, so I needed to find versions of the above libraries that are all compatible with the same version of 32-bit Python. This is what I got to work.

    Python: 3.9.13 (32-bit)

    numpy: 1.23.5

    scipy: 1.8.1

    matplotlib: 3.7.5

    PyQt5: 5.15.10

    pyinstaller: 6.8.0

    Each library version is compatible with more Python 32-bit versions than just 3.9.13, but 3.9.13 I found works for all of them at the same time.

    I am obviously not a computer scientist, so please add anything that might be more useful.