How to install gmp4 on macOS Catalina - macos-catalina

I tried
brew install gmp#4
but it explained
No available formula with the name "gmp4"
I have gmp6 on macOS Catalina but I need gmp4 for some reasons, so how to install gmp4 on macOS Catalina?

Download gmp-4.3.2
Extract the file and enter the directory.
CFLAGS="-O3 -w -pipe -arch x86_64"
CXXFLAGS="-O3 -w -pipe -arch x86_64"
LDFLAGS="-arch x86_64"
./configure --prefix=/usr/local/Cellar/gmp/4.3.2 --enable-cxx --build=x86_64-apple-darwin
make
make install
It will install gmp-4.3.2 in /usr/local/Cellar/gmp/4.3.2, enjoy!

Related

Boost libraries in MacOS "clang: error: unsupported option '-fopenmp'" [duplicate]

I am currently trying to deploy a project using openmp. I have the flag '-fopenmp' on Travis.
How could I fix that ?
In local I just brew install libopenmp which solved the issue. But not on Travis, what are the options ?
Using cython I got the following ".travis.yml"
os: linux
dist: xenial
language: python
python:
- "3.7"
cache: pip
addons:
apt:
packages:
- patchelf
matrix:
include:
- os: osx
# No version of Python is available via virtualenv on OS X workers, see https://github.com/travis-ci/travis-ci/issues/2312
language: generic
env: TOXENV=py37
fast_finish: true
before_install:
brew install libomp
install:
- pip install --upgrade "pip < 19.1" -r CI/requirements.txt
- python setup.py develop
script:
- pytest
Travis fails while executing :
clang -fno-strict-aliasing -fno-common -dynamic -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/include -I/usr/local/opt/openssl#1.1/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python#2/2.7.17/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c cpt/alphabet.c -o build/temp.macosx-10.13-x86_64-2.7/cpt/alphabet.o -fopenmp
While in local it compiles with python 3.7, how could I fix that aswell ?
On apple's llvm, -fopenmp is not supported. One should use brew's llvm.
The following ables to link openmp:
- brew install llvm libomp
- export CPP=/usr/local/opt/llvm/bin/clang;
For reference, the issue where there are all the commands: https://github.com/bluesheeptoken/CPT/issues/68#issuecomment-563342866

Getting error while installing memsql python library "_mysql.c:44:10: fatal error: 'my_config.h' file not found" on MAC OSx

When am trying to install the memsql python library getting below error
I have tried the below options already:
sudo pip install memsql
sudo pip install memsql --global-option=build_ext --global-option="-I/usr/local/opt/openssl/include" --global-option="-L/usr/local/opt/openssl/lib"
Installing collected packages: MySQL-python, memsql
Running setup.py install for MySQL-python ... error
Complete output from command /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-JDxMyP/MySQL-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" build_ext -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib install --record /private/tmp/pip-record-azfFw0/install-record.txt --single-version-externally-managed --compile:
running build_ext
building '_mysql' extension
creating build
creating build/temp.macosx-10.14-intel-2.7
cc -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/local/Cellar/mysql/8.0.15/include/mysql -I/usr/local/opt/openssl/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.14-intel-2.7/_mysql.o
_mysql.c:44:10: fatal error: 'my_config.h' file not found
#include "my_config.h"
^~~~~~~~~~~~~
1 error generated.
error: command 'cc' failed with exit status 1}
In order to install memsql-python you need to ensure that you have the dependencies already available. Specifically, the dependency that seems to be missing from your environment is libmysqlclient-dev or an equivalent package.
Note - you are overriding the include paths to point at your openssl installation which may be causing this issue due to how the compiler is searching for development headers.
According to the project's readme, use the following steps to get started quickly on Ubuntu:
sudo apt-get update
sudo apt-get install -y mysql-client python-dev libmysqlclient-dev python-pip
sudo pip install memsql
Use the following steps to get started with RHEL based distributions such as Amazon Linux or Centos:
sudo yum update
sudo yum install -y gcc mysql-devel
sudo pip install memsql
-- edit to address question regarding installation on Mac OSX
On a Mac it appears that you can install the mysql-client package from brew which in theory should provide the libmysqlclient-dev package. Once available try installing the memsql-python package without overriding linker flags since memsql-python should build fine without openssl. If you need openssl support then you will need to ensure that both the openssl and libmysqlclient-dev shared objects are available to the linker at compilation time.
This procedure worked for me:
brew remove mysql
brew install mysql#5.7
brew link --force mysql#5.7
I read a post and adjusted the procedure to link things in the /usr/local/bin instead of adding a new route to the PATH variable.
Reference: MacOS: "pip install MySQL-python" returning an error: "_mysql.c:44:10: fatal error: 'my_config.h' file not found"

