pyFFTW installation into Enthought Canopy - enthought

I am trying to install PyFFTW into Enthought Canopy
I'm on a Mac running Mavericks
The initial command and output are below
the problem seems to be with it finding fftw3.h and gcc failing right after that
can anyone help?
Thanks
Canopy 64bit) iz9mbpro:User iz9$ pip install pyfftw
Downloading/unpacking pyfftw
Downloading pyFFTW-0.9.2.tar.gz (336kB): 336kB downloaded
Running setup.py (path:/Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw/setup.py) egg_info for package pyfftw
Installing collected packages: pyfftw
Running setup.py install for pyfftw
skipping '/Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw/pyfftw/pyfftw.c' Cython extension (up-to-date)
building 'pyfftw.pyfftw' extension
gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -DNDEBUG -g -O3 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -I/Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw/include -I/Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw/pyfftw -I/Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/numpy/core/include -I/Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents/include/python2.7 -I/Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw/include -I/Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw/pyfftw -I/Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/numpy/core/include -I/Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents/include/python2.7 -c /Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw/pyfftw/pyfftw.c -o build/temp.macosx-10.6-x86_64-2.7/Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw/pyfftw/pyfftw.o
In file included from /Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw/pyfftw/pyfftw.c:256:
In file included from /Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
In file included from /Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17:
In file included from /Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1760:
/Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
#warning "Using deprecated NumPy API, disable it by " \
^
/Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw/pyfftw/pyfftw.c:260:10: fatal error: 'fftw3.h' file not found
#include "fftw3.h"
^
1 warning and 1 error generated.
error: command 'gcc' failed with exit status 1
Complete output from command /Users/iz9/Library/Enthought/Canopy_64bit/User/bin/python -c "import setuptools, tokenize;file='/Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /var/folders/sc/wm52xk5528b2m95ztnh15clj5lkhmb/T/pip-29rHyR-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/iz9/Library/Enthought/Canopy_64bit/User/include/site/python2.7:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.6-x86_64-2.7
creating build/lib.macosx-10.6-x86_64-2.7/pyfftw
copying pyfftw/init.py -> build/lib.macosx-10.6-x86_64-2.7/pyfftw
copying pyfftw/_version.py -> build/lib.macosx-10.6-x86_64-2.7/pyfftw
copying pyfftw/np_fft.py -> build/lib.macosx-10.6-x86_64-2.7/pyfftw
creating build/lib.macosx-10.6-x86_64-2.7/pyfftw/builders
copying pyfftw/builders/init.py -> build/lib.macosx-10.6-x86_64-2.7/pyfftw/builders
copying pyfftw/builders/_utils.py -> build/lib.macosx-10.6-x86_64-2.7/pyfftw/builders
copying pyfftw/builders/builders.py -> build/lib.macosx-10.6-x86_64-2.7/pyfftw/builders
creating build/lib.macosx-10.6-x86_64-2.7/pyfftw/interfaces
copying pyfftw/interfaces/init.py -> build/lib.macosx-10.6-x86_64-2.7/pyfftw/interfaces
copying pyfftw/interfaces/_utils.py -> build/lib.macosx-10.6-x86_64-2.7/pyfftw/interfaces
copying pyfftw/interfaces/cache.py -> build/lib.macosx-10.6-x86_64-2.7/pyfftw/interfaces
copying pyfftw/interfaces/numpy_fft.py -> build/lib.macosx-10.6-x86_64-2.7/pyfftw/interfaces
copying pyfftw/interfaces/scipy_fftpack.py -> build/lib.macosx-10.6-x86_64-2.7/pyfftw/interfaces
running build_ext
skipping '/Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw/pyfftw/pyfftw.c' Cython extension (up-to-date)
building 'pyfftw.pyfftw' extension
creating build/temp.macosx-10.6-x86_64-2.7
creating build/temp.macosx-10.6-x86_64-2.7/Users
creating build/temp.macosx-10.6-x86_64-2.7/Users/iz9
creating build/temp.macosx-10.6-x86_64-2.7/Users/iz9/Library
creating build/temp.macosx-10.6-x86_64-2.7/Users/iz9/Library/Enthought
creating build/temp.macosx-10.6-x86_64-2.7/Users/iz9/Library/Enthought/Canopy_64bit
creating build/temp.macosx-10.6-x86_64-2.7/Users/iz9/Library/Enthought/Canopy_64bit/User
creating build/temp.macosx-10.6-x86_64-2.7/Users/iz9/Library/Enthought/Canopy_64bit/User/build
creating build/temp.macosx-10.6-x86_64-2.7/Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw
creating build/temp.macosx-10.6-x86_64-2.7/Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw/pyfftw
gcc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -DNDEBUG -g -O3 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -I/Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw/include -I/Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw/pyfftw -I/Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/numpy/core/include -I/Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents/include/python2.7 -I/Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw/include -I/Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw/pyfftw -I/Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/numpy/core/include -I/Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents/include/python2.7 -c /Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw/pyfftw/pyfftw.c -o build/temp.macosx-10.6-x86_64-2.7/Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw/pyfftw/pyfftw.o
In file included from /Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw/pyfftw/pyfftw.c:256:
In file included from /Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/numpy/core/include/numpy/arrayobject.h:4:
In file included from /Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:17:
In file included from /Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1760:
/Applications/Canopy.app/appdata/canopy-1.4.1.1975.macosx-x86_64/Canopy.app/Contents/lib/python2.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-W#warnings]
warning "Using deprecated NumPy API, disable it by " \
^
/Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw/pyfftw/pyfftw.c:260:10: fatal error: 'fftw3.h' file not found
include "fftw3.h"
^
1 warning and 1 error generated.
error: command 'gcc' failed with exit status 1
Cleaning up...
Command /Users/iz9/Library/Enthought/Canopy_64bit/User/bin/python -c "import setuptools, tokenize;file='/Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /var/folders/sc/wm52xk5528b2m95ztnh15clj5lkhmb/T/pip-29rHyR-record/install-record.txt --single-version-externally-managed --compile --install-headers /Users/iz9/Library/Enthought/Canopy_64bit/User/include/site/python2.7 failed with error code 1 in /Users/iz9/Library/Enthought/Canopy_64bit/User/build/pyfftw
Storing debug log for failure in /Users/iz9/.pip/pip.log

