Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

UnicodeDecodeError When Loading mxnet Python Module on Windows #20214

Closed
sjiagc opened this issue Apr 25, 2021 · 1 comment
Closed

UnicodeDecodeError When Loading mxnet Python Module on Windows #20214

sjiagc opened this issue Apr 25, 2021 · 1 comment

Comments

@sjiagc
Copy link
Contributor

sjiagc commented Apr 25, 2021

Description

On Windows, the package built with VS 2019 fails to load because of UnicodeDecodeError in methods' doc.

Error Message

>>> import mxnet
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "d:\develop\3rd-party\mxnet\python\mxnet\__init__.py", line 33, in <module>
    from . import contrib
  File "d:\develop\3rd-party\mxnet\python\mxnet\contrib\__init__.py", line 27, in <module>
    from . import autograd
  File "d:\develop\3rd-party\mxnet\python\mxnet\contrib\autograd.py", line 27, in <module>
    from ..ndarray import NDArray, zeros_like, _GRAD_REQ_MAP
  File "d:\develop\3rd-party\mxnet\python\mxnet\ndarray\__init__.py", line 20, in <module>
    from . import _internal, contrib, linalg, op, random, sparse, utils, image, ndarray, numpy
  File "d:\develop\3rd-party\mxnet\python\mxnet\ndarray\numpy\__init__.py", line 23, in <module>
    from . import _register
  File "d:\develop\3rd-party\mxnet\python\mxnet\ndarray\numpy\_register.py", line 27, in <module>
    _init_np_op_module(root_module_name='mxnet', np_module_name='numpy._internal',
  File "d:\develop\3rd-party\mxnet\python\mxnet\base.py", line 944, in _init_np_op_module
    function = make_op_func(hdl, name, func_name)
  File "d:\develop\3rd-party\mxnet\python\mxnet\ndarray\register.py", line 267, in _make_ndarray_function
    code, doc_str = _generate_ndarray_function_code(handle, name, func_name)
  File "d:\develop\3rd-party\mxnet\python\mxnet\ndarray\register.py", line 143, in _generate_ndarray_function_code
    [py_str(arg_descs[i]) for i in range(narg)],
  File "d:\develop\3rd-party\mxnet\python\mxnet\ndarray\register.py", line 143, in <listcomp>
    [py_str(arg_descs[i]) for i in range(narg)],
  File "d:\develop\3rd-party\mxnet\python\mxnet\base.py", line 54, in <lambda>
    py_str = lambda x: x.decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 73-74: invalid continuation byte

To Reproduce

In \path\to\mxnet\ci directory, run python build_windows.py -f WIN_GPU; installed built package to python env; and import mxnet in python command.

Steps to reproduce

(Paste the commands you ran that produced the error.)

  1. cd \path\to\mxnet\ci
  2. set OpenBLAS_HOME=\OpenBLAS\0.3.13
  3. set OpenCV_DIR=\opencv\4.5.2
  4. set CUDA_PATH=\cuda\v11.3
  5. python build_windows.py -f WIN_GPU
  6. Copy \path\to\mxnet\ci\windows_package to a desired place say \path\to\mxnet\dist
  7. Copy libopenblas.dll and opencv_worldxxx.dll into cd \path\to\mxnet\dist\lib
  8. cd \path\to\mxnet\dist
  9. pip install --user -e ./python
  10. In python prompt import mxnet

What have you tried to solve it?

  1. Replace invalid characters '…', '‘' to "..." and '''. Check related PR.

Environment

We recommend using our script for collecting the diagnostic information with the following command
curl --retry 10 -s https://raw.githubusercontent.com/apache/incubator-mxnet/master/tools/diagnose.py | python3

Environment Information
----------Python Info----------
Version      : 3.9.4
Compiler     : MSC v.1916 64 bit (AMD64)
Build        : ('default', 'Apr  9 2021 11:43:21')
Arch         : ('64bit', 'WindowsPE')
------------Pip Info-----------
Version      : 21.0.1
Directory    : D:\develop\py-envs\mxnet\lib\site-packages\pip
----------MXNet Info-----------
An error occured trying to import mxnet.
This is very likely due to missing missing or incompatible library files.
Traceback (most recent call last):
  File "D:\develop\oss\diagnose.py", line 96, in check_mxnet
    print('Version      :', mxnet.__version__)
AttributeError: module 'mxnet' has no attribute '__version__'

----------System Info----------
Platform     : Windows-10-10.0.19041-SP0
system       : Windows
node         : sjiagc-laptop
release      : 10
version      : 10.0.19041
----------Hardware Info----------
machine      : AMD64
processor    : Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
Name
Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz

----------Network Test----------
Setting timeout: 10
Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.1067 sec, LOAD: 1.8341 sec.
Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.3620 sec, LOAD: 0.4518 sec.
Error open Gluon Tutorial(cn): https://zh.gluon.ai, <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1123)>, DNS finished in 0.6243276596069336 sec.
Timing for FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.2793 sec, LOAD: 1.0372 sec.
Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.1217 sec, LOAD: 0.9116 sec.
Error open Conda: https://repo.continuum.io/pkgs/free/, HTTP Error 403: Forbidden, DNS finished in 0.0009951591491699219 sec.
----------Environment----------
sjiagc pushed a commit to sjiagc/incubator-mxnet that referenced this issue Apr 25, 2021
sjiagc pushed a commit to sjiagc/incubator-mxnet that referenced this issue Apr 26, 2021
sjiagc pushed a commit to sjiagc/incubator-mxnet that referenced this issue Apr 26, 2021
@leezu
Copy link
Contributor

leezu commented Apr 26, 2021

Thanks for the fix #20215

@leezu leezu closed this as completed Apr 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants