Install wxPython 4 for MSYS2

83 views
Skip to first unread message

Brendan Simon (eTRIX)

unread,
May 11, 2018, 12:38:46 AM5/11/18
to wxPython-users
I've used wxPython 4 (4.0.1) on macos by simply installing with "pip3.6 install wxPython".

I've also done this on Windows before using the Python.org install of python.

I tried doing "pip3.6 install wxPython" from and msys2 mingw64 shell but it didn't install/build.

It complains with `distutils.errors.DistutilsPlatformError: VC 6.0 is not supported by this module`

It seems the msvc9compiler.py file is looking at `sys.version` to find the sub-string `MSC v.`, which isn't in `sys.version`, so VERSION is set to the default of 6.

Is this an msys2/mingw issue or a python issue?  How do I go about getting this to work?

Once I've installed wxPython, am I also able to use C++ to build a C++ app using the same wxWidgets librariers that wxPython uses (using wx-config, etc)?

brend@BJS_DELL_17 MINGW64 ~
$ pip3.6 install -U wxPython
Collecting wxPython
  Using cached https://files.pythonhosted.org/packages/a4/4a/d35b19f8c21b414ece2b3dc02dcf8cb0d45d6fe5aacf56f7ca0b7c66ac58/wxPython-4.0.1.tar.gz
Requirement not upgraded as not directly required: six in c:/msys64/mingw64/lib/python3.6/site-packages (from wxPython) (1.11.0)
Installing collected packages: wxPython
  Running setup.py install for wxPython ... error
    Complete output from command C:/msys64/mingw64/bin/python3.exe -u -c "import setuptools, tokenize;__file__='C:/Users/brend/AppData/Local/Temp/pip-install-8le1c189/wxPython/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:/Users/brend/AppData/Local/Temp/pip-record-p71raf86/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    WARNING: Building this way assumes that all generated files have been
    generated already.  If that is not the case then use build.py directly
    to generate the source and perform the build stage.  You can use
    --skip-build with the bdist_* or install commands to avoid this
    message and the wxWidgets and Phoenix build steps in the future.

    "C:/msys64/mingw64/bin/python3.exe" -u build.py build
    Will build using: "C:/msys64/mingw64/bin/python3.exe"
    3.6.5 (default, Apr 16 2018, 10:17:38)  [GCC 7.3.0 64 bit (AMD64)]
    Python's architecture is 64bit
    cfg.VERSION: 4.0.1

    Running command: build
    Running command: build_wx
    Command '"C:/msys64/mingw64/bin/python3.exe" -c "import distutils.msvc9compiler as msvc; mc = msvc.MSVCCompiler(); mc.initialize(); print(mc.cc)"' failed with exit code 1.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:/msys64/mingw64/lib/python3.6\distutils\msvc9compiler.py", line 297, in <module>
        raise DistutilsPlatformError("VC %0.1f is not supported by this module" % VERSION)
    distutils.errors.DistutilsPlatformError: VC 6.0 is not supported by this module
    Finished command: build_wx (0.124s)
    Finished command: build (0.124s)
    Command '"C:/msys64/mingw64/bin/python3.exe" -u build.py build' failed with exit code 1.

    ----------------------------------------
Command "C:/msys64/mingw64/bin/python3.exe -u -c "import setuptools, tokenize;__file__='C:/Users/brend/AppData/Local/Temp/pip-install-8le1c189/wxPython/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:/Users/brend/AppData/Local/Temp/pip-record-p71raf86/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:/Users/brend/AppData/Local/Temp/pip-install-8le1c189/wxPython/


Thanks,
Brendan.

Dietmar Schwertberger

unread,
May 11, 2018, 5:39:57 AM5/11/18
to wxpytho...@googlegroups.com
On 5/11/2018 6:38 AM, Brendan Simon (eTRIX) wrote:
Is this an msys2/mingw issue or a python issue?  How do I go about getting this to work?

Do you need msys2? Then you probably need to patch the detection to return the correct version and maybe submit a bug report to the msys2 people.


If you don't need msys2:
Usually, you need cygwin for the build process as build.py calls a bash shell script, but the build command itself can run outside.

E.g.:
D:/Python/Python36/python.exe build.py dox etg --nodoc sip build


Regards,

Dietmar

Brendan Simon

unread,
May 14, 2018, 7:55:12 AM5/14/18
to wxPython-users

