How to install the coq 8.14 (or 8.15) package with opam pin when it says it can't find it? - ocaml

I am on ubuntu. I'm trying to install coq 8.14. I'm sure it must exist. Why doesn't it let me install it? Commands and error msg:
(iit_synthesis) brando9~/proverbot9001 $ opam switch create coq-8.14 4.07.1
<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Switch invariant: ["ocaml-base-compiler" {= "4.07.1"} | "ocaml-system" {= "4.07.1"}]
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
∗ installed base-bigarray.base
∗ installed base-threads.base
∗ installed base-unix.base
⬇ retrieved ocaml-base-compiler.4.07.1 (cached)
∗ installed ocaml-base-compiler.4.07.1
∗ installed ocaml-config.1
∗ installed ocaml.4.07.1
Done.
# Run eval $(opam env --switch=coq-8.14) to update the current shell environment
(iit_synthesis) brando9~/proverbot9001 $ eval $(opam env --switch=coq-8.14 --set-switch)
err:
(iit_synthesis) brando9~/proverbot9001 $ opam pin add -y coq 8.14
[ERROR] Package coq has no known version 8.14 in the repositories
Similar issue:
(iit_synthesis) brando9~/proverbot9001 $ opam switch create coq-8.15 4.07.1
<><> Installing new switch packages <><><><><><><><><><><><><><><><><><><><><><>
Switch invariant: ["ocaml-base-compiler" {= "4.07.1"} | "ocaml-system" {= "4.07.1"}]
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
∗ installed base-bigarray.base
∗ installed base-threads.base
∗ installed base-unix.base
⬇ retrieved ocaml-base-compiler.4.07.1 (cached)
∗ installed ocaml-base-compiler.4.07.1
∗ installed ocaml-config.1
∗ installed ocaml.4.07.1
Done.
# Run eval $(opam env --switch=coq-8.15) to update the current shell environment
(iit_synthesis) brando9~/proverbot9001 $ eval $(opam env --switch=coq-8.15 --set-switch)
(iit_synthesis) brando9~/proverbot9001 $ opam pin add -y coq 8.15
[ERROR] Package coq has no known version 8.15 in the repositories
cross: https://coq.discourse.group/t/how-to-install-the-coq-8-14-package-with-opam-pin-when-it-says-it-cant-find-it/1851

The version you're trying to install is 8.14.0, not 8.14. If you add the .0 it will work as you want
You can check versions here

Related

How do I install ocamlfind first properly before other opam packages without root permissions?

I was trying to install some coq packages with opam but have this hack:
# coq-equations seems to rely on ocamlfind for it's build, but doesn't
# list it as a dependency, so opam sometimes tries to install
# coq-equations before ocamlfind. Splitting this into a separate
# install call prevents that.
opam install -y coq-equations coq-metacoq coq-metacoq-checker coq-metacoq-template
I don't have root permisions so doing:
sudo apt-get install ocaml-findlib
doesn't work. How do I instal ocamlfind? Ideally the proper way with a package manager if possible?
You can install ocamlfind independently in a first step
$ opam install ocamlfind
then install the packages that forgot their dependencies on ocamlfind:
$ opam install -y coq-equations coq-metacoq coq-metacoq-checker coq-metacoq-template

How does one use the official way to install opam without user interaction?

