mxnet icon indicating copy to clipboard operation
mxnet copied to clipboard

WindowsError in python 2.7 (Anaconda) after cmake/VS2013 compilation successful

Open Strateus opened this issue 11 years ago • 40 comments

I have Windows 7 64. I modified base.py to print the path:

>>> import mxnet as mx
C:\Anaconda\lib\site-packages\mxnet-0.5.0-py2.7.egg\mxnet\libmxnet.dll
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Anaconda\lib\site-packages\mxnet-0.5.0-py2.7.egg\mxnet\__init__.py", line 7, in <module>
    from .base import MXNetError
  File "C:\Anaconda\lib\site-packages\mxnet-0.5.0-py2.7.egg\mxnet\base.py", line 44, in <module>
    _LIB = _load_lib()
  File "C:\Anaconda\lib\site-packages\mxnet-0.5.0-py2.7.egg\mxnet\base.py", line 36, in _load_lib
    lib = ctypes.cdll.LoadLibrary(lib_path[0])
  File "C:\Anaconda\lib\ctypes\__init__.py", line 443, in LoadLibrary
    return self._dlltype(name)
  File "C:\Anaconda\lib\ctypes\__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
WindowsError:  [Error 193] %1 is not a valid Win32 application
>>> 

I dont see any documentation warnings that i need to use Python 3.0+. Cmake though warned that he wasnt able to find python 3+ binaries. And Ubuntu version works good on python 2.7.10 (Anaconda as well). Is windows version of mxnet is for Python 3 only?

Strateus avatar Nov 20 '15 09:11 Strateus

This seems to be same error @thirdwing encountered, which happens to some windows machine but we do not know why, @hjk41 do u have any idea on this?

tqchen avatar Nov 21 '15 00:11 tqchen

Exactly the same error on my machine.

thirdwing avatar Nov 21 '15 01:11 thirdwing

you Anaconda is 64bit? and you compilation mxnet with 64bit? or you Anaconda is 32bit? and you compilation mxnet with 32bit? This error is usually caused 32/64bit mix

yajiedesign avatar Nov 21 '15 01:11 yajiedesign

Python 2.7.10 |Anaconda 2.3.0 (32-bit)| (default, Nov 7 2015, 13:29:20) [MSC v.1500 32 bit (Intel)] on win32 mxnet compilation is 64 bit, i used Cmake and VS2013, there is no 32 bit option. How can i make 32 bit compilation of mxnet?

And sorry, i thought 64bit version of python is 3+, so my comments at the beginning were a bit misleading.

Strateus avatar Nov 21 '15 06:11 Strateus

This seems to be a bug introduced recently. I tried with x64 build on Windows 10 several weeks ago and it worked fine. Now I have the same error. I will try to figure out the problem.

On Sat, Nov 21, 2015 at 2:24 PM, Igor S [email protected] wrote:

Python 2.7.10 |Anaconda 2.3.0 (32-bit)| (default, Nov 7 2015, 13:29:20) [MSC v.1500 32 bit (Intel)] on win32 mxnet compilation is 64 bit, i used Cmake and VS2013, there is no 32 bit option. How can i make 32 bit compilation of mxnet?

— Reply to this email directly or view it on GitHub https://github.com/dmlc/mxnet/issues/655#issuecomment-158594570.

HONG Chuntao System Research Group Microsoft Research Asia

hjk41 avatar Nov 23 '15 02:11 hjk41

@Strateus Could you try the latest version, or download the binary distribution from https://github.com/dmlc/mxnet/releases/tag/weekly_binary_build? The bug was somehow resolved on my machine, though I am not sure by which commit.

hjk41 avatar Nov 26 '15 05:11 hjk41

Now i have some error during compilation:

Error   196 error C2064: term does not evaluate to a function taking 2 arguments    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xrefwrap 283 1   mxnet

Any suggestions?

Strateus avatar Nov 26 '15 11:11 Strateus

This is a bug bring in recently. Fixing...

On Thu, Nov 26, 2015 at 7:14 PM, Igor S [email protected] wrote:

Now i have some error during compilation:

Error 196 error C2064: term does not evaluate to a function taking 2 arguments C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xrefwrap 283 1 mxnet

Any suggestions?

— Reply to this email directly or view it on GitHub https://github.com/dmlc/mxnet/issues/655#issuecomment-159885212.

HONG Chuntao System Research Group Microsoft Research Asia

hjk41 avatar Nov 27 '15 02:11 hjk41

