Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError 'b' #5598

Closed
praetorianer777 opened this issue Apr 20, 2020 · 5 comments
Closed

KeyError 'b' #5598

praetorianer777 opened this issue Apr 20, 2020 · 5 comments
Labels
no action required No action was needed to resolve.

Comments

@praetorianer777
Copy link

Hello, I just installed numba via pip.
If I start the Python console and just want to import numba I get this error message:

Python 2.7.17 (default, Nov  7 2019, 10:07:09) 
[GCC 7.4.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from numba import jit
/usr/local/lib/python2.7/dist-packages/numba/errors.py:131: UserWarning: Insufficiently recent colorama version found. Numba requires colorama >= 0.3.9
  warnings.warn(msg)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/numba/__init__.py", line 45, in <module>
    import numba.typed
  File "/usr/local/lib/python2.7/dist-packages/numba/typed/__init__.py", line 3, in <module>
    from .typeddict import Dict
  File "/usr/local/lib/python2.7/dist-packages/numba/typed/typeddict.py", line 18, in <module>
    @njit
  File "/usr/local/lib/python2.7/dist-packages/numba/decorators.py", line 224, in njit
    return jit(*args, **kws)
  File "/usr/local/lib/python2.7/dist-packages/numba/decorators.py", line 161, in jit
    return wrapper(pyfunc)
  File "/usr/local/lib/python2.7/dist-packages/numba/decorators.py", line 177, in wrapper
    **dispatcher_args)
  File "/usr/local/lib/python2.7/dist-packages/numba/dispatcher.py", line 576, in __init__
    self.targetctx = self.targetdescr.target_context
  File "/usr/local/lib/python2.7/dist-packages/numba/targets/registry.py", line 50, in target_context
    return self._toplevel_target_context
  File "/usr/local/lib/python2.7/dist-packages/numba/utils.py", line 381, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/usr/local/lib/python2.7/dist-packages/numba/targets/registry.py", line 34, in _toplevel_target_context
    return cpu.CPUContext(self.typing_context)
  File "/usr/local/lib/python2.7/dist-packages/numba/targets/base.py", line 250, in __init__
    self.init()
  File "/usr/local/lib/python2.7/dist-packages/numba/compiler_lock.py", line 32, in _acquire_compile_lock
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/numba/targets/cpu.py", line 59, in init
    rtsys.initialize(self)
  File "/usr/local/lib/python2.7/dist-packages/numba/compiler_lock.py", line 32, in _acquire_compile_lock
    return func(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/numba/runtime/nrt.py", line 39, in initialize
    self._library = nrtdynmod.compile_nrt_functions(ctx)
  File "/usr/local/lib/python2.7/dist-packages/numba/runtime/nrtdynmod.py", line 210, in compile_nrt_functions
    library.add_ir_module(ir_mod)
  File "/usr/local/lib/python2.7/dist-packages/numba/targets/codegen.py", line 184, in add_ir_module
    ir = cgutils.normalize_ir_text(str(ir_module))
  File "/usr/local/lib/python2.7/dist-packages/llvmlite/ir/module.py", line 244, in __repr__
    lines += self._get_metadata_lines()
  File "/usr/local/lib/python2.7/dist-packages/llvmlite/ir/module.py", line 222, in _get_metadata_lines
    mdbuf.append(str(md))
  File "/usr/local/lib/python2.7/dist-packages/llvmlite/ir/_utils.py", line 48, in __str__
    s = self.__cached_str = self._to_string()
  File "/usr/local/lib/python2.7/dist-packages/llvmlite/ir/values.py", line 223, in _to_string
    self.descr(buf)
  File "/usr/local/lib/python2.7/dist-packages/llvmlite/ir/values.py", line 354, in descr
    operands.append(op.get_reference())
  File "/usr/local/lib/python2.7/dist-packages/llvmlite/ir/_utils.py", line 58, in get_reference
    s = self.__cached_refstr = self._get_reference()
  File "/usr/local/lib/python2.7/dist-packages/llvmlite/ir/values.py", line 277, in _get_reference
    return '!"{0}"'.format(_escape_string(self.string))
  File "/usr/local/lib/python2.7/dist-packages/llvmlite/ir/values.py", line 36, in _escape_string
    buf = [_map[ch] for ch in text]
KeyError: 'b'

What is the problem here?

@esc esc added the no action required No action was needed to resolve. label Apr 21, 2020
@esc
Copy link
Member

esc commented Apr 21, 2020

@praetorianer777 thanks for asking about this on the Numba issue tracker. I am not sure exactly which version of Numba you are using, but the last version of Numba to support Python 2.7 was 0.47.0 which was released on 3rd of January 2020. The latest release is 0.49.0. I would suggest to update your Python version, thanks! Should this not work or if the issue appears to be elsewhere, please don't hesitate to re-open this issue.

@esc esc closed this as completed Apr 21, 2020
@praetorianer777
Copy link
Author

Hello, thanks for your fast reply!
The problem is, I can't upgrade my python.
Currently I am writing on my master thesis, where I have to use some modules of my company. These are ROS (melodic) nodes, which only support Python 2.7.
Maybe some more system information are helpful:

Python 2.7.17
LLVM 8
Ubuntu 18.04
All in a virtual machine (VirtualBox).

I also tried different versions of numba (0.45/45/47).
In all versions the same error occured.

@esc
Copy link
Member

esc commented Apr 21, 2020

@praetorianer777 thanks for adding additional information to the update. IIRC Numba 0.47.0 and llvmlite 0.31.0 are the last versions to support Python 2.7. My suggestion would be to setup a fresh virtual environment (or whatever you are using) and then install the two versions listed above. Another alternative is to use a version of Miniconda that still supports Python 2.7 and try to get Numba, llvmlite and your packages installed there. Good luck and please do let us know how it goes!

@esc esc reopened this Apr 21, 2020
@praetorianer777
Copy link
Author

Ah thank you very much, now it seems to work!

@esc
Copy link
Member

esc commented Apr 21, 2020

@praetorianer777 great! Thanks for reporting back.

@esc esc closed this as completed Apr 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no action required No action was needed to resolve.
Projects
None yet
Development

No branches or pull requests

2 participants