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.

Can't run optimize benchmarks

See original GitHub issue

@mdhaber trying to run the global benchmarks to test solutions for #11438. However, I can’t actually start the benchmarks off:

$ export SCIPY_XSLOW=1
$ export SCIPY_GLOBAL_BENCH=AMGM
$ python runtests.py --bench optimize.BenchGlobal

gives

   STDOUT -------->
   
   STDERR -------->
   Traceback (most recent call last):
     File "/Users/anz/miniconda3/envs/dev3/lib/python3.7/site-packages/asv/benchmark.py", line 1315, in <module>
       main()
     File "/Users/anz/miniconda3/envs/dev3/lib/python3.7/site-packages/asv/benchmark.py", line 1308, in main
       commands[mode](args)
     File "/Users/anz/miniconda3/envs/dev3/lib/python3.7/site-packages/asv/benchmark.py", line 1004, in main_discover
       list_benchmarks(benchmark_dir, fp)
     File "/Users/anz/miniconda3/envs/dev3/lib/python3.7/site-packages/asv/benchmark.py", line 989, in list_benchmarks
       for benchmark in disc_benchmarks(root):
     File "/Users/anz/miniconda3/envs/dev3/lib/python3.7/site-packages/asv/benchmark.py", line 887, in disc_benchmarks
       for module in disc_modules(root_name, ignore_import_errors=ignore_import_errors):
     File "/Users/anz/miniconda3/envs/dev3/lib/python3.7/site-packages/asv/benchmark.py", line 869, in disc_modules
       for item in disc_modules(name, ignore_import_errors=ignore_import_errors):
     File "/Users/anz/miniconda3/envs/dev3/lib/python3.7/site-packages/asv/benchmark.py", line 857, in disc_modules
       module = import_module(module_name)
     File "/Users/anz/miniconda3/envs/dev3/lib/python3.7/importlib/__init__.py", line 127, in import_module
       return _bootstrap._gcd_import(name[level:], package, level)
     File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
     File "<frozen importlib._bootstrap>", line 983, in _find_and_load
     File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
     File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
     File "<frozen importlib._bootstrap_external>", line 728, in exec_module
     File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
     File "/Users/anz/Documents/Andy/programming/scipy/benchmarks/benchmarks/optimize_linprog.py", line 24, in <module>
       slow = int(os.environ.get('SCIPY_XSLOW', 0))
   NameError: name 'os' is not defined

I tried fixing that one by importing os outside the try:except block then came to:

STDOUT -------->
   
   STDERR -------->
   Traceback (most recent call last):
     File "/Users/anz/miniconda3/envs/dev3/lib/python3.7/site-packages/asv/benchmark.py", line 1315, in <module>
       main()
     File "/Users/anz/miniconda3/envs/dev3/lib/python3.7/site-packages/asv/benchmark.py", line 1308, in main
       commands[mode](args)
     File "/Users/anz/miniconda3/envs/dev3/lib/python3.7/site-packages/asv/benchmark.py", line 1004, in main_discover
       list_benchmarks(benchmark_dir, fp)
     File "/Users/anz/miniconda3/envs/dev3/lib/python3.7/site-packages/asv/benchmark.py", line 989, in list_benchmarks
       for benchmark in disc_benchmarks(root):
     File "/Users/anz/miniconda3/envs/dev3/lib/python3.7/site-packages/asv/benchmark.py", line 887, in disc_benchmarks
       for module in disc_modules(root_name, ignore_import_errors=ignore_import_errors):
     File "/Users/anz/miniconda3/envs/dev3/lib/python3.7/site-packages/asv/benchmark.py", line 869, in disc_modules
       for item in disc_modules(name, ignore_import_errors=ignore_import_errors):
     File "/Users/anz/miniconda3/envs/dev3/lib/python3.7/site-packages/asv/benchmark.py", line 857, in disc_modules
       module = import_module(module_name)
     File "/Users/anz/miniconda3/envs/dev3/lib/python3.7/importlib/__init__.py", line 127, in import_module
       return _bootstrap._gcd_import(name[level:], package, level)
     File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
     File "<frozen importlib._bootstrap>", line 983, in _find_and_load
     File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
     File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
     File "<frozen importlib._bootstrap_external>", line 728, in exec_module
     File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
     File "/Users/anz/Documents/Andy/programming/scipy/benchmarks/benchmarks/optimize_linprog.py", line 33, in <module>
       rr_methods = [_remove_redundancy, _remove_redundancy_dense,
   NameError: name '_remove_redundancy' is not defined

At this point I stopped.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
andyfaffcommented, Jan 31, 2020

If running the benchmarks means pytest is going to be imported, then perhaps we need to install it for running the benchmarks (https://github.com/scipy/scipy/blob/master/benchmarks/asv.conf.json#L35)

1reaction
andyfaffcommented, Jan 31, 2020

Having the os + numpy imports inside the try/except block doesn’t make a lot of sense anyway. os will be there, and it’s a pretty good bet that numpy will be installed.

The solution isn’t to reintroduce the try/except block in its original form. This is because if any of the imports fails then we’ll get the NameError: name '_remove_redundancy' is not defined error. When an import can fail it’s not good if there’s then variables declared outside of functions:

rr_methods = [_remove_redundancy, _remove_redundancy_dense,
              _remove_redundancy_sparse]

which rely on one or more of the imports that didn’t get picked up.

Read more comments on GitHub >

github_iconTop Results From Across the Web

5 Ways to Fix Windows 10 Defrag Optimization Not Available
Method 4. Run Disk Defragmenter in Safe Mode ... If you can't optimize system reserved using the tool in File Explorer, you can...
Read more >
When I try to "Optimize Drives", I get "Optimization not
I am currently running Windows 8 Pro. I can't seem to optimize my SSD. I have read online that I should be able...
Read more >
How To OPTIMIZE Your CPU/Processor For Gaming ...
Your browser can't play this video. Learn more. Switch camera ... Intro (Benefits of Optimizing CPU and Benchmarks ). •. Scroll for details....
Read more >
How the Optimize runtime works - Google Help
The Optimize container will download in parallel with other scripts and resources of your page and will not block them: other scripts that...
Read more >
mysql - Run OPTIMIZE TABLE to defragment tables for better ...
Performance is not the reason to use OPTIMIZE TABLE. The error message about "Table does not support optimize" is because it doesn't do...
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