PR #731 (https://github.com/dmlc/mxnet/pull/731) should fix this. Please wait till it is merged.

On Fri, Nov 27, 2015 at 10:56 AM, Chuntao HONG [email protected] wrote:

This is a bug bring in recently. Fixing...

On Thu, Nov 26, 2015 at 7:14 PM, Igor S [email protected] wrote:

Now i have some error during compilation:

Error 196 error C2064: term does not evaluate to a function taking 2 arguments C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xrefwrap 283 1 mxnet

Any suggestions?

— Reply to this email directly or view it on GitHub https://github.com/dmlc/mxnet/issues/655#issuecomment-159885212.

HONG Chuntao System Research Group Microsoft Research Asia

HONG Chuntao System Research Group Microsoft Research Asia

hjk41 avatar Nov 27 '15 03:11 hjk41

OK. it is merged. Please have another try. :-)

On Fri, Nov 27, 2015 at 11:10 AM, Chuntao HONG [email protected] wrote:

PR #731 (https://github.com/dmlc/mxnet/pull/731) should fix this. Please wait till it is merged.

On Fri, Nov 27, 2015 at 10:56 AM, Chuntao HONG [email protected] wrote:

This is a bug bring in recently. Fixing...

On Thu, Nov 26, 2015 at 7:14 PM, Igor S [email protected] wrote:

Now i have some error during compilation:

Error 196 error C2064: term does not evaluate to a function taking 2 arguments C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xrefwrap 283 1 mxnet

Any suggestions?

— Reply to this email directly or view it on GitHub https://github.com/dmlc/mxnet/issues/655#issuecomment-159885212.

HONG Chuntao System Research Group Microsoft Research Asia

HONG Chuntao System Research Group Microsoft Research Asia

HONG Chuntao System Research Group Microsoft Research Asia

hjk41 avatar Nov 27 '15 03:11 hjk41

I have same issue now as at the beginning:

WindowsError:  [Error 193] %1 is not a valid Win32 application

I just copied new dll from build/Release to previous mxnet python installation, or i need to reinstall python build as well?

Strateus avatar Nov 27 '15 07:11 Strateus

Yes. Please reinstall.

On Fri, Nov 27, 2015 at 3:21 PM, Igor S [email protected] wrote:

I have same issue now as at the beginning:

WindowsError: [Error 193] %1 is not a valid Win32 application

I just copied new dll from build/Release to previous mxnet python installation, or i need to reinstall python build as well?

— Reply to this email directly or view it on GitHub https://github.com/dmlc/mxnet/issues/655#issuecomment-160057864.

HONG Chuntao System Research Group Microsoft Research Asia

hjk41 avatar Nov 27 '15 07:11 hjk41

Now its very strange, i tried to import it twice in a row and there are different errors:

>>> import mxnet
  File "C:\Anaconda\lib\site-packages\mxnet-0.5.0-py2.7.egg\mxnet\__init__.py", line 7, in <module>
    from .base import MXNetError
  File "C:\Anaconda\lib\site-packages\mxnet-0.5.0-py2.7.egg\mxnet\base.py", line 43, in <module>
    _LIB = _load_lib()
  File "C:\Anaconda\lib\site-packages\mxnet-0.5.0-py2.7.egg\mxnet\base.py", line 35, in _load_lib
    lib = ctypes.cdll.LoadLibrary(lib_path[0])
  File "C:\Anaconda\lib\ctypes\__init__.py", line 443, in LoadLibrary
    return self._dlltype(name)
  File "C:\Anaconda\lib\ctypes\__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
WindowsError:  [Error 193] %1 is not a valid Win32 application
>>> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>

>>> import mxnet
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Anaconda\lib\site-packages\mxnet-0.5.0-py2.7.egg\mxnet\__init__.py", line 7, in <module>
    from .base import MXNetError
  File "C:\Anaconda\lib\site-packages\mxnet-0.5.0-py2.7.egg\mxnet\base.py", line 10, in <module>
    from . import libinfo
ImportError: cannot import name libinfo
>>> 

Strateus avatar Nov 27 '15 07:11 Strateus

btw im cloning master, maybe i need to clone some branch?

Strateus avatar Nov 27 '15 07:11 Strateus

I am using master. Windows 10 with Python 3.4 x86_64.

Is it possible for you to try Python 3.4? I cannot install mxnet with python 2.7 on my machine. It requires vcpython27, which only supports windows 7/8/8.1. @_@

