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

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

Related

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

Is there easy way to include xlnt to Visual Studio Code on Ubuntu?

I want to use xlnt library to edit xlsx data but i don't know how to input this to global libraries of VSC. Could you please tell me step by step how install this library?
https://github.com/tfussell/xlnt
You need some packages firstly:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install cmake
sudo apt-get install zlibc
The following steps update the compiler and set the appropriate environment variables:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt-get upgrade
sudo apt-get install gcc-6 g++-6
export CC=/usr/bin/gcc-6
export CXX=/usr/bin/g++-6
The following steps will intall xlnt Download the zip file from the xlnt repository:
cd ~
unzip Downloads/xlnt-master.zip
cd xlnt-master
cmake .
make -j 2
sudo make install
The following step will map the shared library names to the location of the corresponding shared library files:
sudo ldconfig
xlnt will now be ready to use on your Ubuntu instance.
source

How to install python-mysqldb for Python 2.7 in Ubuntu 20.04 (Focal Fossa)?

I've tried "apt-get install python-mysqldb" which results in:
root#ps1svr:~# apt-get install python-mysqldb
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python-mysqldb is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'python-mysqldb' has no installation candidate
Note: "apt-get install python3-mysqldb" works, however I have a lot of code written for Python 2.x which no longer runs, and this is causing enough problems that I'm probably going to have to reinstall Ubuntu 18.04
Also you can just add the Ubuntu 18.04 repositoery to install the python-mysqldb package:
sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu bionic main'
sudo apt update
sudo apt install -y python-mysqldb
This will download, build and install it for all users, using pip
sudo apt install libmysqlclient-dev python2.7-dev
wget https://bootstrap.pypa.io/get-pip.py
sudo python2.7 get-pip.py
sudo wget https://raw.githubusercontent.com/paulfitz/mysql-connector-c/master/include/my_config.h -O /usr/include/mysql/my_config.h
sudo pip2 install MySQL-python
Answer found from MySQLdb install error - _mysql.c:44:23: error: my_config.h: No such file or directory

Uninstall OpenCV 3.0.0 from Ubuntu14.04

I want to use surffeature with opencv3.0.0 on Ubuntu, but I didn't install opencv_contrib at first. When I tried to install opencv_contrib, it failed. So I intend to uninstall opencv3.0.0, and reinstall it with opencv_contrib. I just delete the build file which was built during the installing opencv3.0.0. Then I type :
make uninstall
in terminal. It failed again, the error information is :
CMake Error at cmake_uninstall.cmake:20 (MESSAGE): Problem when
removing "/usr/local/include/opencv2/cvconfig.h"
I found I should type :
make uninstall
instead of remove build file, but it's already done.
I installed opencv3.0.0 with the following instruction
sudo apt-get install build-essential
sudo apt-get install git libgtk2.0-dev libavcodec-dev libavformat-dev libtiff4-dev libswscale-dev libjasper-dev
sudo apt-get install pkg-config
cmake .
mkdir build
cd build
cmake -D WITH_IPP=OFF ..
make ..
sudo make install
cd /etc/ld.so.conf.d
sudo /bin/bash -c 'echo "/usr/local/lib" /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig -v
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
What should I do now ?
You have to use sudo, as the file belongs to the system and you don't have access to it by default.
Try:
sudo make uninstall
It worked for me.
I delete all the opencv files, including source file and installed file under /usr/local, finally re-install opencv

Uninstall boost and install another version

I've installed the boost libraries on Linux Mint 12 using the command sudo apt-get install libboost-dev libboost-doc, which installs the default version available in the repositories. However, the project I have to do needs the 1.44 version of boost. How do I uninstall the default (current) version 1.46 and install 1.44?
I couldn't find the documentation on the boost website to install boost from the .tar.gz package.
Boost can installed by two ways
Deb package
wget and install manually
In some case we might have installed by both type which can cause version error. Lets see how to uninstall both.
sudo apt-get update
# to uninstall deb version
sudo apt-get -y --purge remove libboost-all-dev libboost-doc libboost-dev
# to uninstall the version which we installed from source
sudo rm -f /usr/lib/libboost_*
Then we need to install other dependencies if they are not met
sudo apt-get -y install build-essential g++ python-dev autotools-dev libicu-dev libbz2-dev
Lets download the boost version which we need from the link. I am downloading the 1.54 version. Then untar and install it.
# go to home folder
cd
wget http://downloads.sourceforge.net/project/boost/boost/1.54.0/boost_1_54_0.tar.gz
tar -zxvf boost_1_54_0.tar.gz
cd boost_1_54_0
# get the no of cpucores to make faster
cpuCores=`cat /proc/cpuinfo | grep "cpu cores" | uniq | awk '{print $NF}'`
echo "Available CPU cores: "$cpuCores
./bootstrap.sh # this will generate ./b2
sudo ./b2 --with=all -j $cpuCores install
Now let's check the installed version
cat /usr/local/include/boost/version.hpp | grep "BOOST_LIB_VERSION"
You will see something like below
// BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION
#define BOOST_LIB_VERSION "1_54"
Version 1.54 of boost is installed
That's it, it worked for me. Let me know if you face any issues.
You can uninstall with
apt-get --purge remove libboost-dev libboost-doc
Download the package you need from boost website, extract and follow "getting started" instructions found inside index.html in the extracted directory.
Tested working Ubuntu 20.04 Use my script to uninstall your older version of boost in ubuntu 20.04 and follow rams instructions above
#!/bin/bash
sudo apt-get -y --purge remove libboost-all-dev libboost-doc libboost-dev
echo "clear boost dir"
sudo rm -r /usr/local/lib/libboost*
sudo rm -r /usr/local/include/boost
sudo rm -r /usr/local/lib/cmake/*
sudo rm -f /usr/lib/libboost_*
sudo rm -r /usr/include/boost
Downgrade your boost version. I'm not familiar with Mint, but assuming it is deb-based, you can do:
apt-cache show libboost-dev
to see all installable version and install a specific version with
sudo apt-get install libboost-dev=1.42.0.1
There are also convenience packages for the major boost versions:
sudo apt-get install libboost1.44-dev
As #savamane wrote you can uninstall it with
apt-get --purge remove libboost-dev libboost-doc
Another suggestion to install the .deb packages as suggested here. (Download the one fitted for your architecture though).
For still supported distros, you can simply search for the package at the distributions at http://packages.ubuntu.com/. For example libboost-system1.46.1 can be found in under the precise -> Libraries tab.
For unsupported distros, there is still a chance to find them at
http://archive.ubuntu.com/. For example can libboost-all-dev_1.40.0.1_amd64.deb be found in
http://archive.ubuntu.com/ubuntu/pool/universe/b/boost-defaults/.
This is how you install a specific Boost version:
cd boost_1_54_0/
./bootstrap.sh --with-libraries=atomic,date_time,exception,filesystem,iostreams,locale,program_options,regex,signals,system,test,thread,timer,log
sudo ./b2 install