Installing numpy with pypy on mac osx - macos

I'm unable to install numpy with pypy on mac. I have installed pypy using brew and when I try to execute:
pip_pypy install numpy
I get this error:
creating build/temp.macosx-10.11-x86_64-2.7/private/var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn
creating build/temp.macosx-10.11-x86_64-2.7/private/var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T
creating build/temp.macosx-10.11-x86_64-2.7/private/var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T/pip-build-RBCHFE
creating build/temp.macosx-10.11-x86_64-2.7/private/var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T/pip-build-RBCHFE/numpy
creating build/temp.macosx-10.11-x86_64-2.7/private/var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T/pip-build-RBCHFE/numpy/numpy
creating build/temp.macosx-10.11-x86_64-2.7/private/var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T/pip-build-RBCHFE/numpy/numpy/_build_utils
creating build/temp.macosx-10.11-x86_64-2.7/private/var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T/pip-build-RBCHFE/numpy/numpy/_build_utils/src
compile options: '-DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DNO_ATLAS_INFO=3 -DHAVE_CBLAS -Ibuild/src.macosx-10.11-x86_64-2.7/numpy/core/src/private -Inumpy/core/include -Ibuild/src.macosx-10.11-x86_64-2.7/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/local/Cellar/pypy/4.0.1/libexec/include -Ibuild/src.macosx-10.11-x86_64-2.7/numpy/core/src/private -Ibuild/src.macosx-10.11-x86_64-2.7/numpy/core/src/private -Ibuild/src.macosx-10.11-x86_64-2.7/numpy/core/src/private -c'
extra options: '-msse3 -I/System/Library/Frameworks/vecLib.framework/Headers'
cc: numpy/core/src/multiarray/alloc.c
In file included from numpy/core/src/multiarray/alloc.c:8:
In file included from numpy/core/include/numpy/arrayobject.h:4:
In file included from numpy/core/include/numpy/ndarrayobject.h:27:
build/src.macosx-10.11-x86_64-2.7/numpy/core/include/numpy/__multiarray_api.h:28:12: error: visibility does not match previous declaration
extern NPY_NO_EXPORT PyTypeObject PyArray_Type;
^
numpy/core/include/numpy/ndarraytypes.h:10:31: note: expanded from macro 'NPY_NO_EXPORT'
#define NPY_NO_EXPORT NPY_VISIBILITY_HIDDEN
^
build/src.macosx-10.11-x86_64-2.7/numpy/core/include/numpy/_numpyconfig.h:25:46: note: expanded from macro 'NPY_VISIBILITY_HIDDEN'
#define NPY_VISIBILITY_HIDDEN __attribute__((visibility("hidden")))
^
/usr/local/Cellar/pypy/4.0.1/libexec/include/pypy_decl.h:611:1: note: previous attribute is here
PyAPI_DATA(PyTypeObject) PyArray_Type;
^
/usr/local/Cellar/pypy/4.0.1/libexec/include/Python.h:15:35: note: expanded from macro 'PyAPI_DATA'
# define PyAPI_DATA(RTYPE) extern PyAPI_FUNC(RTYPE)
^
/usr/local/Cellar/pypy/4.0.1/libexec/include/Python.h:14:43: note: expanded from macro 'PyAPI_FUNC'
# define PyAPI_FUNC(RTYPE) __attribute__((visibility("default"))) RTYPE
^
numpy/core/src/multiarray/alloc.c:109:30: error: use of undeclared identifier 'PyMem_MALLOC'
&PyArray_malloc);
^
numpy/core/include/numpy/ndarraytypes.h:335:24: note: expanded from macro 'PyArray_malloc'
#define PyArray_malloc PyMem_Malloc
^
/usr/local/Cellar/pypy/4.0.1/libexec/include/pymem.h:8:22: note: expanded from macro 'PyMem_Malloc'
#define PyMem_Malloc PyMem_MALLOC
^
2 errors generated.
In file included from numpy/core/src/multiarray/alloc.c:8:
In file included from numpy/core/include/numpy/arrayobject.h:4:
In file included from numpy/core/include/numpy/ndarrayobject.h:27:
build/src.macosx-10.11-x86_64-2.7/numpy/core/include/numpy/__multiarray_api.h:28:12: error: visibility does not match previous declaration
extern NPY_NO_EXPORT PyTypeObject PyArray_Type;
^
numpy/core/include/numpy/ndarraytypes.h:10:31: note: expanded from macro 'NPY_NO_EXPORT'
#define NPY_NO_EXPORT NPY_VISIBILITY_HIDDEN
^
build/src.macosx-10.11-x86_64-2.7/numpy/core/include/numpy/_numpyconfig.h:25:46: note: expanded from macro 'NPY_VISIBILITY_HIDDEN'
#define NPY_VISIBILITY_HIDDEN __attribute__((visibility("hidden")))
^
/usr/local/Cellar/pypy/4.0.1/libexec/include/pypy_decl.h:611:1: note: previous attribute is here
PyAPI_DATA(PyTypeObject) PyArray_Type;
^
/usr/local/Cellar/pypy/4.0.1/libexec/include/Python.h:15:35: note: expanded from macro 'PyAPI_DATA'
# define PyAPI_DATA(RTYPE) extern PyAPI_FUNC(RTYPE)
^
/usr/local/Cellar/pypy/4.0.1/libexec/include/Python.h:14:43: note: expanded from macro 'PyAPI_FUNC'
# define PyAPI_FUNC(RTYPE) __attribute__((visibility("default"))) RTYPE
^
numpy/core/src/multiarray/alloc.c:109:30: error: use of undeclared identifier 'PyMem_MALLOC'
&PyArray_malloc);
^
numpy/core/include/numpy/ndarraytypes.h:335:24: note: expanded from macro 'PyArray_malloc'
#define PyArray_malloc PyMem_Malloc
^
/usr/local/Cellar/pypy/4.0.1/libexec/include/pymem.h:8:22: note: expanded from macro 'PyMem_Malloc'
#define PyMem_Malloc PyMem_MALLOC
^
2 errors generated.
error: Command "cc -arch x86_64 -O2 -fPIC -Wimplicit -O2 -fPIC -Wimplicit -O2 -fPIC -Wimplicit -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DNO_ATLAS_INFO=3 -DHAVE_CBLAS -Ibuild/src.macosx-10.11-x86_64-2.7/numpy/core/src/private -Inumpy/core/include -Ibuild/src.macosx-10.11-x86_64-2.7/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/local/Cellar/pypy/4.0.1/libexec/include -Ibuild/src.macosx-10.11-x86_64-2.7/numpy/core/src/private -Ibuild/src.macosx-10.11-x86_64-2.7/numpy/core/src/private -Ibuild/src.macosx-10.11-x86_64-2.7/numpy/core/src/private -c numpy/core/src/multiarray/alloc.c -o build/temp.macosx-10.11-x86_64-2.7/numpy/core/src/multiarray/alloc.o -msse3 -I/System/Library/Frameworks/vecLib.framework/Headers" failed with exit status 1
----------------------------------------
Command "/usr/local/Cellar/pypy/4.0.1/bin/pypy -u -c "import setuptools, tokenize;__file__='/private/var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T/pip-build-RBCHFE/numpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T/pip-fCQrIA-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T/pip-build-RBCHFE/numpy
And when I am trying to follow instructions from http://pypy.org/download.html
I get even more confusing error about pypy version 4.1:
Cloning https://bitbucket.org/pypy/numpy.git to /var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T/pip-59hKzA-build
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T/pip-59hKzA-build/setup.py", line 33, in <module>
('.'.join(map(str, MIN_PYPY_VERSION)),))
RuntimeError: PyPy version >= 4.1 required
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T/pip-59hKzA-build
Dose anyone know what am I doing wrong and how can I fix it?

