Zulip Chat Archive

Stream: new members

Topic: Need Help


Adith Raghav (Mar 18 2025 at 04:37):

I'm really new to this (started today), so forgive me if this a really trivial issue. I am installing Lean on Gitpod, and I need to install Mathlib, but I'm not able to.

For example, I have this test.lean:

import Mathlib.Analysis.SpecialFunctions.Trigonometric
#check sin  -- Should return: ℝ → ℝ

But I get the error:

test.lean:1:0: error: unknown module prefix 'Mathlib'

No directory 'Mathlib' or file 'Mathlib.olean' in the search path entries:
/home/gitpod/.elan/toolchains/leanprover--lean4---v4.17.0/lib/lean

whenever I run lean test.lean

My lakefile.toml:

name = "my_lean_project"
version = "0.1.0"
defaultTargets = ["my_lean_project"]

[[lean_lib]]
name = "MyLeanProject"

[[lean_exe]]
name = "my_lean_project"
root = "Main"

[package]
name = "my_lean_project"
version = "1.0"
lean_version = "leanprover/lean4:stable"

[dependencies]
mathlib = { git = "https://github.com/leanprover-community/mathlib4" }

(I added the [package] and [dependencies] section following ChatGPT's ramblings).
What do I do? I asked ChatGPT for help and it didn't help at all, I keep getting this same error.

Adith Raghav (Mar 18 2025 at 04:41):

I'm really new to this (started today), so forgive me if this a really trivial issue. I am installing Lean on Gitpod, and I need to install Mathlib, but I'm not able to.

For example, I have this test.lean:

import Mathlib.Analysis.SpecialFunctions.Trigonometric
#check sin  -- Should return: ℝ → ℝ

But I get the error:

test.lean:1:0: error: unknown module prefix 'Mathlib'

No directory 'Mathlib' or file 'Mathlib.olean' in the search path entries:
/home/gitpod/.elan/toolchains/leanprover--lean4---v4.17.0/lib/lean

whenever I run lean test.lean

My lakefile.toml:

name = "my_lean_project"
version = "0.1.0"
defaultTargets = ["my_lean_project"]

[[lean_lib]]
name = "MyLeanProject"

[[lean_exe]]
name = "my_lean_project"
root = "Main"

[package]
name = "my_lean_project"
version = "1.0"
lean_version = "leanprover/lean4:stable"

[dependencies]
mathlib = { git = "https://github.com/leanprover-community/mathlib4" }

(I added the [package] and [dependencies] section following ChatGPT's ramblings).
What do I do? I asked ChatGPT for help and it didn't help at all, I keep getting this same error.

Johan Commelin (Mar 18 2025 at 04:47):

I would expect something like

[[require]]
name = "mathlib"
git = "https://github.com/leanprover-community/mathlib4.git"

Johan Commelin (Mar 18 2025 at 04:47):

You'll have to run lake update after changing the toml file.

Johan Commelin (Mar 18 2025 at 04:48):

I also don't think you need the package section.

Notification Bot (Mar 18 2025 at 05:12):

This topic was moved here from #general > Need Help by Johan Commelin.

Notification Bot (Mar 18 2025 at 05:12):

A message was moved here from #mathlib4 > Need Help by Johan Commelin.

Johan Commelin (Mar 18 2025 at 05:13):

@Adith Raghav Please don't cross post. But if you absolutely need to, then please cross link.


Last updated: May 02 2025 at 03:31 UTC