is this a good answer? visual studio code - How to tell vscode where Coq is? (fixing Could not start coqtop (coqtop)) - Stack Overflow
Ok I fixed it I think. This is what I did:
- create a new switch e.g.
opam switch create hammer_switch ocaml-base-compiler.4.12.0
and made sure I had xcode & hombrew/brew. (note you can have opam
managed in coda in linux/ubuntu it seems)
- I installed the coq plataform using their binaries platform/README_macOS.md at main · coq/platform · GitHub and ran
bash coq_platform_make.sh
updated my path with $(opam env)
(Q: not with eval $(opam env)
? weird…)
- made sure coqtop path in the vscode settings had the path from my PATH e.g.
/Users/brandomiranda/.opam/__coq-platform.2022.01.0~8.15~beta1/bin
or do echo $PATH
copy the coq part into vscode’s setting. Note that your switch might not have the word coq in it but it istall has it installed so for me I copied /Users/brandomiranda/.opam/4.12.1/bin
and that worked too. More details in extra bellow.
- restarted vscode several times to make sure it was running the above path.
see: How to have vscode find coq? - #2 by Blaisorblade
for the cotop vscode see
related but when installing new plugin: Installation issues -- No package named coq-hammer-tactics found · Issue #122 · lukaszcz/coqhammer · GitHub
vscode gitissue: How to set the coq path for vscode (how to find coqtop)? · Issue #243 · coq-community/vscoq · GitHub
–
Other way to install Coq not using the official plataform scripts (might be easier to set up HPC machines with coq?)
Seems you can install coq this way too:
# - install opam
# brew install opam # for mac
conda install -c conda-forge opam
opam init
# if doing local env? https://stackoverflow.com/questions/72522412/what-does-eval-opam-env-do-does-it-activate-a-opam-environment
# eval $(opam env)
# - install coq
# local install
#opam switch create . 4.12.1
#eval $(opam env)
#opam repo add coq-released https://coq.inria.fr/opam/released
#opam install coq
# If you want a single global (wrt conda) coq installation (for say your laptop):
opam switch create 4.12.1
opam switch 4.12.1
# eval $(opam env) # why don't I need this in the global, what makes this global?
opam repo add coq-released https://coq.inria.fr/opam/released
opam install coq
though I need to figure out where eval $(opam env)
goes.
Extra: discussion on path names to put in vscode
My path looked as follows:
(iit_synthesis) brandomiranda~ ❯ echo $PATH
/Users/brandomiranda/.opam/4.12.1/bin:/Users/brandomiranda/miniconda/envs/iit_synthesis/bin:/Users/brandomiranda/miniconda/condabin:/usr/local/bin:/Users/brandomiranda/.opam/4.12.1/bin:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin
but I was already on the switch 4.12.1
already and installed coq in it because I ran:
# - install opam
brew install opam
# https://stackoverflow.com/questions/72522266/how-does-one-install-opam-with-conda-for-mac-apple-os-x
# conda install -c conda-forge opam
opam init
# if doing local env? https://stackoverflow.com/questions/72522412/what-does-eval-opam-env-do-does-it-activate-a-opam-environment
#eval $(opam env)
# - install coq
# local install
#opam switch create . 4.12.1
#eval $(opam env)
#opam repo add coq-released https://coq.inria.fr/opam/released
#opam install coq
# If you want a single global (wrt conda) coq installation (for say your laptop):
opam switch create 4.12.1
opam switch 4.12.1
eval $(opam env)
opam repo add coq-released https://coq.inria.fr/opam/released
opam install coq
In that state I test coq in terminal and it was there:
(iit_synthesis) brandomiranda~ ❯ opam switch
# switch compiler description
→ 4.12.1 ocaml-base-compiler.4.12.1 4.12.1
__coq-platform.2022.01.0~8.14~2022.01 ocaml-base-compiler.4.10.2 __coq-platform.2022.01.0~8.14~2022.01
(iit_synthesis) brandomiranda~ ❯ coqtop
Welcome to Coq 8.15.1
Coq < ^C
Error: User interrupt.
Coq < ^D
and the switch __coq-platform.2022.01.0~8.14~2022.01 ocaml-base-compiler.4.10.2 __coq-platform.2022.01.0~8.14~2022.01
must have been set up at a different time when I did plataform install but now I’m ignoring it and I’m not in that switch so I don’t think it will matter much.