On Fri, Nov 27, 2015 at 3:31 PM, Igor S [email protected] wrote:

btw im cloning master, maybe i need to clone some branch?

— Reply to this email directly or view it on GitHub https://github.com/dmlc/mxnet/issues/655#issuecomment-160058881.

HONG Chuntao System Research Group Microsoft Research Asia

hjk41 avatar Nov 27 '15 08:11 hjk41

a probably stupid question: are you using 32bit or 64bit python? You will need 64bit python to use 64bit mxnet.

On Fri, Nov 27, 2015 at 4:53 PM, Chuntao HONG [email protected] wrote:

I am using master. Windows 10 with Python 3.4 x86_64.

Is it possible for you to try Python 3.4? I cannot install mxnet with python 2.7 on my machine. It requires vcpython27, which only supports windows 7/8/8.1. @_@

On Fri, Nov 27, 2015 at 3:31 PM, Igor S [email protected] wrote:

btw im cloning master, maybe i need to clone some branch?

— Reply to this email directly or view it on GitHub https://github.com/dmlc/mxnet/issues/655#issuecomment-160058881.

HONG Chuntao System Research Group Microsoft Research Asia

HONG Chuntao System Research Group Microsoft Research Asia

hjk41 avatar Nov 27 '15 08:11 hjk41

i replied to that earlier - im using 32 bit python. So there is no way to install on 32 bit python under windows?

Strateus avatar Nov 27 '15 12:11 Strateus

The pre-built binary distribution is 64bit. So you will need 64bit python to use that package. I think it is also possible to built 32bit mxnet and use it in 32bit python. Let me have a try.

On Fri, Nov 27, 2015 at 8:16 PM, Igor S [email protected] wrote:

i replied to that earlier - im using 32 bit python. So there is no way to install on 32 bit python under windows?

— Reply to this email directly or view it on GitHub https://github.com/dmlc/mxnet/issues/655#issuecomment-160127787.

HONG Chuntao System Research Group Microsoft Research Asia

hjk41 avatar Nov 30 '15 01:11 hjk41

i also meet the same question: import mxnet as mx Traceback (most recent call last): File "", line 1, in File "D:\Python27\lib\site-packages\mxnet-0.5.0-py2.7.egg\mxnet__init__.py", line 7, in from .base import MXNetError File "D:\Python27\lib\site-packages\mxnet-0.5.0-py2.7.egg\mxnet\base.py", line 43, in LIB = load_lib() File "D:\Python27\lib\site-packages\mxnet-0.5.0-py2.7.egg\mxnet\base.py", line 35, in load_lib lib = ctypes.cdll.LoadLibrary(lib_path[0]) File "D:\Python27\lib\ctypes__init.py", line 443, in LoadLibrary return self.dlltype(name) File "D:\Python27\lib\ctypes__init.py", line 365, in init self._handle = _dlopen(self._name, mode) WindowsError: [Error 126]

i use the VS2013 and PTVS, after i build successfully. I follow the installation guide,and i use "python setup.py install".But i can't import the mxnet.

li-haoran avatar Dec 10 '15 03:12 li-haoran

haoran, are you using 32bit Python or 64bit?

On Thu, Dec 10, 2015 at 11:36 AM, li-haoran [email protected] wrote:

i also meet the same question: import mxnet as mx Traceback (most recent call last): File "", line 1, in File "D:\Python27\lib\site-packages\mxnet-0.5.0-py2.7.egg\mxnet__init__.py", line 7, in from .base import MXNetError File "D:\Python27\lib\site-packages\mxnet-0.5.0-py2.7.egg\mxnet\base.py", line 43, in

LIB = load_lib() File "D:\Python27\lib\site-packages\mxnet-0.5.0-py2.7.egg\mxnet\base.py", line 35, in load_lib lib = ctypes.cdll.LoadLibrary(lib_path[0]) File "D:\Python27\lib\ctypes__init.py", line 443, in LoadLibrary return self. dlltype(name) File "D:\Python27\lib\ctypes__init.py", line 365, in init self._handle = _dlopen(self._name, mode) WindowsError: [Error 126]

i use the VS2013 and PTVS, after i build successfully. I follow the installation guide,and i use "python setup.py install".But i can't import the mxnet.

— Reply to this email directly or view it on GitHub https://github.com/dmlc/mxnet/issues/655#issuecomment-163477238.

HONG Chuntao System Research Group Microsoft Research Asia

hjk41 avatar Dec 10 '15 03:12 hjk41