Windows 10 + python 3.7 + wxpython 4.0.3: "DLL load failed"

747 views
Skip to first unread message

itsay...@gmail.com

unread,
Sep 15, 2018, 4:09:38 AM9/15/18
to wxPython-users
Hi,

I've seen this reported in years past as a missing DLL in the wxpython distribution, but before I reported it as an issue, I thought I'd ask a question here first.

On Windows 10, with python 3.7, installing wxPython 4.0.3 (latest) from pip3 into a virtualenv, I get the following error when I try to import wx:
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
Traceback (most recent call last):
 
File "<stdin>", line 1, in <module>
 
File "C:\Users\mclapp\git\marcam\virt\lib\site-packages\wx\__init__.py", line
17, in <module>
   
from wx.core import *
 
File "C:\Users\mclapp\git\marcam\virt\lib\site-packages\wx\core.py", line 12,
in <module>
   
from ._core import *
ImportError: DLL load failed: The specified module could not be found.
>>>

Is this my own user error, or is this a missing DLL in the pip-distributed wxPython for python 3.7.0?  (It seemed to work fine for python 3.6.6)

thanks,
Matt

Steve Barnes

unread,
Sep 15, 2018, 4:25:45 AM9/15/18
to wxpytho...@googlegroups.com


On 15/09/2018 09:09, itsay...@gmail.com wrote:
> Hi,
>
> I've seen this reported in years past as a missing DLL in the wxpython
> distribution, but before I reported it as an issue, I thought I'd ask a
> question here first.
>
> On Windows 10, with python 3.7, installing wxPython 4.0.3 (latest) from
> pip3 into a virtualenv, I get the following error when I try to import wx:
> |
> Python3.7.0(v3.7.0:1bf9cc5093,Jun272018,04:06:47)[MSC v.191432bit
> (Intel)]on win32
> Type"help","copyright","credits"or"license"formore information.
>>>>importwx
> Traceback(most recent call last):
> File"<stdin>",line 1,in<module>
> File"C:\Users\mclapp\git\marcam\virt\lib\site-packages\wx\__init__.py",line
> 17,in<module>
> fromwx.core import*
> File"C:\Users\mclapp\git\marcam\virt\lib\site-packages\wx\core.py",line 12,
> in<module>
> from._core import*
> ImportError:DLL load failed:Thespecified modulecould notbe found.
>>>>
> |
>
> Is this my own user error, or is this a missing DLL in the
> pip-distributed wxPython for python 3.7.0?  (It seemed to work fine for
> python 3.6.6)
>
> thanks,
> Matt
>
> --
> You received this message because you are subscribed to the Google
> Groups "wxPython-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to wxpython-user...@googlegroups.com
> <mailto:wxpython-user...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Matt,

I just tried, (on windows 10):
> py -0
Installed Pythons found by py Launcher for Windows
-3.7-64 *
-3.6-64
-2.7-32


Gadget@GADGETLAPTOP C:\Users\Gadget
> py -mvenv test_wx

Gadget@GADGETLAPTOP C:\Users\Gadget
> test_wx\Scripts\activate

(test_wx) Gadget@GADGETLAPTOP C:\Users\Gadget
> py -mpip install wxPython
Collecting wxPython
Using cached
https://files.pythonhosted.org/packages/34/41/e0e109a72966f596a5b93123d94eaabd53509ef6766fa3321b4bfadbbb14/wxPython-4.0.3-cp37-cp37m-win_amd64.whl
Collecting PyPubSub (from wxPython)
Using cached
https://files.pythonhosted.org/packages/ab/9e/3b50915d3346971aaa49074425788598ee4907e67c097e013f1a862bd45c/Pypubsub-4.0.0-py3-none-any.whl
Collecting six (from wxPython)
Using cached
https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Installing collected packages: PyPubSub, six, wxPython
Successfully installed PyPubSub-4.0.0 six-1.11.0 wxPython-4.0.3
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade
pip' command.

(test_wx) Gadget@GADGETLAPTOP C:\Users\Gadget
> python
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> wx.version()
'4.0.3 msw (phoenix) wxWidgets 3.0.5'
>>>


--
Steve (Gadget) Barnes
Any opinions in this message are my personal opinions and do not reflect
those of my employer.

---
This email has been checked for viruses by AVG.
https://www.avg.com

itsay...@gmail.com

unread,
Sep 15, 2018, 4:48:15 AM9/15/18
to wxPython-users
Hi Steve,

Thanks for the info.  I tried a bunch of different things (adding ..\Python37\Scripts to my PATH, using python3 -m pip install) but I still get the "DLL load failed".

The main difference I can see is that I'm using the 32-bit version of python 3.7 and you're using the 64-bit version.

Steve Barnes

unread,
Sep 15, 2018, 5:18:02 AM9/15/18
to wxpytho...@googlegroups.com


On 15/09/2018 09:48, itsay...@gmail.com wrote:
> Hi Steve,
>
> Thanks for the info.  I tried a bunch of different things (adding
> ..\Python37\Scripts to my PATH, using python3 -m pip install) but I
> still get the "DLL load failed".
>
> The main difference I can see is that I'm using the 32-bit version of
> python 3.7 and you're using the 64-bit version.
>
>
I did a fresh install of Python 3.7.0 32-Bit (on Windows 10) from a
fresh download and tried:

> py -0
Installed Pythons found by py Launcher for Windows
-3.7-64 *
-3.7-32
-3.6-64
-2.7-32


Gadget@GADGETLAPTOP C:\Users\Gadget
> py -3.7-32 -mvenv test_wx

Gadget@GADGETLAPTOP C:\Users\Gadget
> test_wx\Scripts\activate.bat