I don't strictly need to use msys2, but I've started using it at work (in preference to cygwin as it is supposed to be more Windows friendly), so I wanted to use the same tools for a work based wx C++ app.  Msys2 does have wxwidgets 3.0.4 (and wxPython 3 with python 2.7), but I was also wanting to use wxPython 4 with Python 3.6 (as I do on my Mac) and keep the same version of tools (that's all !!)

Some options are:
    * msys2 with wxwidgets 3.0.4 and msys2 gcc/clang compilers (using wxglade generated C++ layouts).
    * Use official Python (3.6 or whatever) + pip install wxPython (assuming I can C++ compile against the associated wxwidgets libs)
    * Use msys2 gcc/clang compilers to build/install wxwidgets from source (my least preferred option).

Msys2 does have a few disadvantages.  One major one is it's not possible to have multiple versions of packages, so not easy to have various versions for various projects.

I'll keep experimenting

nepix32

unread,
May 15, 2018, 10:37:16 AM5/15/18
to wxPython-users
Is it even possible under Windows for a Python 3.6 to use another compiler than VC++ 2015? I remember that the last Python I was able to compile C extensions with mingw32 was Python 3.4.

Brendan Simon (eTRIX)

unread,
May 15, 2018, 8:06:58 PM5/15/18
to wxpytho...@googlegroups.com

> nepix32 <nep...@gmail.com>: May 15 07:37AM -0700


>
> Is it even possible under Windows for a Python 3.6 to use another compiler
> than VC++ 2015? I remember that the last Python I was able to compile C
> extensions with mingw32 was Python 3.4.

Not sure.  MSYS2 has the following python3 packages, and they seemed be compiled with GCC.

$ pacman -Ss python3 | grep 3.6
mingw32/mingw-w64-i686-python3 3.6.5-1 [installed]
mingw64/mingw-w64-x86_64-python3 3.6.5-1 [installed]
msys/python 3.6.2-1 [installed]

$ /mingw32/bin/python3
Python 3.6.5 (default, Apr 16 2018, 10:30:41)  [GCC 7.3.0 32 bit] on win32
Type "help", "copyright", "credits" or "license" for more information.

$ /usr/bin/python3
Python 3.6.2 (default, Sep  7 2017, 13:16:50)
[GCC 6.3.0] on msys
Type "help", "copyright", "credits" or "license" for more information.

Anyway I came to the conclusion that using prebuilt libraries wont work unless using the exact same compiler, which means I can't use the wxPython as that uses VC++ (I think).

The only way to use it with MSYS2/MINGW, would be to build it from sources with MSYS2/MINGW tools.

Thanks, Brendan.

Robin Dunn

unread,
May 16, 2018, 11:54:21 AM5/16/18
to wxPython-users
On Tuesday, May 15, 2018 at 5:06:58 PM UTC-7, Brendan Simon wrote:

> nepix32 <nep...@gmail.com>: May 15 07:37AM -0700
>
> Is it even possible under Windows for a Python 3.6 to use another compiler
> than VC++ 2015? I remember that the last Python I was able to compile C
> extensions with mingw32 was Python 3.4.

Not sure.  MSYS2 has the following python3 packages, and they seemed be compiled with GCC.

$ pacman -Ss python3 | grep 3.6
mingw32/mingw-w64-i686-python3 3.6.5-1 [installed]
mingw64/mingw-w64-x86_64-python3 3.6.5-1 [installed]
msys/python 3.6.2-1 [installed]

$ /mingw32/bin/python3
Python 3.6.5 (default, Apr 16 2018, 10:30:41)  [GCC 7.3.0 32 bit] on win32
Type "help", "copyright", "credits" or "license" for more information.

$ /usr/bin/python3
Python 3.6.2 (default, Sep  7 2017, 13:16:50)
[GCC 6.3.0] on msys
Type "help", "copyright", "credits" or "license" for more information.

Anyway I came to the conclusion that using prebuilt libraries wont work unless using the exact same compiler, which means I can't use the wxPython as that uses VC++ (I think).


Yes, C-only extensions can usually be pounded into shape that would allow mixed compiler use, at least with older versions of everything the last time I tried to do it. However mixing C++ is more difficult or impossible, even with Python itself being C-only.

 

The only way to use it with MSYS2/MINGW, would be to build it from sources with MSYS2/MINGW tools.


It's probably doable, but wxPython's build.py (and the other modules it uses) would need to have some work done to support it. If you work on this please do submit a PR for it. A work-in-progress PR would be okay too as that's a good way to give feedback or provide help if needed.

--
Robin

Reply all
Reply to author
Forward
0 new messages