Skip to content

Conversation

@skmendez
Copy link

Avoid calling numexpr.set_num_threads() with a value exceeding NUMEXPR_MAX_THREADS to prevent numexpr from printing a warning to stderr during blosc2 import. Without this, I get the following error log from numexpr:

$ NUMEXPR_MAX_THREADS=16 python -c 'import blosc2; blosc2.__version__'
Error.  nthreads cannot be larger than environment variable "NUMEXPR_MAX_THREADS" (16)%

Avoid calling numexpr.set_num_threads() with a value exceeding
NUMEXPR_MAX_THREADS to prevent numexpr from printing a warning
to stderr during blosc2 import.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@skmendez skmendez marked this pull request as ready for review January 26, 2026 19:17
@FrancescAlted
Copy link
Member

Thanks @skmendez . I am wondering if this patch would be better suited in numexpr package itself. Thoughts?

@skmendez
Copy link
Author

I think it makes sense to warn if you attempt to set the number of threads to a value greater than NUMEXPR_MAX_THREADS (though I will say the error message not being new line terminated is pretty rough). My only wish is that numexpr exposed the "max threads" through a function instead of needing to query an env variable, but oh well :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants