Installing ocaml-top on OSX - GTK issue - macos

I am trying to install ocaml-top on macOS High Sierra 10.13. I have installed homebrew (using the command given at https://brew.sh/) and done:
brew install opam
opam init
and answered Y to "Do you want Opam to modify ~/.bash_profile and ~/.ocamlinit". Then:
eval `opam config env`
opam install ocaml-top
I get the following error
The following actions failed
∗ install conf-gtksourceview 2
No changes have been performed
=-=- conf-gtksourceview.2 troobleshooting -=-=-=-=-
=> This package relies on external (system) dependencies that may be
missing.
`opam depext conf-gtksourceview.2' may help you find the correct
installation for your system.
[EDIT: trying on a second mac computer, the error is "[ERROR] The compilation of conf-gtksourceview failed at "pkg-config gtksourceview-2.0"."]
The above depext command gives:
# The following system packages are needed:
# - gtksourceview
# - libxml2
# All required OS packages found.
I have found advice (e.g. https://github.com/OCamlPro/ocaml-top/issues/46) like: "If you installed gtk+ through brew, you may need to do 'export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig' (homebrew)". However typing either that or "export PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig" in the terminal and retrying does not help.
I do not know anything about any of this, but it looked libgtksourceview2.0-dev might be involved, so I tried
opam install libgtksourceview2.0-dev
but
[ERROR] No package named libgtksourceview2 found.
Likewise "brew install libgtksourceview2.0-dev" or "brew install libgtksourceview".
https://github.com/ocaml/opam-repository/issues/8449 seems to imply this error could be because other packages need to be upgraded, and mentions that "the expanded pkg-config --short-errors --print-errors "gtksourceview-2.0 >= 2.2.0" [...] does print more information". I have no idea what this means though and how to detect which packages need to be upgraded.

You could try
brew install pkg-config gtksourceview libxml2
Otherwise, running brew search <part-of-name-of-dep> may help to find the required dependencies.

Related

Unable to install libimobiledevice 1.3.1 version

For my project libimobiledevice version 1.3.1 is required.
I am trying install it with brew command:
brew install --HEAD libimobiledevice
and I am getting an error with info:
No package 'libimobiledevice-glue-1.0' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables limd_glue_CFLAGS
and limd_glue_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
I was trying to install libimobiledevice-glue directly from git but after that problem still occurs.
Can someone explain how to perform steps to install libimobiledevice-glue correct way that command
brew install --HEAD libimobiledevice
can be performed without error because of missing glue lib?

Unable to install PyAudio on M1 Mac [PortAudio already installed]

I have visited many forums, tried diffrent methods like brew, pip, port and many more but still am facing the same error.
View this Image for more detail
src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
^~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/gcc' failed with exit code 1
Can anyone help?
These steps worked on M1 Pro chips
Install portaudio
brew install portaudio
Link portaudio
brew link portaudio
Copy the path where portaudio was installed (use it in the next step)
brew --prefix portaudio
Create .pydistutils.cfg in your home directory
sudo nano $HOME/.pydistutils.cfg
then paste the following
[build_ext]
include_dirs=<PATH FROM STEP 3>/include/
library_dirs=<PATH FROM STEP 3>/lib/
Install pyaudio
pip install pyaudio
or
pip3 install pyaudio
For me it was:
brew install portaudio
python -m pip install --global-option='build_ext' --global-option='-I/opt/homebrew/Cellar/portaudio/19.7.0/include' --global-option='-L/opt/homebrew/Cellar/portaudio/19.7.0/lib' pyaudio
This Solution is tested on M1 Macs[Please do check with other].
After the installation of HomeBrew on your system, perform the installation of PortAudio. Next follow the steps mentioned below:
Use the command to install PortAudio
sudo brew install portaudio
After successful installation of PortAudio, enter the following command.
sudo nano $HOME/.pydistutils.cfg
Next, enter the following lines in the opened window
[build_ext]
include_dirs=/Users/<enter-your-system-username>/homebrew/Cellar/portaudio/19.20140130/include/
include_dirs=/Users/<enter-your-system-username>/homebrew/Cellar/portaudio/19.20140130/lib/
Note: PortAudio location may be different for you and also don't forget to replace your PC username.
Finally run the command
pip install pyaudio
or
pip3 install pyaudio
The main challenge we're encountering here is that pyaudio doesn't know where to find the portaudio libraries since, according to the source, it only looks in these locations for darwin platform installations:
include_dirs += ['/usr/local/include', '/usr/include']
external_libraries_path += ['/usr/local/lib', '/usr/lib']
This won't do if you're using a homebrew installation of portaudio, particularly so with Apple Silicon since there isn't a pre-built wheel in PyPi. This means setuptools/pip will need to build the package from source.
There are a few ways of configuring setuptools to use additional paths, including passing arguments, using a .pydistutils.cfg file, among others, but the second option worked for me given I'm installing pyaudio to a few Python environments.
Building off of some of the answers above, you can copy the following below to install pyaudio in one go.
# Install portaudio, will print list of paths where it's been installed if already done
brew list portaudio || brew install portaudio
# Link portaudio, will print a warning if already linked
brew link portaudio
# Create a pydistutils config file with the portaudio lib paths set correctly (no copying/pasting paths required)
cat <<EOF >> .pydistutils.cfg
[build_ext]
include_dirs=`brew --prefix portaudio`/include/
library_dirs=`brew --prefix portaudio`/lib/
EOF
# install (build) package with pip
python -m pip install pyaudio
All we're doing is telling setuptools to also look for C/C++ headers where portaudio has been installed by homebrew.
vkshah has an error in his second line. It should ready library_dirs instead of include_dirs:
include_dirs=/Users/<enter-your-system-username>/homebrew/Cellar/portaudio/19.20140130/include/
library_dirs=/Users/<enter-your-system-username>/homebrew/Cellar/portaudio/19.20140130/lib/```
For me, I am running Big Sur on an M1 Mac. I followed all the instructions mentioned in other threads to:
install portaudio
arch -arm64 brew install portaudio
start a venv
python3 -m venv env
source env/bin/activate
install pyaudio
arch -arm64 pip install --no-cache-dir --global-option='build_ext' --global-option='-I/opt/homebrew/include' --global-option='-L/opt/homebrew/lib' pyaudio==0.2.11
TIP #1
If you see error on portaudio.h file not found, the solution is specifying the pyaudio version at the end. Because it kept trying to install version '0.2.12' which failed. I specify the version of pyaudio to '0.2.11' (see above).
TIP #2
After successfully installing pyaudio, you may see error PyAudio C module _portaudio, that is due to pip built it(_portaudio.cpython-36m-darwin.so) in x86_64 architecture. It's not compatible with arm64 portaudio, in this case, make sure to include arch -arm64 in front of pip to build the correct binary.
TIP #3
Use an older version of python, I personally used version 3.6.
Oh, and make sure the single quote is actually ' if you copied the command from a text editor.
Hope this helps!
first you need to download portaudio using homebrew
brew install portaudio
Then try to install pyaudio directly
pip install pyaudio
if you are getting error while installing follow below step
Or
if you are facing any error mentioned bellow you can follow these steps
error 1
option 'include_dirs' in section 'build_ext' already exists
error 2
Could not build wheels for pyaudio, which is required to install pyproject.toml-based projects
error 3
#include "portaudio.h"
^~~~~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
solution start here
after installing homebrew you have to link it
brew link portaudio
in some cases it will say that it has been already linked then simply ignore
we need path of portaudio where it is exactly installed
brew --prefix portaudio
it will gives you path of portaudio
then you have to check if pydistutils.cfg file exists or not
sudo cat $HOME/.pydistutils.cfg
if file exists then it will open else create it will below command
sudo cat $HOME/.pydistutils.cfg
so in these file we have to define proper path here
[build_ext]
include_dirs=/--PATH--/include/
library_dirs=/--PATH--/lib/
you can get that path by running below command
brew --prefix portaudio
if that path is not working then try below path
[build_ext]
include_dirs=/Users/<username>/homebrew/Cellar/portaudio/19.20140130/include/
library_dirs=/Users/<username>/homebrew/Cellar/portaudio/19.20140130/lib/
If you use mac os
Install Homebrew (insert link into the terminal:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" )
Insert command into the terminal:
brew install portaudio
Insert command into the terminal:
pip install pyaudio
p.s. sometimes you need upgrade your pip installer
These actions solved my problem (mac os Mojave 10.14.4)

Bash - installing Ocaml-top

I am trying to install Ocaml-Top IDE from command line. I have already installed Ocaml and OPAM using Homebrew (brew install opam, brew install ocaml), but when I enter:
opam install ocaml-top
I get
[ERROR] No OPAM root found at /Users/student/.opam.
Do I need to add this to my PATH?
UPDATE: Suggestion helped, but there is an issue with the package name: I get
[ERROR] No package named ocaml-top found.
You appear to have missed the following caveat, notably opam init, when you ran brew install opam:
$ brew info opam
...
==> Caveats
OPAM uses ~/.opam by default for its package database, so you need to
initialize it first by running (as a normal user):
$ opam init
Run the following to initialize your environment variables:
$ eval `opam config env`
To export the needed variables every time, add them to your dotfiles.
* On Bash, add them to `~/.bash_profile`.
* On Zsh, add them to `~/.zprofile` or `~/.zshrc` instead.
Documentation and tutorials are available at https://opam.ocaml.org, or
via "man opam" and "opam --help".
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
zsh completions have been installed to:
/usr/local/share/zsh/site-functions

rbenv fails to install ruby 1.8.7 on MacOS X Sierra

After creating a .ruby-version file with 1.8.7, running rbenv install on the same directory where the file is gives the following error:
ERROR: This package must be compiled with GCC, but ruby-build couldn't
find a suitable gcc executable on your system. Please install GCC
and try again.
DETAILS: Apple no longer includes the official GCC compiler with Xcode
as of version 4.2. Instead, the gcc executable is a symlink to
llvm-gcc, a modified version of GCC which outputs LLVM bytecode.
For most programs the llvm-gcc compiler works fine. However,
versions of Ruby older than 1.9.3-p125 are incompatible with
llvm-gcc. To build older versions of Ruby you must have the official
GCC compiler installed on your system.
TO FIX THE PROBLEM: Install Homebrew's apple-gcc42 package with this
command: brew tap homebrew/dupes ; brew install apple-gcc42
You will need to install the official GCC compiler to build older
versions of Ruby even if you have installed Apple's Command Line Tools
for Xcode package. The Command Line Tools for Xcode package only
includes llvm-gcc.
BUILD FAILED (OS X 10.12.4 using ruby-build 20170405-2-g3b15693)
Then running brew install apple-gcc42 gives:
apple-gcc42: This formula either does not compile or function as expected on macOS
versions newer than Mavericks due to an upstream incompatibility.
Error: An unsatisfied requirement failed this build.
Stuck trying to install ruby 1.8.7 through rbenv on MacOS X Sierra. Any ideas on how to fix this?
Previous answer looks good, but some updates for it:
You must add the following code not after line 762 (because from version to version lines must be different).
You must insert it after:
require_gcc() {
local gcc="$(locate_gcc || true)"
these lines(for me it was 784 line)
So full tutorial:
Found the solution here: http://xibbar.hatenablog.com
http://xibbar.hatenablog.com/entry/2017/04/28/112813
After running it through Google Translate, got to this:
Find ruby-build: which ruby-build
Edit it (in my case): vim /usr/local/bin/ruby-build
Find the lines like these:
require_gcc() {
local gcc="$(locate_gcc || true)"
Add the following code after it:
local osx_version="$(osx_version)"
if [ $osx_version = "1012" ]; then
return 0
fi
Run:
CONFIGURE_OPTS="--with-readline-dir=/usr/local --with-openssl-dir=`brew --prefix openssl`" RUBY_CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install 1.8.7-p374
Hope it's useful to others.
Found the solution here: http://xibbar.hatenablog.com
After running it through Google Translate, got to this:
Find ruby-build: which ruby-build
Edit it (in my case): vim /usr/local/bin/ruby-build
Add the following code after line 762:
local osx_version="$(osx_version)"
if [ $osx_version = "1012" ]; then
return 0
fi
Run:
CONFIGURE_OPTS="--with-readline-dir=/usr/local --with-openssl-dir=`brew --prefix openssl`" RUBY_CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install 1.8.7-p374
Hope it's useful to others.

what is osx_brew and can i install it in my ubuntu machin?

I have tried so many tries to correct the issues with ruby version. In between somewhere i have installed osx_brew in my machine. Actually i don't know why i have install this. After a short googling i can found that the osx_brew only needed for mac os. I don't know that is correct or not. Any way when i try to install rvm requirements i got the error like
Installing requirements for osx_brew, might require sudo password.
Already up-to-date.
Installing required packages: autoconf, automake, libtool, pkg-config, apple-gcc42, libyaml, readline, libxml2, libxslt, libksba, openssl, sqlite...
Error running 'requirements_brew_libs_install autoconf automake libtool pkg-config apple-gcc42 libyaml readline libxml2 libxslt libksba openssl sqlite',
please read /home/anoop/.rvm/log/package_install_autoconf_automake_libtool_pkg-config_apple-gcc42_libyaml_readline_libxml2_libxslt_libksba_openssl_sqlite.log
There were package installation errors, make sure to read the log.
Check Homebrew requirements https://github.com/mxcl/homebrew/wiki/Installation
i don't know whether this problem arises due to homebrew or not.
Also when i try the command rvm autolibs status
it shows me like
---
value: osx_brew
number: 4
runner: osx_brew
description: Allow RVM to use package manager if found, install missing dependencies, install package manager (only OS X).
It says like only for osx_homebrew. Do i need to install when i working in rvm ruby if yes can you tell me the purpose of that. If i don't need this how can i remove this in my ubuntu system?

Resources