I want to install opam without typing anything into my terminal. Currently this is what I'm needing to do:
# - Official install for Opam ref: https://opam.ocaml.org/doc/Install.html
mkdir -p ~/.local/bin/
# This will simply check your architecture, download and install the proper pre-compiled binary, backup your opam data if from an older version, and run opam init.
bash -c "sh <(curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)"
# type manually into terminal, previous script is interactive (sorry! but it's better to use the official way to install opam to avoid issues)
~/.local/bin
# type Y manually if it looks right (note above does NOT end with a forwardslash /
Y
# - check if it worked
opam --version
#opam init --disable-sandboxing
#opam update --all
#eval $(opam env)
# - not officially supported by opam
# - opam with conda
# maybe later, not needed I think...
# conda install -c conda-forge opam
# gave me an error in snap
# - as sudo opam
#add-apt-repository ppa:avsm/ppa
#apt update
#apt install opam
#eval $(opam env)
seems to work. Is there a way to do above without user interaction?
Note: I don't have sudo priveledges in the hpc I'm using. IT managers told me to install it myself.
related: How does one install opam without sudo priveledges on linux/ubuntu?
You can just download the installation script and pick whatever parts you want into your installation script.
For example, if you're using docker you can install opam using the following lines,
ARG TARGETARCH_OPAM=x86_64
ARG TARGETPLATFORM=linux
ARG OPAM_VERSION=2.1.4
ARG OPAM_BASE_URL=https://github.com/ocaml/opam/releases/download/${OPAM_VERSION}
ARG OPAM_BIN="opam-${OPAM_VERSION}-${TARGETARCH_OPAM}-${TARGETPLATFORM}"
ARG OPAM_URL=${OPAM_BASE_URL}/${OPAM_BIN}
ARG OPAM_DST=/usr/local/bin/opam
# See https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh
ARG OPAM_HASH=fed3baa20bed1215a8443db43dd0aa99fe2452f068f9939aa31ef9763c093c972f3d731c9cf3ad81b3d161ba756548a77800894482abcf12d9e76ed61614148b
# install the opam binary
RUN set -x \
&& curl -sS -L -o ${OPAM_DST} ${OPAM_URL} \
&& chmod +x ${OPAM_DST} \
&& echo "${OPAM_HASH} ${OPAM_DST}" | sha512sum --check \
&& opam --version
But if you don't want to be very fancy, and trust your network, you can just install the latest version of opam from github. E.g., the following will download and install it to your ~/.local/bin as it looks like what you want,
curl -sS -L -o ~/.local/bin/opam \
https://github.com/ocaml/opam/releases/download/2.1.4/opam-2.1.4-x86_64-linux \
&& chmod +x ~/.local/bin/opam

Opam could install latest package and told 'Already up-to-date'?

I wanna use opam to install dune package whose version is 1.11.0 or higher. But it told me Already up-to-date while dune is still 1.2.1.
pasting my operations:
$ opam update
=-=- Updating package repositories =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[default] synchronized from https://opam.ocaml.org/1.2.2
And then:
$ opam upgrade dune
Already up-to-date.
But dune didn't be upgraded.. It's still 1.2.1.. How can I install higher version I wanted?
opam --version is 1.2.2
dune --version is 1.2.1
The culprit is this phrase
[default] synchronized from https://opam.ocaml.org/1.2.2
^^^^^^
The 1.2.2 version of opam is long ago deprecated and is never updated, so you can't get anything new. You shall install opam 2.0 to get access to the newest packages.

OPAM doesn't recognize the create subcommand

In following these instructions: https://ocaml.org/docs/install.html#Ubuntu-Ubuntu-19-04
when I ran
eval opam env
it responds with the message
opam: unknown command `env`.
when I run opam switch create 4.08.0 it responds
opam: Invalid switch subcommand "create"
I've just done a fresh install of the latest version of Linux Mint, installed OPAM with apt and also used it to install OCaml.
I used this:
http://opam.ocaml.org/doc/Install.html#Binary-distribution
to reinstall opam, that fixed opam. but utop is still broken.

How install ocp-indent with git bash in windows 7

I have installed git bash with this link and Ocaml with this link (click on the Installer for 64-bit OCaml 4.02.3 + OPAM button).
Then I have type opam install ocp-indent in git bash and see the result
The following actions will be performed:
- install ocamlfind 1.8.0 [required by cmdliner, base-bytes, ocp-build]
- install jbuilder 1.0+beta20 [required by result]
- install base-bytes base [required by ocp-indent]
- install result 1.3 [required by cmdliner]
- install topkg 0.9.1 [required by cmdliner]
- install cmdliner 1.0.2 [required by ocp-indent]
- install ocp-build 1.99.20-beta [required by ocp-indent]
- install ocp-indent 1.6.1
===== 8 to install =====
Do you want to continue ? [Y/n] Y
=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[jbuilder: http] Command started
[ocp-build: http] Command started
[ocp-indent: http] Command started
[result: http] Command started
[ERROR] The sources of the following couldn't be obtained, aborting:
- jbuilder.1.0+beta20
- ocp-build.1.99.20-beta
- ocp-indent.1.6.1
- result.1.3
(This might be due to outdated metadata, in this case run 'opam
update')
I want to ask you if you have link that I can add with opam repository or a workaround (without cygwin) to install ocp-indent in Windows 7.
Thanks for your reading and your answers.