From the PyPi page: "Under linux, to build from source, the FFTW library must be installed already. This should probably work for OSX, though I've not tried it."
There are build instructions for FFTW on Mac at this page.

Related

Scipy build fail on MacOS because LLVM producer != reader

I'm trying to build Scipy from source. However, a linking step...
/usr/bin/clang -bundle -undefined dynamic_lookup -L/Users/gwg/miniconda3/envs/scipy-dev/lib -arch x86_64 -L/Users/gwg/miniconda3/envs/scipy-dev/lib -arch x86_64 -L/usr/local/opt/libomp/lib -lomp -I/usr/local/opt/libomp/include -Xpreprocessor -fopenmp -arch x86_64 build/temp.macosx-10.9-x86_64-3.7/scipy/spatial/src/distance_wrap.o -L/Users/gwg/miniconda3/envs/scipy-dev/lib/python3.7/site-packages/numpy/core/lib -Lbuild/temp.macosx-10.9-x86_64-3.7 -lnpymath -o build/lib.macosx-10.9-x86_64-3.7/scipy/spatial/_distance_wrap.cpython-37m-darwin.so
...fails, and I get the following error:
ld: in /Users/gwg/miniconda3/envs/scipy-dev/lib/python3.7/site-packages/numpy/core/lib/libnpymath.a(npy_math.o), could not parse object file /Users/gwg/miniconda3/envs/scipy-dev/lib/python3.7/site-packages/numpy/core/lib/libnpymath.a(npy_math.o): 'Unknown attribute kind (61) (Producer: 'LLVM10.0.0' Reader: 'LLVM APPLE_1_1000.10.44.4_0')', using libLTO version 'LLVM version 10.0.0, (clang-1000.10.44.4)' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I suspect it is due to the Producer: 'LLVM10.0.0' Reader: 'LLVM APPLE_1_1000.10.44.4_0' mismatch. But I don't know how to investigate this error.
Some details:
MacOS: High Sierra, 10.13.6
gcc --version:
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
clang --version:
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
I had the same issue. The suggestions here to use the conda compilers resolved the issue for me:
conda create -n scipy-dev
conda activate scipy-dev
conda config --env --add channels conda-forge
conda install numpy cython pybind11 pytest compilers openblas
python setup.py develop
It seems you're using different clang (judging from the paths like /usr/local/opt/libomp/lib). Likely the one provided by conda. In order to perform build with LTO you need to use the compatible toolchain (e.g. build everything with Apple-provided toolchain or with conda-provided one).

How to install poppler correctly for pdftotext

