mxnet installs but fails on import

asked 2020-07-26 07:00:25 +0200

cybervigilante gravatar image

updated 2020-07-26 17:02:14 +0200

slelievre gravatar image

I need mxnet for a linalg notebook. It installed successfully, but when I try to import it I get this error. The final error is OSError: Exec format error.

OSError                                   Traceback (most recent call last)
<ipython-input-10-1eadd2d362f9> in <module>()
----> 1 import mxnet

/opt/sagemath-9.0/local/lib/python3.7/site-packages/mxnet/__init__.py in <module>()
     22 from __future__ import absolute_import
     23 
---> 24 from .context import Context, current_context, cpu, gpu, cpu_pinned
     25 from . import engine
     26 from .base import MXNetError

/opt/sagemath-9.0/local/lib/python3.7/site-packages/mxnet/context.py in <module>()
     22 import warnings
     23 import ctypes
---> 24 from .base import classproperty, with_metaclass, _MXClassPropertyMetaClass
     25 from .base import _LIB
     26 from .base import check_call

/opt/sagemath-9.0/local/lib/python3.7/site-packages/mxnet/base.py in <module>()
    212 __version__ = libinfo.__version__
    213 # library instance of mxnet
--> 214 _LIB = _load_lib()
    215 
    216 # type definitions

/opt/sagemath-9.0/local/lib/python3.7/site-packages/mxnet/base.py in _load_lib()
    203     """Load library by searching possible path."""
    204     lib_path = libinfo.find_lib_path()
--> 205     lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
    206     # DMatrix functions
    207     lib.MXGetLastError.restype = ctypes.c_char_p

/opt/sagemath-9.0/local/lib/python3.7/ctypes/__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
    354 
    355         if handle is None:
--> 356             self._handle = _dlopen(self._name, mode)
    357         else:
    358             self._handle = handle

OSError: Exec format error
edit retag flag offensive close merge delete

Comments

What operating system? How did you install Sage? How did you install mxnet? Do you have development tools installed?

slelievre gravatar imageslelievre ( 2020-07-26 17:03:45 +0200 )edit

The following works for me on macOS 10.14.6, with Sage 9.1.rc4 built from source.

$ sage -q
sage: !pip install mxnet
sage: import mxnet
slelievre gravatar imageslelievre ( 2020-07-27 08:19:29 +0200 )edit