How to install map/plotting libraries cartopy and basemap using pip

I understand some dependencies need to be satisfied before installing cartopy and basemap. I sorted out most of them using pip (like numpy etc.).
I found out there are some cartopy issues with Proj.4 and some basemap issues with GEOS.
I thought the python bindings to the Java project Proj.4 were enough and I am a bit lost with the C++ library GEOS (I think GDAL is enough for GEOS, I've linked it to the python world this way: pip install --global-option=build_ext --global-option="-I/usr/include/gdal" GDAL==`gdal-config --version).
I would prefer avoiding all those things like anaconda, canopy, etc.
If possible I would like to use only pip on both Ubuntu (apt-get, only if pip is not enough) and Mac OSX (homebrew e.g. brew install <some_package>, only if pip is not enough).
cartopy gets stuck on a version of Proj.4 that is too old. The pip output says: Proj4 version 4.8.0 is installed, but cartopy requires at least version 4.9.0..
I was assuming this pip install of the python bindings was enough, but it does not solve the problem:
$ pip show pyproj
Name: pyproj
Version: 1.9.5.1
Summary: Python interface to PROJ.4 library
Home-page: https://github.com/jswhit/pyproj
Author: Jeff Whitaker
Author-email: jeffrey.s.whitaker#noaa.gov
License: OSI Approved
Location: /usr/local/lib/python2.7/dist-packages
Requires:
I don't get why the python bindings to Proj.4 are not enough, even if those bindings are the latest version available using pip.
basemap is stuck in different ways:
Using pip2 install basemap somehow I get Could not find a version that satisfies the requirement basemap (from versions: )
No matching distribution found for basemap
But then from the basemap documentation I found that library is not linked to the pip repositories for some reason and needs to be installed from the source code. So I've run: pip2 install https://github.com/matplotlib/basemap/archive/v1.0.7rel.tar.gz and I believe that a GEOS compilation of the C++ code is triggered and after a while it stops with at the bottom this:
In file included from src/_geoslib.c:255:0:
/usr/include/geos_c.h:151:22: note: expected ‘GEOSMessageHandler’ but argument is of type ‘void (*)(char *, char *)’
extern void GEOS_DLL initGEOS(GEOSMessageHandler notice_function,
^
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/_geoslib.o -lgeos_c -lgeos -o build/lib.linux-x86_64-2.7/_geoslib.so
/usr/bin/ld: cannot find -lgeos
collect2: error: ld returned 1 exit status
/usr/bin/ld: cannot find -lgeos
collect2: error: ld returned 1 exit status
error: Command "x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/src/_geoslib.o -lgeos_c -lgeos -o build/lib.linux-x86_64-2.7/_geoslib.so" failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-QVrKRr-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-EgAOPT-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-QVrKRr-build/
I am not sure what I am doing wrong:
how to provide the correct Proj.4 stuff to cartopy? Actually I would prefer finding an older version of cartopy that is fine with the existing version of Proj.4 (which I am assuming comes from the pip install bindings)
how to get basemap finding GEOS from the GDAL links I've setup with pip? If that's not enough, then what should I do more? Perhaps some apt-get of a GEOS pakcage that avoids triggering the GEOS compilation inside the basemap installation?
I am a bit confused in this no mans land between Java binaries, C++ binaries and bindings to python packages.
As you noticed cartopy requires Proj.4 lib in version >=4.9. On Ubuntu (newer than 16.04) you can install it through sudo apt-get install libproj-dev.
For older Ubuntu, e.g. 14.04, you could simply download newest package from 16.04 (xenial libproj-dev) and install it manually. Notice that it depends on libproj9 in version 4.9. Remember to remove older version before you update them with
sudo apt-get purge libproj-dev libproj9
Once you done that, open and download packages from links for appropriate architecture (from your log I understand that's amd64). Double click downloaded files in order librproj9 and libproj-dev or use
sudo dpkg -i <path_to_file>.

pip cant install python-ldap into virtualenv [duplicate]

When I sudo pip install pyquery, sudo pip install lxml, and sudo pip install cython, I get very similar output with the same error that says:
x86_64-linux-gnu-gcc: error: unrecognized command line option ‘-fstack-protector-strong’
Here's the complete pip output for sudo pip install pyquery:
Requirement already satisfied (use --upgrade to upgrade): pyquery in /usr/local/lib/python2.7/dist-packages
Downloading/unpacking lxml>=2.1 (from pyquery)
Running setup.py egg_info for package lxml
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.4.1.
Building without Cython.
Using build configuration of libxslt 1.1.28
Requirement already satisfied (use --upgrade to upgrade): cssselect in /usr/local/lib/python2.7/dist-packages/cssselect-0.9.1-py2.7.egg (from pyquery)
Installing collected packages: lxml
Running setup.py install for lxml
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.4.1.
Building without Cython.
Using build configuration of libxslt 1.1.28
building 'lxml.etree' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/libxml2 -I/root/build/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w
x86_64-linux-gnu-gcc: error: unrecognized command line option ‘-fstack-protector-strong’
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Complete output from command /usr/bin/python -c "import setuptools;__file__='/root/build/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-gg4SuG-record/install-record.txt:
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Building lxml version 3.4.1.
Building without Cython.
Using build configuration of libxslt 1.1.28
running install
running build
running build_py
copying src/lxml/includes/lxml-version.h -> build/lib.linux-x86_64-2.7/lxml/includes
running build_ext
building 'lxml.etree' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/libxml2 -I/root/build/lxml/src/lxml/includes -I/usr/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.linux-x86_64-2.7/src/lxml/lxml.etree.o -w
x86_64-linux-gnu-gcc: error: unrecognized command line option ‘-fstack-protector-strong’
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/root/build/lxml/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-gg4SuG-record/install-record.txt failed with error code 1 in /root/build/lxml
Storing complete log in /root/.pip/pip.log
The complete log from /root/.pip/pip.log is here: http://pastebin.com/5R4VZDu8
I've looked at this, this, this, and this for help, but I haven't been able to solve the issue yet.
I've already installed libxml2-dev, libxslt1-dev, and python-dev. I'm running Debian 7.0 x64 on a DigitalOcean droplet.
I'm just trying to install pyquery. Can someone please help me out?
Thanks
I ran into this problem when I attempted to upgrade my pandas version to 0.15.2
If you install gcc-4.9 you are likely to still have an older version of gcc on your system (gcc-4.7 in my case).
I can think of 3 ways to solve this issue:
a) symlink /usr/bin/x86_64-linux-gnu-gcc to
/usr/bin/x86_64-linux-gnu-gcc-4.9
if you want to be more organized about this use update-alternatives, see https://askubuntu.com/questions/26498/choose-gcc-and-g-version
b) figure out how to manually specify which compiler pip uses and set it in some sort of .conf file - I haven't examined where this file lives or if there are CLI options for pip that accomplish the equivalent. In principle, creating/editing a /usr/lib/pythonX.Y/distutils/distutils.cfg should do it. I ran into problems when I tried to use this approach.
c) Edit /usr/lib/python2.7/plat-x86_64-linux-gnu/_sysconfigdata_nd.py to reflect your updated compiler
How to use MinGW's gcc compiler when installing Python package using Pip?
https://docs.python.org/2/install/#distutils-configuration-files
I went with the quick and dirty solution (a) to force everything to work
root#localhost:/home/user1$ rm /usr/bin/x86_64-linux-gnu-gcc
root#localhost:/home/user1$ ln -s /usr/bin/gcc-4.9 /usr/bin/x86_64-linux-gnu-gcc
root#localhost:/home/user1$ pip install pandas --upgrade
. . . pandas compiles with gcc-4.9 here . . .
move things back to how they were
root#localhost:/home/user1$ rm /usr/bin/x86_64-linux-gnu-gcc
root#localhost:/home/user1$ ln -s /usr/bin/gcc-4.7 /usr/bin/x86_64-linux-gnu-gcc
One possible solution would be to use GCC 4.9 or higher, which does support the -fstack-protector-strong flag.
Instead of upgrading to GCC 4.9, I was trying to find where the flag was defined and remove it. On Debian Wheezy, I found it in /usr/lib/python2.7/plat-x86_64-linux-gnu/_sysconfigdata_nd.py which belongs to the libpython2.7-minimal package. My solution was to replace all occurrences of -fstack-protector-strong with -fstack-protector within this file. Then pip install executed the correct build command.

