1

I have a problem. I am using Windows 7 32x, Python 3.

When I try to import the numpy library in code, no matter what, I get an error. I don't remember how to solve it.

The code itself:

import numba

print('Hello World!')

And here is the error:

Traceback (most recent call last):
  File "C:\Users\User\Desktop\numba_test.py", line 1, in <module>
    import numba
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\numba\__init__.py", line 38, in <module>
    from numba.core.decorators import (cfunc, generated_jit, jit, njit, stencil,
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\numba\core\decorators.py", line 12, in <module>
    from numba.stencils.stencil import stencil
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\numba\stencils\stencil.py", line 11, in <module>
    from numba.core import types, typing, utils, ir, config, ir_utils, registry
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\numba\core\registry.py", line 4, in <module>
    from numba.core import utils, typing, dispatcher, cpu
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\numba\core\dispatcher.py", line 13, in <module>
    from numba.core import (
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\numba\core\compiler.py", line 6, in <module>
    from numba.core import (utils, errors, typing, interpreter, bytecode, postproc,
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\numba\core\cpu.py", line 15, in <module>
    import numba.core.entrypoints
  File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\numba\core\entrypoints.py", line 8, in <module>
    import importlib_metadata
ValueError: source code string cannot contain null bytes

I have reinstalled numba several times, searched for solutions on the Internet, but all without success. Help what you can.

Vlad_385
  • 11
  • 4
  • Have you tried the solutions suggested here? https://stackoverflow.com/questions/31233777/python-source-code-string-cannot-contain-null-byte – Giovanni Minelli Dec 28 '22 at 16:44
  • @Giovanni Minelli I have looked at this post. I don't understand where to put this code: sed -i 's/\x0//g' FILENAME? – Vlad_385 Dec 28 '22 at 17:53
  • The highlighted correct answer is about a source file containing a wrong encoded char and this command solve the issue but i don't think you want to clone the library and clean the file which give you the error. The other answers talk about a wrong encoding from the IDE used, or a problem of the interpreter. Have you tried with a slightly different version of python or changing IDE for the execution? What is the exact version of python you are using? – Giovanni Minelli Dec 29 '22 at 23:38
  • I tested it on Py 3.7,3.8,3.9 and I've not encountered any problem. Furthermore i've not found any mention of this problem in the issue section of the library git repository, so probaly is a problem on your side – Giovanni Minelli Dec 29 '22 at 23:39
  • Hello. Thank you for helping me solve my problem. But I already decided it. I just reinstalled the importlib-metadata library and everything worked for me. Thanks for trying to help me! – Vlad_385 Dec 30 '22 at 20:40

0 Answers0