I had a hard time trying to install Scipy for scientific calculations, so make a note of the steps to install
Mac OSX Sierra What was installed
I have summarized the work that was finally required. The process of specifically fighting the error goes to the next section
First, download and install gFortran for OS X El Capitan from the GCC Wiki Then execute the command
$ pip install Cython
$ git clone https://github.com/scipy/scipy.git
$ cd scipy
$ sudo python setup.py build
$ sudo python setup.py install
Honestly try to download
$ git clone https://github.com/scipy/scipy.git
$ cd scipy
$ sudo python setup.py build
Cythonizing sources
(Omission)
Exception: Cython either isn't installed or it failed.
Traceback (most recent call last):
File "setup.py", line 415, in <module>
setup_package()
File "setup.py", line 399, in setup_package
generate_cython()
File "setup.py", line 205, in generate_cython
raise RuntimeError("Running cythonize failed!")
RuntimeError: Running cythonize failed!
I was told that there is no Cython, so I decided to add Cython
$ pip install Cython
(Omitted)
Successfully installed Cython-0.25.2
Cython comes in and courageously tries to install Scipy again
$ sudo python setup.py build
(Omitted)
running build_clib
customize UnixCCompiler
customize UnixCCompiler using build_clib
building 'dfftpack' library
error: library dfftpack has Fortran sources but no Fortran compiler found
For a short while, I was angry that I needed a Fortran compiler. Therefore, http://gcc.gnu.org/wiki/GFortranBinaries#MacOS Download and install gFortran for El Capitan from here
I've included gFortran, so I'll retry building Scipy
$ sudo python setup.py build
I was worried about a lot of Warnings being displayed during the build, but the build was completed (it took a long time to build).
Now that you have a build, install it
$ sudo python setup.py install
(Omitted)
Finished processing dependencies for scipy==0.19.0.dev0+1755a9f
I managed to install it!
Finally execution confirmation
$ python
>>> import scipy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "scipy/__init__.py", line 103, in <module>
raise ImportError(msg)
ImportError: Error importing scipy: you cannot import scipy while
being in scipy source directory; please exit the scipy source
tree first, and relaunch your python intepreter.
Rainy day error It seems that he is angry trying to import in the scipy directory, so exit the directory and execute
$ cd..
$ python
>>> import scipy
So that it can be imported safely. Refer to SciPy.org sample and check the execution further just in case.
>>> import numpy as np
>>> from scipy import optimize
>>> np.info(optimize.fmin)
fmin(func, x0, args=(), xtol=0.0001, ftol=0.0001, maxiter=None, maxfun=None,
full_output=0, disp=1, retall=0, callback=None, initial_simplex=None)
It worked without any error! Thank you for your hard work.
Install SciPy on Mac Install numpy, scipy, gensim I was allowed to reference. Thank you very much.
Recommended Posts