Building Portaudio on OSX 10.7.5 using SDK10.6 or 10.7 fails

I am still having trouble building the Portaudio library on my system, which is OSX 10.7.5 with Xcode 4.3.2, having Command Line Tools installed and having SDK10.6 and SDK10.7 under
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
I describe shortly (also for others that run into the same problem) what I have done so far (following different solutions I have found on the web).
1) I downloaded "Portaudio" / pa_stable_v19_20111121.tgz (last stable release) from:
www.portaudio.com/download.html
2) I read the instructions on building Portaudio here:
www.portaudio.com/docs/v19-doxydocs/compile_mac_coreaudio.html
and tried to compile from a Terminal window with the suggested command:
./configure && make
This resulted (not so surprisingly) in a lot of errors ending with:
llvm-gcc-4.2: error trying to exec '/usr/bin/../llvm-gcc-4.2/bin/powerpc-apple-darwin11-llvm-gcc-4.2': execvp: No such file or directory
lipo: can't open input file: /var/folders/1_/xkp08ky561jg02zjjrpsxg940000gn/T//ccPxCTrJ.out (No such file or directory)
make: * [src/hostapi/coreaudio/pa_mac_core.lo] Error 1
This happens because "ppc" is not supported anymore since OSX 10.5. Moreover the "Developer" folder doesn't exist on OSX 10.7 and everything that was in the Developer folder has moved to
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
3) I downloaded a patch (mac_configure_patch.txt) to fix "configure" from:
https://www.assembla.com/spaces/portaudio/tickets/216#/activity/ticket:
and copied it to the portaudio directory and applied it by typing in Terminal:
$ patch < mac_configure_patch.txt
A confirmation message said:
patching file configure.in
So everything seems fine. But still Portaudio is trying to build for "ppc".
4) Now I set the ARCHFLAGS, CFLAGS, LDFLAGS to only build for architecture i386 as follows (disabling universal build):
$ MACOSX_DEPLOYMENT_TARGET="10.7" ARCHFLAGS="-arch i386" CFLAGS="-O2 -g -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -arch i386 -mmacosx-version-min=10.7" LDFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sd -arch i386 -mmacosx-version-min=10.7" ./configure --disable-mac-universal
5) Further I found that:
A): "#include AudioToolbox.h" in ".include/pa_mac_core.h" should be UNCOMMENTED
B): that "-wError" from "Makefile" (not Makefile.in) should be removed.
accoding to:
http://www.fluxforge.com/blog/building-portaudio-under-os-x-107-lion
6) Now I try to build (using: "sudo make"), compilation starts but but fails with:
ld: framework not found CoreAudio
collect2: ld returned 1 exit status
make: * [lib/libportaudio.la] Error 1
7) So I try to point to the framework using "-F/System/Library/Frameworks -framework CoreAudio"
leading to the following Terminal command:
$ MACOSX_DEPLOYMENT_TARGET="10.7" ARCHFLAGS="-arch i386" CFLAGS="-O2 -g -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -arch i386 -mmacosx-version-min=10.7" LDFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sd -arch i386 -mmacosx-version-min=10.7 -F/System/Library/Frameworks -framework CoreAudio" ./configure --disable-mac-universal
which seems to fix the CoreAudio framework issue but results in another error saying:
ld: library not found for -lSystem
collect2: ld returned 1 exit status
make: * [lib/libportaudio.la] Error 1
I am now stuck at this point. Did anyone experience the same problems when trying to build Portaudio on OSX 10.7 using SDK10.6 or SDK10.7. Did anyone find a solution to how to build Portaudio from Terminal?
I am very thankful for any hints!!!
Thanks in advance!
Try the latest svn. If that doesn't work right off the bat, you might need to muck with some of the flags.
eg, in configure.in:
change -Werror to -Wall
add -Wno-deprecated (you shouldn't need this, but just in case)
then run
./configure --disable-mac-universal
and make as usual.
OK, finally I solved the issue. Hope the solution will help others as well. I just forgot to also add the path to the CoreAudio framework to the CFLAGS. Here is the final configure/build command for building portaudio on OSX 10.7.5 using SDK10.7 for architecture i386 & x86_64:
Open a Terminal window in the portaudio directory and type:
MACOSX_DEPLOYMENT_TARGET="10.7" ARCHFLAGS="-arch i386" CFLAGS="-O2 -g -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -arch i386 -mmacosx-version-min=10.7 -F/System/Library/Frameworks -framework CoreAudio" LDFLAGS="-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -arch i386 -mmacosx-version-min=10.7 -F/System/Library/Frameworks -framework CoreAudio" ./configure --disable-mac-universal
If this has finished, you need to edit Makefile and change the mention of -Werror to -Wall.
Then:
make
Voila. There you have your "libportaudio.la" in the portaudio/lib directory. You can now type
sudo make install
(you'll be asked to confirm using your password)
to put the library in the system directory.
Finally you can mess around with Portaudio!
Have fun!
Tried your instructions on Mac OSX Mountain Lion (10.8), and it was progressing a lot in compilation but then was failing with:
In file included from ./test/patest_sine_channelmaps.c:53:
./include/pa_mac_core.h:100:1: error: unknown type name 'AudioDeviceID'
AudioDeviceID PaMacCore_GetStreamInputDevice( PaStream* s );
^
./include/pa_mac_core.h:109:1: error: unknown type name 'AudioDeviceID'
AudioDeviceID PaMacCore_GetStreamOutputDevice( PaStream* s );
^
2 errors generated.
make: *** [bin/patest_sine_channelmaps] Error 1
However, I figured out you can simply use Homebrew (apt-like packet manager for OSX) and it will do the dirty job like a charm. Find binaries and headers in the specified install directory :)
$ brew install portaudio
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
==> Downloading http://www.portaudio.com/archives/pa_stable_v19_20111121.tgz
######################################################################## 100.0%
==> Downloading patches
######################################################################## 100.0%
==> Patching
patching file include/pa_mac_core.h
==> ./configure --prefix=/usr/local/Cellar/portaudio/19.20111121 --enable-mac-un
==> make install
/usr/local/Cellar/portaudio/19.20111121: 8 files, 316K, built in 20 seconds