Solving Python ValueError: Unknown MS Compiler version 1900

ValueError: Unknown MS Compiler version 1900 is an error which occurs when you do not have the necesary patchs, CPython, Cython and mingw and other requirements.

In this article I am going to help you solve this error and understand the root of the problem, also I am presenting other possible solutions that may work if the main solution does not work for you.

Explaining the ValueError: Unknown MS Compiler version 1900

The problem happens when we use you do not have the necesary patchs, CPython, Cython and other requirements needed for your mingw code to work.

The error message should look like the error in the example bellow.

                                                                       #
ValueError Traceback (most recent call last)
<ipython-input-16-bfeb915bfd7b> in <module>()
     60 print("\n")
     88         #     return ['vcruntime140']
     89         else:
---> 90             raise ValueError("Unknown MS Compiler version %s " % msc_ver)
ValueError: Unknown MS Compiler version 1900 
                                                                       #

Bellow are the solutions which have worked for me and will help you to successfully solve the problem.

Solution 1 : use a couple of patchs

First, we need to understand that Numpy and Distutils do not support visual studio.

The easiest solution to the issue is to patch one distutils file and one numpy and one distutils files.

You can do that using the urls bellow.

First, let us start with the numpy and distutils patch.

                                                                       #
https://patch-diff.githubusercontent.com/raw/numpy/numpy/pull/6875.diff
                                                                       #

For the distutils patch you can use the following url.

                                                                       #
https://bugs.python.org/file40608/patch.diff
                                                                       #

If you do not like this solution, please try the next solution.

Solution 2 : big changes, installs and a patch.

In case the solution above does not solve your problem, you need to first get CPython, Cython and Mingw.

Navigate to the PATH variable on windows and mingw.

                                                                       #
C:\mingw-w64\x86_64-7.1.0-posix-seh-rt_v5-rev0\mingw64\bin
                                                                       #

Navigate to the path bellow. And create a file called distutils.cfg

                                                                       #
C:\Python36\Lib\distutils
                                                                       #

Open the file and then add the lines of code bellow.

                                                                       #
[build]
compiler = mingw32
                                                                       #

The next step is to install this patch.

                                                                       #
https://bugs.python.org/file40608/patch.diff
                                                                       #

And finally download vcruntime140.dll then move it to the location bellow.

                                                                       #
C:\Python36\libs
                                                                       #

All these steps should be enough to fix the issue. I wish you good luck.

If this article has been useful for your particular case, consider donating to our Kofi account, there is a red button at the top of this page.

Summing-up

This is the end of our article, this error could be confusing but with a little bit of investigating the error could be solved easily.

To support us consider donating to our Kofi account above. Keep coding, keep learning and cheers. If you want to learn more about Python, please check out the Python Documentation : https://docs.python.org/3/