Zulip Chat Archive
Stream: lean4
Topic: unknown package Mathlib
Ashvni Narayanan (Jul 07 2022 at 17:50):
@Matej Penciak and I have been trying to use Mathlibport to view Mathlib 3 files in Lean 4. However, we get the error : unknown package Mathlib
.
On importing Mathbin files, I get the error :
object file '.\lean_packages\mathlib\.\build\lib\Mathlib.olean' of module Mathlib does not exist
Can this be resolved?
Any help is appreciated, thank you!
Mac (Jul 07 2022 at 18:37):
What version of Lean are you on?
Ashvni Narayanan (Jul 07 2022 at 18:38):
Lean (version 4.0.0-nightly-2022-06-13, commit fb574af873d7, Release)
Mac (Jul 07 2022 at 18:42):
Ah, okay, yeah that does appear to be the correct version. What does your Lakefile look like?
Ashvni Narayanan (Jul 07 2022 at 18:50):
import Lake
open Lake DSL
package ZkSNARK
require mathlib3port from git
"https://github.com/leanprover-community/mathlib3port.git"
Alexander Bentkamp (Jul 07 2022 at 18:53):
I also get this error sometimes. My workaround/hack is the following:
cd lean_packages/mathlib
lake build
You might have to do the same in the other subdirectories of lean_packages.
Ashvni Narayanan (Jul 07 2022 at 18:56):
I get a build failed
error
Ashvni Narayanan (Jul 07 2022 at 19:06):
I rebuilt it and it seems to be working now! Thank you!
Alexander Bentkamp (Jul 07 2022 at 19:08):
Would still be good to know from @Mac if there is a better solution or what might be causing this :-)
Mac (Jul 07 2022 at 19:11):
How are you importing Mathbin?
Mac (Jul 07 2022 at 19:14):
If you are doing something other than import Mathbin
, mathlib will not get built (as only the top-level Mathbin
explicitly imports Mathlib). Otherwise, if you are doing an import Mathbin.*
(importing just some submodule), you need to also import Mathlib
to ensure Mathlib gets built.
Ashvni Narayanan (Jul 07 2022 at 19:18):
I see (although currently the file seems to work without a Mathlib import)
Mac (Jul 07 2022 at 19:19):
@Ashvni Narayanan Well you just manually built Mathlib, so that's why. :wink: (That's what @Alexander Bentkamp had you do.)
Ashvni Narayanan (Jul 07 2022 at 19:20):
Ah right, sorry about that
Mac (Jul 07 2022 at 19:24):
'tis fine :big_smile:
Alexander Bentkamp (Jul 07 2022 at 19:24):
Thanks, I have been doing this wrong for 6 months or so :-)
Alexander Bentkamp (Jul 07 2022 at 19:26):
cc @Ramon Fernandez Mir
Last updated: Dec 20 2023 at 11:08 UTC