question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error Profiling Code with Numba's njit decorator in Spyder

See original GitHub issue

Hi,

I’d like to profile my code - including the function below - using Spyder’s profiling tool on a Windows machine (equipped with Python 3.8).

@njit(cache  = True)
def quadratic_form(vec, mat):
       return np.dot(vec, mat @ vec)

However, when profiling the code I get the following output and error

from numba import njit from numba.core import config import llvmlite.binding as ll from .dylib import * from llvmlite.binding import ffi raise OSError(“Could not load shared object file: {}”.format(_lib_name)) OSError: Could not load shared object file: llvmlite.dll

I realised that with Version 0.49.0 Andreas Sodeur fixed a bug relating to cProfile and Numba JIT compiled functions in #4476.

Thanks for your help.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
esccommented, Feb 9, 2021

@hannahbus OK, thank you for reporting back. I am out of ideas here as to what to do so I can only guess from this point onwards. The error basically means, that the Python interpreter can not find the llvmlite.dll library so it is unlikely that #4476 will help in this case. My wild guess is that either the Windows equivalent of LD_LIBRARY_PATH (the environment variable that governs where libraries are found on Linux) is somehow incorrect in the case of profiling or that the python executable used by Spyder when profiling is different.

My suggestions for next steps are:

  • Work out what environment variable governs how shared libraries are loaded on Windows and attempt to print that during profiling and not-profiling to see if it has been modified somehow.
  • Work out which python executable is used by Spyder during profiling.
  • Run the code outside Spyder, but using cProfile, to ensure that this is indeed a Spyder issue and doesn’t happen during ‘regular’ Profiling.
  • Ask the Spyder community if this is something familiar to them and perhaps they already have a solution.

Good luck and let us know how it goes!

0reactions
gmarkallcommented, Jun 29, 2021

Closing this issue as there’s no further information to reproduce and it’s been marked stale twice.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting and tips — Numba 0.50.1 documentation
In order to debug code, it is possible to disable JIT compilation, which makes the jit decorator (and the njit decorator) act as...
Read more >
Python: How to profile code written with numba.njit() decorators
So my question would be this: What's the best way to profile code in which most functions have the njit() decorator, with a...
Read more >
Profiling with a decorator and @njit - Numba Discussion
A problem arises when one function using @njit calls another with both @njit and @t. I think this is the key: An njit...
Read more >
Performance Tips - Numba documentation - Read the Docs
A reasonably effective approach to achieving high performance code is to profile the code running with real data and use that to guide...
Read more >
1.7.2.1 Basic code profiling | GEOG 489 - E-education.psu.edu
We will again use the Spyder IDE and our basic raster code from earlier in the ... you will receive an error that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found