(test_wx) Gadget@GADGETLAPTOP C:\Users\Gadget
> py -mpip install wxPython
Collecting wxPython
Downloading
https://files.pythonhosted.org/packages/f7/62/bbe01210d84188c666a064c87362be9d6a015870f65615f2a9450e7b95b1/wxPython-4.0.3-cp37-cp37m-win32.whl
(13.8MB)
100% |████████████████████████████████| 13.8MB 1.2MB/s
Collecting PyPubSub (from wxPython)
Using cached
https://files.pythonhosted.org/packages/ab/9e/3b50915d3346971aaa49074425788598ee4907e67c097e013f1a862bd45c/Pypubsub-4.0.0-py3-none-any.whl
Collecting six (from wxPython)
Using cached
https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Installing collected packages: PyPubSub, six, wxPython
Successfully installed PyPubSub-4.0.0 six-1.11.0 wxPython-4.0.3
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade
pip' command.

(test_wx) Gadget@GADGETLAPTOP C:\Users\Gadget
> python
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> wx.version()
'4.0.3 msw (phoenix) wxWidgets 3.0.5'
>>>

So that worked for me as well - one possibility that occurs to me is
that after activating the venv you might have used pip to install
wxPython rather than py -m pip or python -m pip - depending on your pip
you might have then installed wxPython to another python installation.

Also make sure that you don't have a wx directory in the location that
you are running your tests from (it might be picked up as what you are
trying to import).

itsay...@gmail.com

unread,
Sep 15, 2018, 5:12:11 PM9/15/18
to wxPython-users
I did a little detective work and compared what my virtualenv dir looks like for Python3.7 vs. Python3.6.6...

When I have a Python 3.7 installation, installing wxpython into a virtual env is missing the following two dll libraries:
./Lib/site-packages/wx/msvcp140.dll
./Lib/site-packages/wx/vcruntime140.dll

(They are present in a Python 3.6.6 virtual env wxpython pip install)

I think these must be missing in general on my system, and not provided by the wx install.
Steve, since these are generic Windows dlls, I wonder if you just have them somewhere else on your system?  Or maybe one of the other python versions makes them available to your system?


More details:
I ran `find . -name '*.dll'` in my virtualenv dir, once with Python3.6 only installed on my system, and once with Python3.7 only installed.

The results:
eviltwin$ diff py37dll.txt py36dll.txt
6,7c6,7
< ./Lib/site-packages/pywin32_system32/pythoncom37.dll
< ./Lib/site-packages/pywin32_system32/pywintypes37.dll
---
> ./Lib/site-packages/pywin32_system32/pythoncom36.dll
> ./Lib/site-packages/pywin32_system32/pywintypes36.dll
13a14,15
> ./Lib/site-packages/wx/msvcp140.dll
> ./Lib/site-packages/wx/vcruntime140.dll
31,32d32
< ./Scripts/libcrypto-1_1.dll
< ./Scripts/libssl-1_1.dll
34c34
< ./Scripts/python37.dll
---
> ./Scripts/python36.dll
eviltwin$



itsay...@gmail.com

unread,
Sep 15, 2018, 5:26:57 PM9/15/18
to wxPython-users
That seems to be the issue.  When those two files are in my python search path, everything works fine.

Steve Barnes

unread,
Sep 16, 2018, 1:21:29 AM9/16/18
to wxpytho...@googlegroups.com


On 15/09/2018 22:26, itsay...@gmail.com wrote:
> That seems to be the issue.  When those two files are in my python
> search path, everything works fine.
>
> On Saturday, September 15, 2018 at 2:12:11 PM UTC-7, itsay...@gmail.com
> wrote:
>
> I did a little detective work and compared what my virtualenv dir
> looks like for Python3.7 vs. Python3.6.6...
>
> When I have a Python 3.7 installation, installing wxpython into a
> virtual env is *missing* the following two dll libraries:
> ./Lib/site-packages/wx/msvcp140.dll
> ./Lib/site-packages/wx/vcruntime140.dll
>
> (They are present in a Python 3.6.6 virtual env wxpython pip install)
>
How are you creating your virtual env? When I use py -mvenv name it
copies vcruntime140.dll into my name/Scripts directory - I do have a
number of copies of msvcp140.dll still on my path but that is not
copied. However, if I change my path to just name/Scripts python still
runs wx just fine.

itsay...@gmail.com

unread,
Sep 16, 2018, 1:43:13 AM9/16/18
to wxPython-users
I'm using python3 native virtual environment:
python3 -m venv virt

I started an issue on wxpython:

It was pointed out vcruntime140.dll is not the problem as it is present in the stock python distribution. 
But I do see that if I don't manually add msvcp140.dll to somewhere in my path (even in the current directory), `import wx` will fail.

I'm not sure how it works for you but not for me if you limit your path.  But it was included specifically for python3.6.6 distribution of wxpython, so that leads me to believe that maybe there's something to it.

Robin Dunn

unread,
Sep 24, 2018, 1:10:33 PM9/24/18
to wxPython-users
On Saturday, September 15, 2018 at 2:12:11 PM UTC-7, itsay...@gmail.com wrote:
I did a little detective work and compared what my virtualenv dir looks like for Python3.7 vs. Python3.6.6...

When I have a Python 3.7 installation, installing wxpython into a virtual env is missing the following two dll libraries:
./Lib/site-packages/wx/msvcp140.dll
./Lib/site-packages/wx/vcruntime140.dll

(They are present in a Python 3.6.6 virtual env wxpython pip install)


Yep, the C Runtime DLLs were accidentally left out of the 3.7 wheels. This has already been fixed but in the meantime you can install the DLLs on the system using Microsoft's installer. https://www.microsoft.com/en-us/download/details.aspx?id=48145

--
Robin

 
Reply all
Reply to author
Forward
0 new messages