herbie-fp / herbie

Optimize floating-point expressions for accuracy
https://herbie.uwplse.org
Other
766 stars 32 forks source link

Herbie shell broken in Docker image #402

Closed ruricolist closed 1 year ago

ruricolist commented 3 years ago

Starting a Herbie shell from a freshly built Docker image, trying to evaluate (FPCore (x) (- (+ 1 (sqrt x)) (sqrt x))) results in:

standard-module-name-resolver: collection not found
  for module path: egg-herbie
  collection: "egg-herbie"
  in collection directories:
   /root/.local/share/racket/8.2/collects
   /usr/share/racket/collects/
   ... [115 additional linked and package directories]
  context...:
   /src/herbie/core/simplify.rkt:128:0
   /src/herbie/core/simplify.rkt:71:0
   /src/herbie/symmetry.rkt:6:0: get-swaps
   /src/herbie/symmetry.rkt:17:0: connected-components
   /src/herbie/mainloop.rkt:83:0: setup-prog!
   /src/herbie/mainloop.rkt:592:0: run-improve
   /src/herbie/sandbox.rkt:66:6
   /usr/share/racket/collects/racket/engine.rkt:42:24
pavpanchekha commented 3 years ago

Hi @ruricolist ! I'm on vacation right now, but I'll look at this next week when I'm back. It's definitely something we need to fix with the Docker image.

bleachpuppy commented 3 years ago

I have a similar issue after installing via Racket on Windows. (No Docker).

I ran herbie shell and tried (FPCore (x) :name "Cancel like terms" (- (+ 1 x) x)) and I get the following error:

standard-module-name-resolver: collection not found
for module path: egg-herbie
collection: "egg-herbie"
in collection directories:
 C:\Users\myusername\AppData\Roaming\Racket\8.1\collects
 c:\Program Files\Racket\collects\
 ... [170 additional linked and package directories]
context...:
 C:\Users\myusername\AppData\Roaming\Racket\8.1\pkgs\herbie\core\simplify.rkt:125:0
 C:\Users\myusername\AppData\Roaming\Racket\8.1\pkgs\herbie\core\simplify.rkt:68:0
 C:\Users\myusername\AppData\Roaming\Racket\8.1\pkgs\herbie\symmetry.rkt:6:0: get-swaps
 C:\Users\myusername\AppData\Roaming\Racket\8.1\pkgs\herbie\symmetry.rkt:17:0: connected-components
 C:\Users\myusername\AppData\Roaming\Racket\8.1\pkgs\herbie\mainloop.rkt:64:0: setup-prog!
 C:\Users\myusername\AppData\Roaming\Racket\8.1\pkgs\herbie\mainloop.rkt:503:0: run-improve
 C:\Users\myusername\AppData\Roaming\Racket\8.1\pkgs\herbie\sandbox.rkt:62:6
 c:\Program Files\Racket\collects\racket\engine.rkt:42:24

The web interface gives a similar error.

I don't know anything about racket, but I can confirm that these directories exist:

  C:\Program Files\Racket\collects\
  C:\Users\myusername\AppData\Roaming\Racket\8.1\pkgs\egg-herbie\

But this does not:

  C:\Users\myusername\AppData\Roaming\Racket\8.1\collects\
pavpanchekha commented 3 years ago

We think we fixed it—could you try again?

bleachpuppy commented 3 years ago

It works for me!

I don't know about docker, but I just reinstalled from racket:

raco pkg remove --auto herbie
raco pkg install --auto --no-cache herbie

and that solved it. Thanks!

bleachpuppy commented 3 years ago

Actually I spoke too soon. Double precision works, but single precision gives an error:

herbie shell --seed 250588570 
(FPCore (x)
  :name "sqrt(x+1)-sqrt(x)"
  :precision binary32
  (- (sqrt (+ x 1.0)) (sqrt x)))

match: no matching clause for # 
<syntax:C:\Users\myusername\AppData\Roaming\Racket\8.1\pkgs\herbie\syntax\syntax.rkt:339:118 float> L   C
fallback    C:\Users\myusername\AppData\Roaming\Racket\8.1\pkgs\herbie\syntax\syntax.rkt    328 11
(unnamed)   C:\Users\myusername\AppData\Roaming\Racket\8.1\pkgs\herbie\syntax\syntax.rkt    344 17
(unnamed)   C:\Users\myusername\AppData\Roaming\Racket\8.1\pkgs\herbie\programs.rkt 199 2
(unnamed)   C:\Users\myusername\AppData\Roaming\Racket\8.1\pkgs\herbie\points.rkt   181 4
batch-errors    C:\Users\myusername\AppData\Roaming\Racket\8.1\pkgs\herbie\points.rkt   178 0
atab-add-altns  C:\Users\myusername\AppData\Roaming\Racket\8.1\pkgs\herbie\core\alt-table.rkt   231 0
(unnamed)   c:\Program Files\Racket\collects\racket\contract\private\arrow-val-first.rkt    486 18
gen-rewrites!   C:\Users\myusername\AppData\Roaming\Racket\8.1\pkgs\herbie\mainloop.rkt 284 0
run-iter!   C:\Users\myusername\AppData\Roaming\Racket\8.1\pkgs\herbie\mainloop.rkt 472 0
run-improve C:\Users\myusername\AppData\Roaming\Racket\8.1\pkgs\herbie\mainloop.rkt 503 0
(unnamed)   C:\Users\myusername\AppData\Roaming\Racket\8.1\pkgs\herbie\sandbox.rkt  62  6
(unnamed)   c:\Program Files\Racket\collects\racket\engine.rkt  42  24
pavpanchekha commented 3 years ago

My guess is that this is fixed in master. Closing but feel free to reopen.

adamsmasher commented 2 years ago

Hi - I had this issue doing on macOS (arm64) doing a fresh install, doing a user-level install. I installed Racket 8.1, ran:

% /Applications/Racket\ v8.1/bin/raco pkg install --auto herbie

And proceeded to run:

% ./Library/Racket/8.1/bin/herbie web

Every expression I enter gives me an egg-herbie error. Here's the output:

herbie shell --seed 1763676883 
(FPCore (x)
  :name "sqrt(x + 1) - sqrt(x)"
  :precision binary64
  (- (sqrt (+ x 1.0)) (sqrt x)))
standard-module-name-resolver: collection not found for module path: egg-herbie collection: "egg-herbie" in collection directories: /Users/adam/Library/Racket/8.1/collects /Applications/Racket v8.1/collects/ ... [168 additional linked and package directories] L   C
(unnamed)   /Users/adam/Library/Racket/8.1/pkgs/herbie/core/simplify.rkt    125 0
(unnamed)   /Users/adam/Library/Racket/8.1/pkgs/herbie/core/simplify.rkt    68  0
get-swaps   /Users/adam/Library/Racket/8.1/pkgs/herbie/symmetry.rkt 6   0
connected-components    /Users/adam/Library/Racket/8.1/pkgs/herbie/symmetry.rkt 17  0
setup-prog! /Users/adam/Library/Racket/8.1/pkgs/herbie/mainloop.rkt 64  0
run-improve /Users/adam/Library/Racket/8.1/pkgs/herbie/mainloop.rkt 503 0
(unnamed)   /Users/adam/Library/Racket/8.1/pkgs/herbie/sandbox.rkt  62  6
(unnamed)   /Applications/Racket v8.1/collects/racket/engine.rkt    42  24
pavpanchekha commented 2 years ago

In teresting. @ruricolist, what happens when you do:

raco pkg install --auto egg-herbie

I'm wondering if this has something to do with using an ARM Mac.