NumPy is being ported to pypy and so only an experimental version is available for now. According to the official site, the command to install that version of NumPy to pypy is:
pypy -m pip install git+https://bitbucket.org/pypy/numpy.git
http://pypy.org/download.html#installing-numpy
The command you tried will probably try to install normal NumPy from PyPI which is not ready for pypy.
(edit)
I just followed the instructions given at https://bitbucket.org/pypy/numpy and I could install numpy 1.9.0 to pypy on Linux Mint 17.
Basically create a new env for pypy-numpy
virtualenv -p /path/to/pypy/bin/pypy /directory/to/try/pypy-numpy
/path/to/pypy/bin/pypy here is the path to your PyPy 4.0.1.
/directory/to/try/pypy-numpy is up to you. I created in home/pypy-numpy
Then I cloned NumPyPy source by
git clone https://bitbucket.org/pypy/numpy.git
then I moved to this clone directory 'numpy' and did
git checkout pypy-4.0.1
This fetched the version of NumPyPy we need for PyPy 4.0.1
Now I can
~/pypy-numpy/bin/pypy setup.py install
which worked without problems.
Hope this helps on Mac as well.

Related

gcc/gfortran 11 cannot find headers/libraries in default locations

After upgrading python 3.8.6 to 3.9.10 using homebrew, my Cython extensions no longer without explicitly adding /usr/local/include (for my Intel MacBook) or /opt/homebrew/include to the include_dirs of my extension.
My setup.py.in:
import os, sys
from numpy.distutils.core import setup, Extension
from Cython.Build import cythonize
link_arguments = []
extra_include_dirs = []
if (sys.platform == 'darwin'):
link_arguments.append("-Wl,-rpath")
link_arguments.append("-Wl,#loader_path/")
if os.path.exists('/opt/homebrew/'):
extra_include_dirs.append("/opt/homebrew/include/")
else:
extra_include_dirs.append("/usr/local/include/")
else:
link_arguments.append("-Wl,-rpath=${CMAKE_SOURCE_DIR}/lib/")
pynwp_extension = Extension(
name="pynwp",
sources=["${CMAKE_CURRENT_SOURCE_DIR}/lambert.f90", "${CMAKE_CURRENT_SOURCE_DIR}/pynwp.f90", "${CMAKE_CURRENT_SOURCE_DIR}/readAtmosphereGen.f90", "${CMAKE_CURRENT_SOURCE_DIR}/ptogrot.f", "${CMAKE_CURRENT_SOURCE_DIR}/bilin1.f", "${CMAKE_CURRENT_SOURCE_DIR}/fl2pres_f.f","${CMAKE_CURRENT_SOURCE_DIR}/message.c","${CMAKE_CURRENT_SOURCE_DIR}/gridWindDirCorrection.F"],
libraries=["HirlamUtils_fPIC", "eccodes_f90", "jasper"],
library_dirs=["${PROJECT_BINARY_DIR}", "${CMAKE_SOURCE_DIR}/build${CMAKE_BUILD_TYPE}/src/libHirlamUtils/", "/opt/homebrew/lib/"],
extra_link_args = link_arguments,
include_dirs=["${CMAKE_SOURCE_DIR}/include", "/usr/lib64/gfortran/modules/",
"${CMAKE_SOURCE_DIR}/build${CMAKE_BUILD_TYPE}"] + extra_include_dirs,
extra_f90_compile_args=["-DLINUX", "-DIS_LITTLE_ENDIAN", "-DUSEWALLTIME", "-DHAS_BLAS", "-DHAS_LAPACK", "-DGRIB32", "-DTIMING", "-DPREC32", "-fno-whole-file", "-g", "-fbounds-check"]
#compiler_directives={'language_level' : "3"}
)
setup(name="pynwp",
author="me",
author_email="me!me.com",
version="1.0.1",
description="Python wrapper for pynwp",
package_dir={"": "${CMAKE_CURRENT_SOURCE_DIR}"},
url="http://emaddc.eu",
license="MIT License",
ext_modules=[pynwp_extension]
)
In the file above, I have hardcoded the location (temporarily) of the homebrew library dir and added some functionality for the include dir based on /opt/homebrew being found. If I remove this from the file, compilation fails as eccodes.mod cannot be found, see the output when I run the command generate by python/CMake manually:
buildDebug git:(master) ✗ /opt/homebrew/bin/gfortran -Wall -g -fno-second-underscore -fPIC -O3 -funroll-loops -I<project_dir>//include -I/usr/lib64/gfortran/modules/ -I<project_dir>//buildDebug -Ibuild/src.macosx-12-arm64-3.9/build/src.macosx-12-arm64-3.9 -I/opt/homebrew/lib/python3.9/site-packages/numpy/core/include -Ibuild/src.macosx-12-arm64-3.9/numpy/distutils/include -I/opt/homebrew/opt/python#3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c -c <project_dir>//src/pynwp/readAtmosphereGen.f90 -o build/temp.macosx-12-arm64-3.9<project_dir>//src/pynwp/readAtmosphereGen.o -DLINUX -DIS_LITTLE_ENDIAN -DUSEWALLTIME -DHAS_BLAS -DHAS_LAPACK -DGRIB32 -DTIMING -DPREC32 -fno-whole-file -g -fbounds-check
f951: Warning: Nonexistent include directory '/usr/lib64/gfortran/modules/' [-Wmissing-include-dirs]
f951: Warning: Nonexistent include directory 'build/src.macosx-12-arm64-3.9/build/src.macosx-12-arm64-3.9' [-Wmissing-include-dirs]
f951: Warning: Nonexistent include directory 'build/src.macosx-12-arm64-3.9/numpy/distutils/include' [-Wmissing-include-dirs]
<project_dir>//src/pynwp/readAtmosphereGen.f90:3:7:
3 | use eccodes
| 1
Fatal Error: Cannot open module file 'eccodes.mod' for reading at (1): No such file or directory
compilation terminated.
This extension is part of a larger project that is build using CMake. When running the gfortran command manually, the same errors indicating that eccodes.mod cannot be found. The file is however located on a default location on the gfortran/gcc search path:
locate eccodes.mod
/opt/homebrew/Cellar/eccodes/2.24.2/include/eccodes.mod
/opt/homebrew/include/eccodes.mod
And the search path for gfortran:
gfortran -E -Wp,-v -
#include <...> search starts here:
/opt/homebrew/include
/opt/homebrew/Cellar/gcc/11.2.0_3/bin/../lib/gcc/11/gcc/aarch64-apple-darwin21/11/include
/opt/homebrew/Cellar/gcc/11.2.0_3/bin/../lib/gcc/11/gcc/aarch64-apple-darwin21/11/include-fixed
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks
End of search list.
Another project uses gcc/ld and has a similar problem. I need to explicitly add LINK_DIRECTORIES(/opt/homebrew/lib) to CMakeList.txt in order for gcc to find the eccodes library. Without that, I get:
gcc-11: warning: this compiler does not support X86 (arch flags ignored)
ld: library not found for -leccodes
collect2: error: ld returned 1 exit status
make[2]: *** [src/smoothModeS-v51/smoothModeS-v51.x] Error 1
make[1]: *** [src/smoothModeS-v51/CMakeFiles/smoothModeS-v51.x.dir/all] Error 2
make: *** [all] Error 2
Adding the paths to CPATH and LIBRARY_PATH had no effect.
This method works but seems hard to maintain. What am I missing and what has changed that gfortran/gcc no longer search in the default paths for but libraries and headers/modules?
EDIT
Just found that the standalone executable that uses similar code as the python extension and also uses eccodes has a similar issue. If I do not include INCLUDE_DIRECTORIES(/opt/homebrew/include) in CMakeLists.txt , I get:
cd <project_dir>/buildDebug/src/collocEHS && /opt/homebrew/bin/gfortran -I<project_dir>/buildDebug -I<project_dir>/include -I<project_dir>/src/readASTERIX2 -I<project_dir>/src/geomag70_linux -I<project_dir>/src/libDTG -fallow-argument-mismatch -ffpe-trap=invalid,zero,overflow -DPREC32 -DLINUX -DIS_LITTLE_ENDIAN -DUSEWALLTIME -DHAS_BLAS -DHAS_LAPACK -DGRIB32 -DTIMING -ffixed-line-length-none -g -fcheck=all -Wall -fcheck=bounds -O0 -g -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -c <project_dir>/src/pynwp/readAtmosphereGen.f90 -o CMakeFiles/collocEHSv2.dir/__/pynwp/readAtmosphereGen.f90.o
<project_dir>/src/pynwp/readAtmosphereGen.f90:3:7:
3 | use eccodes
| 1
Fatal Error: Cannot open module file 'eccodes.mod' for reading at (1): No such file or directory
compilation terminated.
make[2]: *** [src/collocEHS/CMakeFiles/collocEHSv2.dir/__/pynwp/readAtmosphereGen.f90.o] Error 1
make[1]: *** [src/collocEHS/CMakeFiles/collocEHSv2.dir/all] Error 2
make: *** [all] Error 2
So I guess the problem is unrelated to python but more with gcc/gfortran (gcc version 11.2.0 (Homebrew GCC 11.2.0_3).
EDIT 2
A reboot of the laptop fixed the issue with the python extension build and setup.py requiring additional directories. For normal builds using CMake, I still require the extra INCLUDE_DIRECTORIES and LINK_DIRECTORIES order for gcc/gfortran to find libraries installed by brew in /opt/homebrew (or /usr/local for intel MacBook).
As per homebrew devs, this is desired behaviour: /opt/homebrew and /usr/local are "special" directories to be manually added in e.g., CMake projects. This is explained in my bug report on home-brew's GitHub, see https://github.com/Homebrew/homebrew-core/issues/95561.
I haven't been able to confirm this with documentation.

macOS 10.12 brew install openssl issue

Trying to install openssl on homebrew using:
brew install openssl
Is giving the following error during make:
clang -I. -Iinclude -fPIC -arch x86_64 -O3 -Wall -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/etc/openssl#1.1\"" -DENGINESDIR="\"/usr/local/Cellar/openssl#1.1/1.1.1l/lib/engines-1.1\"" -D_REENTRANT -DNDEBUG -MMD -MF crypto/rand/randfile.d.tmp -MT crypto/rand/randfile.o -c -o crypto/rand/randfile.o crypto/rand/randfile.c
In file included from crypto/rand/rand_unix.c:38:
/usr/include/CommonCrypto/CommonRandom.h:35:9: error: unknown type name 'CCCryptorStatus'
typedef CCCryptorStatus CCRNGStatus;
^
crypto/rand/rand_unix.c:385:47: error: use of undeclared identifier 'kCCSuccess'
if (CCRandomGenerateBytes(buf, buflen) == kCCSuccess)
^
2 errors generated.
make[1]: *** [crypto/rand/rand_unix.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [all] Error 2
Do not report this issue to Homebrew/brew or Homebrew/core!
Brew is trying to install openssl 1.1.1l:
==> Downloading https://www.openssl.org/source/openssl-1.1.1l.tar.gz
Already downloaded: /Users/user/Library/Caches/Homebrew/downloads/b6ccc5a2a602c2af3480bbcf1656bd9844595974ba60501871ac12504508e818--openssl-1.1.1l.tar.gz
I need this dependency to install many other applications/tools, e.g., wget or python - and would like to use homebrew to do this.
The brew version I am using is:
Homebrew 3.2.9
Homebrew/homebrew-core (git revision fa395c6627; last commit 2021-08-27)
Homebrew/homebrew-cask (git revision 606ed52390; last commit 2021-08-27)
macOS is: 10.12.6 (Sierra) and I am using a MacBook Pro (13-inch, Early 2011)
Is there any way I can get around this issue to install openssl? Or anyway I can install python specifying a different openssl to use as a dependency?
I was able to install openssl 1.0 using the following brew command:
brew install rbenv/tap/openssl#1.0
However, python continually tries to use openssl 1.1.1l which is failing with the above error.
I managed to resolve it by editing formula (brew edit openssl)
and adding
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
to args array in configure_args.
As below:
def configure_args
args = %W[
--prefix=#{prefix}
--openssldir=#{openssldir}
no-ssl3
no-ssl3-method
no-zlib
##### add the line here ####
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
]
on_linux do
args += (ENV.cflags || "").split
args += (ENV.cppflags || "").split
args += (ENV.ldflags || "").split
args << "enable-md2"
end
args
end
I had to change the following file on Sierra (MacOs 10.12):
sudo chmod a+w /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/CommonCrypto/CommonRandom.h
vi /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/CommonCrypto/CommonRandom.h
I've added the following line before the typedef statement:
#include "CommonCrypto/CommonCryptoError.h"
And also followed the advice of #Hulkur - run command:
brew edit openssl
and added
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
to args array in configure_args.
Seems a bug of openssl itself. https://github.com/openssl/openssl/issues/16487
~~What about export SDKROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk "?~~
Homebrew pre-build packages for some versions of macOS. But it keep dropping this pre-building support for old macOS. On macOS 10.12, you're building openssl from the source code and Xcode command line tool is needed.
xcode-select --install
Then brew install openssl again.
I had the same issue in Mac Sierra 10.13.6 (17G14042)
brew install openssl#1.1
I have updated the openssl
brew edit openssl
add the line inside def configure_args
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
def configure_args
args = %W[
--prefix=#{prefix}
--openssldir=#{openssldir}
no-ssl3
no-ssl3-method
no-zlib
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
]
Run the below comment after this.
RUBY_CONFIGURE_OPTS="--disable-install-doc --with-openssl-dir=$(brew --prefix openssl#1.1)" rbenv install 3.0.2
First, to edit the file:
$ export EDITOR=nano
$ export VISUAL="$EDITOR"
then
brew edit openssl
After file open add the line
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
# help debug inevitable breakage.
def configure_args
args = %W[
--prefix=#{prefix}
--openssldir=#{openssldir}
no-ssl3
no-ssl3-method
no-zlib
-I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
]
on_linux do
args += (ENV.cflags || "").split
args += (ENV.cppflags || "").split
args += (ENV.ldflags || "").split
args << "enable-md2"
end
args
end
Save edition and install
brew install openssl
Notice: the installation took a long time, but it's worked.
After brew edit openssl, I end up with a new error:
=> perl ./Configure --prefix=/usr/local/Cellar/openssl#1.1/1.1.1l --openssldir=/usr/local/etc/openssl#1.1 no-ssl3 no-ssl3-method no-zlib -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include darwin64-x86_64-cc enable-ec_nistp_64_gcc_128
==> make
Last 15 lines from /Users/francis/Library/Logs/Homebrew/openssl#1.1/02.make:
include "CommonCrypto/CommonCryptoError.h"
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/CommonCrypto/CommonRandom.h:35:9: error: expected identifier or '('
include "CommonCrypto/CommonCryptoError.h"
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/CommonCrypto/CommonRandom.h:52:1: error: unknown type name 'CCRNGStatus'
CCRNGStatus CCRandomGenerateBytes(void *bytes, size_t count)
^
crypto/rand/rand_unix.c:385:47: error: use of undeclared identifier 'kCCSuccess'
if (CCRandomGenerateBytes(buf, buflen) == kCCSuccess)
^
4 errors generated.
make[1]: *** [crypto/rand/rand_unix.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [all] Error 2
Edit
Silly me, I had:
include "CommonCrypto/CommonCryptoError.h"
Instead of
#include "CommonCrypto/CommonCryptoError.h"
So make sure you have a hash first.
This issue has now been resolved (since 9/11/2021) and patches are no longer required
For MacOS prior to 10.12 (e.g. 10.11 El Capitan) there is another issue - test failure:
Test Summary Report
-------------------
../test/recipes/05-test_rand.t (Wstat: 256 Tests: 2 Failed: 1)
Failed test: 1
Non-zero exit status: 1
Files=1, Tests=2, 5 wallclock secs ( 0.38 usr 0.06 sys + 5.71 cusr 2.48 csys = 8.63 CPU)
Result: FAIL
make[1]: *** [_tests] Error 1
make: *** [tests] Error 2
There is an issue and a pull request for OpenSSL that is open to fix this:
https://github.com/openssl/openssl/issues/16517
https://github.com/openssl/openssl/pull/16587
If you have this issue go over and vote for them

Getting a compiler error when trying to pip install a module

I am trying to install the eif module using pip install eif but I am getting the following error messaage:
Building wheel for eif (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\Manesh Halai\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\MANESH~1\\AppData\\Local\\Temp\\pip-install-zhaj3f4q\\eif\\setup.py'"'"'; __file__='"'"'C:\\Users\\MANESH~1\\AppData\\Local\\Temp\\pip-install-zhaj3f4q\\eif\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\MANESH~1\AppData\Local\Temp\pip-wheel-6drcjrol' --python-tag cp37
cwd: C:\Users\MANESH~1\AppData\Local\Temp\pip-install-zhaj3f4q\eif\
Complete output (60 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
copying eif_old.py -> build\lib.win-amd64-3.7
copying version.py -> build\lib.win-amd64-3.7
running egg_info
writing eif.egg-info\PKG-INFO
writing dependency_links to eif.egg-info\dependency_links.txt
writing requirements to eif.egg-info\requires.txt
writing top-level names to eif.egg-info\top_level.txt
reading manifest file 'eif.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'eif.egg-info\SOURCES.txt'
running build_ext
cythoning _eif.pyx to _eif.cpp
building 'eif' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
C:\Users\Manesh Halai\Anaconda3\Library\mingw-w64\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 "-IC:\Users\Manesh Halai\Anaconda3\lib\site-packages\numpy\core\include" "-IC:\Users\Manesh Halai\Anaconda3\include" "-IC:\Users\Manesh Halai\Anaconda3\include" -c _eif.cpp -o build\temp.win-amd64-3.7\Release\_eif.o -Wcpp
In file included from C:/Users/Manesh Halai/Anaconda3/Library/mingw-w64/include/c++/5.3.0/random:35:0,
from eif.hxx:5,
from _eif.cpp:614:
C:/Users/Manesh Halai/Anaconda3/Library/mingw-w64/include/c++/5.3.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the \
^
In file included from C:\Users\Manesh Halai\Anaconda3\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:1824:0,
from C:\Users\Manesh Halai\Anaconda3\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:12,
from C:\Users\Manesh Halai\Anaconda3\lib\site-packages\numpy\core\include/numpy/arrayobject.h:4,
from _eif.cpp:612:
C:\Users\Manesh Halai\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_1_7_deprecated_api.h:15:77: note: #pragma message: C:\Users\Manesh Halai\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION")
^
In file included from _eif.cpp:614:0:
eif.hxx:11:28: error: 'std::mt19937_64' has not been declared
#define RANDOM_ENGINE std::mt19937_64
^
eif.hxx:65:55: note: in expansion of macro 'RANDOM_ENGINE'
void build_tree (double*, int, int, int, int, RANDOM_ENGINE&, int);
^
eif.hxx:11:28: error: 'std::mt19937_64' has not been declared
#define RANDOM_ENGINE std::mt19937_64
^
eif.hxx:66:44: note: in expansion of macro 'RANDOM_ENGINE'
Node* add_node (double*, int, int, RANDOM_ENGINE&);
^
eif.hxx:11:28: error: 'std::mt19937_64' has not been declared
#define RANDOM_ENGINE std::mt19937_64
^
eif.hxx:132:63: note: in expansion of macro 'RANDOM_ENGINE'
inline std::vector<int> sample_without_replacement (int, int, RANDOM_ENGINE&);
^
_eif.cpp: In function 'PyTypeObject* __Pyx_ImportType(PyObject*, const char*, const char*, size_t, __Pyx_ImportType_CheckSize)':
_eif.cpp:8085:53: warning: unknown conversion type character 'z' in format [-Wformat=]
module_name, class_name, size, basicsize);
^
_eif.cpp:8085:53: warning: unknown conversion type character 'z' in format [-Wformat=]
_eif.cpp:8085:53: warning: too many arguments for format [-Wformat-extra-args]
error: command 'C:\\Users\\Manesh Halai\\Anaconda3\\Library\\mingw-w64\\bin\\gcc.exe' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for eif
Running setup.py clean for eif
Failed to build eif
Installing collected packages: eif
Running setup.py install for eif ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\Manesh Halai\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\MANESH~1\\AppData\\Local\\Temp\\pip-install-zhaj3f4q\\eif\\setup.py'"'"'; __file__='"'"'C:\\Users\\MANESH~1\\AppData\\Local\\Temp\\pip-install-zhaj3f4q\\eif\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\MANESH~1\AppData\Local\Temp\pip-record-buit0qa2\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\MANESH~1\AppData\Local\Temp\pip-install-zhaj3f4q\eif\
Complete output (60 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
copying eif_old.py -> build\lib.win-amd64-3.7
copying version.py -> build\lib.win-amd64-3.7
running egg_info
writing eif.egg-info\PKG-INFO
writing dependency_links to eif.egg-info\dependency_links.txt
writing requirements to eif.egg-info\requires.txt
writing top-level names to eif.egg-info\top_level.txt
reading manifest file 'eif.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'eif.egg-info\SOURCES.txt'
running build_ext
skipping '_eif.cpp' Cython extension (up-to-date)
building 'eif' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
C:\Users\Manesh Halai\Anaconda3\Library\mingw-w64\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 "-IC:\Users\Manesh Halai\Anaconda3\lib\site-packages\numpy\core\include" "-IC:\Users\Manesh Halai\Anaconda3\include" "-IC:\Users\Manesh Halai\Anaconda3\include" -c _eif.cpp -o build\temp.win-amd64-3.7\Release\_eif.o -Wcpp
In file included from C:/Users/Manesh Halai/Anaconda3/Library/mingw-w64/include/c++/5.3.0/random:35:0,
from eif.hxx:5,
from _eif.cpp:614:
C:/Users/Manesh Halai/Anaconda3/Library/mingw-w64/include/c++/5.3.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the \
^
In file included from C:\Users\Manesh Halai\Anaconda3\lib\site-packages\numpy\core\include/numpy/ndarraytypes.h:1824:0,
from C:\Users\Manesh Halai\Anaconda3\lib\site-packages\numpy\core\include/numpy/ndarrayobject.h:12,
from C:\Users\Manesh Halai\Anaconda3\lib\site-packages\numpy\core\include/numpy/arrayobject.h:4,
from _eif.cpp:612:
C:\Users\Manesh Halai\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_1_7_deprecated_api.h:15:77: note: #pragma message: C:\Users\Manesh Halai\Anaconda3\lib\site-packages\numpy\core\include/numpy/npy_1_7_deprecated_api.h(14) : Warning Msg: Using deprecated NumPy API, disable it with #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION")
^
In file included from _eif.cpp:614:0:
eif.hxx:11:28: error: 'std::mt19937_64' has not been declared
#define RANDOM_ENGINE std::mt19937_64
^
eif.hxx:65:55: note: in expansion of macro 'RANDOM_ENGINE'
void build_tree (double*, int, int, int, int, RANDOM_ENGINE&, int);
^
eif.hxx:11:28: error: 'std::mt19937_64' has not been declared
#define RANDOM_ENGINE std::mt19937_64
^
eif.hxx:66:44: note: in expansion of macro 'RANDOM_ENGINE'
Node* add_node (double*, int, int, RANDOM_ENGINE&);
^
eif.hxx:11:28: error: 'std::mt19937_64' has not been declared
#define RANDOM_ENGINE std::mt19937_64
^
eif.hxx:132:63: note: in expansion of macro 'RANDOM_ENGINE'
inline std::vector<int> sample_without_replacement (int, int, RANDOM_ENGINE&);
^
_eif.cpp: In function 'PyTypeObject* __Pyx_ImportType(PyObject*, const char*, const char*, size_t, __Pyx_ImportType_CheckSize)':
_eif.cpp:8085:53: warning: unknown conversion type character 'z' in format [-Wformat=]
module_name, class_name, size, basicsize);
^
_eif.cpp:8085:53: warning: unknown conversion type character 'z' in format [-Wformat=]
_eif.cpp:8085:53: warning: too many arguments for format [-Wformat-extra-args]
error: command 'C:\\Users\\Manesh Halai\\Anaconda3\\Library\\mingw-w64\\bin\\gcc.exe' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\Manesh Halai\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\MANESH~1\\AppData\\Local\\Temp\\pip-install-zhaj3f4q\\eif\\setup.py'"'"'; __file__='"'"'C:\\Users\\MANESH~1\\AppData\\Local\\Temp\\pip-install-zhaj3f4q\\eif\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\MANESH~1\AppData\Local\Temp\pip-record-buit0qa2\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
I have attempted so search for similar issues but I haven't found anything yet that relates fully to my issue. So far I have tried updateing my windows, updating the visual basic compiler, following the instructions on this link (https://github.com/m-byte918/AgarOSS/issues/8), installing from the github repo and updating prequisite python packages with no luck so far. Any and all help/ideas is much appreciated!
It is trying to compile C++ code. Your compiler (gcc 5.3.0) is too old, as the error message implies:
This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
Updating the visual basic compiler won't fix that, you need a newer gcc version.
(Technically you might also get away with squeezing the -std=c++11 flag into that whole process somehow, but I'd say updating gcc is going to be easier.)

autoconf: command not found Installing Cappuccino (Objective J)

I'm trying to install cappuccino. When I ran "./bootstrap.sh"
I'm getting this error:
Would you like to build the JavaScriptCore engine? This is optional but will
make building and running Cappuccino and Objective-J much faster.
Enter "yes" or "no":
yes
./bootstrap.sh: line 362: autoconf: command not found
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'groups'
sh configure
Detected <JavaScriptCore/JavaScript.h>
clang -o lib/libnarwhal.dylib narwhal.c -dynamiclib -0s -force_cpusubtype_ALL -mmacosx-version-min=10.4 -arch i386 -Iinclude -framework JavaScriptCore
clang: error: unknown argument: '-0s' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
make: *** [lib/libnarwhal.dylib] Error 1
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
WARNING: building narwhal-jsc failed. Hit enter to continue.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================================================
Bootstrapping of Cappuccino and other required tools is complete.
NOTE: any changes made to the shell configuration files won't take place until
you restart the shell.
Any of you knows can fix this or if is a work around this?
Use Homebrew to install autoconf... the command should be:
brew install autoconf
You may also need to install the XCode command line utilities for brew to work.
For exact details of how brew installs autoconf see its formula: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/autoconf.rb

ROracle installation fails on R 2.15.1 using Rtools 2.15

I'm trying to compile the ROracle package version 1.1-4 under Windows using R 2.15.1 and Rtools 2.15
install.packages('ROracle',type='source')
but it seems that ocimingw.c is missing (see output below). I get the same error message using R CMD INSTALL --build.
edit 2012-09-11: The problem is apparently specific to 1.1-4, as I managed to build and install 1.1-1 normally.
Any idea what the solution might be?
trying URL 'http://stat.ethz.ch/CRAN/src/contrib/ROracle_1.1-4.tar.gz'
Content type 'application/x-gzip' length 156924 bytes (153 Kb)
opened URL
downloaded 153 Kb
* installing *source* package 'ROracle' ...
** package 'ROracle' successfully unpacked and MD5 sums checked
looking for Instant Client c:/instantclient/x64/instantclient_11_2
cygwin warning:
MS-DOS style path detected: C:\instantclient\x64\instantclient_11_2
Preferred POSIX equivalent is: /cygdrive/c/instantclient/x64/instantclient_11_2
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
found Instant Client C:\instantclient\x64\instantclient_11_2
found Instant Client SDK c:/instantclient/x64/instantclient_11_2/sdk/include
generating ocimingw.lib from ocimingw.def
x86_64-w64-mingw32-dlltool: not found
copying from c:/instantclient/x64/instantclient_11_2/sdk/include
** libs
Warning: this package has a non-empty 'configure.win' file,
so building only the main architecture
cygwin warning:
MS-DOS style path detected: C:/R/R-215~1.1/etc/x64/Makeconf
Preferred POSIX equivalent is: /cygdrive/c/R/R-215~1.1/etc/x64/Makeconf
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
gcc -m64 -I"C:/R/R-215~1.1/include" -DNDEBUG -I./oci -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -std=gnu99 -mtune=core2 -c rodbi.c -o rodbi.o
rodbi.c: In function 'rociResExec':
rodbi.c:1169:14: warning: unused variable 'drv' [-Wunused-variable]
rodbi.c: In function 'rociResFetch':
rodbi.c:1187:16: warning: unused variable 'drv' [-Wunused-variable]
rodbi.c: In function 'rociResInfo':
rodbi.c:1256:16: warning: unused variable 'drv' [-Wunused-variable]
rodbi.c: In function 'rociResTerm':
rodbi.c:1323:14: warning: unused variable 'drv' [-Wunused-variable]
rodbi.c: In function 'rodbiCheck':
rodbi.c:2348:25: warning: pointer targets in passing argument 1 of 'snprintf' differ in signedness [-Wpointer-sign]
c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/include/stdio.h:505:15: note: expected 'char * restrict' but argument is of type 'text *'
rodbi.c: In function 'rawToStrhexCall':
rodbi.c:2573:7: warning: pointer targets in passing argument 1 of 'Rf_mkChar' differ in signedness [-Wpointer-sign]
C:/R/R-215~1.1/include/Rinternals.h:628:6: note: expected 'const char *' but argument is of type 'unsigned char *'
rodbi.c:2557:26: warning: unused variable 'seglen' [-Wunused-variable]
rodbi.c: In function 'rociResInit':
rodbi.c:1121:3: warning: 'qry_encoding' may be used uninitialized in this function [-Wuninitialized]
gcc -m64 -I"C:/R/R-215~1.1/include" -DNDEBUG -I./oci -I"d:/RCompile/CRANpkg/extralibs64/local/include" -O2 -Wall -std=gnu99 -mtune=core2 -c rooci.c -o rooci.o
In file included from C:/R/R-215~1.1/include/R.h:44:0,
from rodbi.h:37,
from rooci.c:47:
C:/R/R-215~1.1/include/R_ext/RS.h:43:0: warning: "ERROR" redefined [enabled by default]
c:\rtools\gcc-4.6.3\bin\../lib/gcc/i686-w64-mingw32/4.6.3/../../../../i686-w64-mingw32/include/wingdi.h:70:0: note: this is the location of the previous definition
rooci.c: In function 'roociInitializeRes':
rooci.c:620:32: warning: 'cnvcid' may be used uninitialized in this function [-Wuninitialized]
gcc -m64 -shared -s -static-libgcc -o ROracle.dll tmp.def rodbi.o rooci.o -L. ocimingw.lib -Ld:/RCompile/CRANpkg/extralibs64/local/lib/x64 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/R/R-215~1.1/bin/x64 -lR
gcc.exe: error: ocimingw.lib: No such file or directory
ERROR: compilation failed for package 'ROracle'
* removing 'C:/R/R-2.15.1/library/ROracle'
The problem is apparently specific to 1.1-4, as I managed to build and install 1.1-1 normally. I will wait for the 1.1-5 version before I give it another try. Thanks to all contributors!
ROracle is quite easy to install from source in Windows, try using Linux if you want to using ROracle from source code, here is my install log.
If still perfer windows, you can get a compiled ROracle package from Oracle, it's included in the "Client Supporting Packages".

Resources