When I try to build my docker-compose pdftotext seems to fail with this error:
Running setup.py install for pdftotext: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ihm5qxa9/pdftotext/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ihm5qxa9/pdftotext/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-record-wa_n7pgk/install-record.txt --single-version-externally-managed --compile
cwd: /tmp/pip-install-ihm5qxa9/pdftotext/
Complete output (14 lines):
WARNING: pkg-config not found--guessing at poppler version.
If the build fails, install pkg-config and try again.
running install
running build
running build_ext
building 'pdftotext' extension
creating build
creating build/temp.linux-x86_64-3.6
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPOPPLER_CPP_AT_LEAST_0_30_0=1 -I/usr/local/include/python3.6m -c pdftotext.cpp -o build/temp.linux-x86_64-3.6/pdftotext.o -Wall
pdftotext.cpp:3:10: fatal error: poppler/cpp/poppler-document.h: No such file or directory
#include <poppler/cpp/poppler-document.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
I've tested this on windows and linux with the same error. Has anyone found a fix for this?
Unfortunately, it is hard to help without knowing the content of your docker-compose/Dockerfile. But as mentioned in the error message, you are missing pkg-config. You should try to run apt-get install pkg-config.
You can also check my answer about how to use the latest version of the Poppler in the Docker.

"python3 setup.py sdist" hangs

I am packaging up a python package, but the command
python3 setup.py sdist
is hanging.
Previously this worked without any problems, but now it hangs while doing:
/usr/bin/gfortran -Wall -g -Wall -g -shared /tmp/tmpm0rbalgy/tmp/tmpm0rbalgy/src.linux-x86_64-3.6/_tortmodule.o /tmp/tmpm0rbalgy/tmp/tmpm0rbalgy/src.linux-x86_64-3.6/fortranobject.o /tmp/tmpm0rbalgy/f90wrap_tort.o tort.o -L/usr/lib/gcc/x86_64-linux-gnu/7 -L/usr/lib/gcc/x86_64-linux-gnu/7 -lgomp -lgfortran -o ./_tort.cpython-36m-x86_64-linux-gnu.so
Removing build directory /tmp/tmpm0rbalgy
The build directory has certainly been removed, so I'm not sure why it is getting stuck here.

How to install ruamel.yaml w/o native extension

I'd like to install ruamel.yaml on an environment which does not have a compiler, and I do not care about the performances.
What is the proper way to install ruamel.yaml w/o pip trying to build the extension and failing to execute the C compiler which is not installed?
I ran
pip3 install ruamel.yaml
which failed with
building '_ruamel_yaml' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/ext
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python3.6m -c ext/_ruamel_yaml.c -o build/temp.linux-x86_64-3.6/ext/_ruamel_yaml.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-myos8iv1/ruamel.yaml/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-record-vuvr4aoi/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-myos8iv1/ruamel.yaml/
Testing if compilation worked and skipping compiling the C extensions if it didn't, was removed from ruamel.yaml when it was no longer dependent on libyaml being available.
That of course doens't mean that the C compiler is available, so this should be considered a regression. In ruamel.yaml>=0.15.41 this should be fixed.

sslscan.c:94:25: fatal error: openssl/err.h: No such file or directory compilation terminated. #163

I am need to install sslscan tool for ssl scanning (from here) in ubuntu virtual machine (virtualbox).
Following their installation instructions provided here, I installed openssl-chacha from here. Note that I am aware that this fork of openssl contains weak cipehrs (I use the tool and openssl for testing-scanning purposes not real application).
Then, after installing the above openssl, the first thing I did is executing: make. Note that it is unclear to me when to use these commands that he sslscan mentioned here (I did not execute them). But I want to use the chacha version of openssl:
apt-get install build-essential git zlib1g-dev
apt-get build-dep openssl
make static
When I try to run the command: make I get this error:
make: git: Command not found
cc -o sslscan -Wall -Wformat=2 -Wformat-security -pie -z relro -z now -L/usr/local/lib -L/usr/local/ssl/lib -L/usr/local/opt/openssl/lib -L/opt/local/lib -D_FORTIFY_SOURCE=2 -fstack-protector-all -fPIE -I/usr/local/include -I/usr/local/ssl/include -I/usr/local/ssl/include/openssl -I/usr/local/opt/openssl/include -I/opt/local/include -I/opt/local/include/openssl -DVERSION=\"1.11.11\" sslscan.c -lssl -lcrypto -ldl
/usr/bin/ld: /usr/local/ssl/lib/libssl.a(s2_clnt.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/ssl/lib/libssl.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:91: recipe for target 'sslscan' failed
make: *** [sslscan] Error 1
I am in this directory: /home/myuser/Downloads/sslscan-master
I made sure that openssl in:
/usr/local/ssl
Can you please point to me what is missing? I am not familiar with Linux system (Windows user) but I prefer to use the tool in Linux. So I will appreciate your help and patience.
make: git: Command not found
So start by installing the git command:
apt-get install git
(or maybe git-core)