web-dev-qa-db-fra.com

Impossible d'installer scipy en raison de l'absence du compilateur fortran après l'installation de gcc sur Mac OS X

J'ai lu et suivi cette réponse pour installer scipy/numpy/theano. Cependant, il a toujours échoué sur la même erreur de compilateur Fortran manquant après l'installation de gcc. Bien que HomeBrew ait installé le gcc-4.8, il n'a installé aucune commande gfortran ou g95. Je pense que gfortran peut être juste un synonymy de gcc, puis je crée un lien symbolique

$ cd /usr/local/bin
$ ln -s gcc-4.8 gfortran
$ pip install scipy

Ensuite, il détecte la commande gfortran mais ne se plaint toujours pas du compilateur Fortran

customize Gnu95FCompiler
Found executable /usr/local/bin/gfortran
customize NAGFCompiler
Could not locate executable f95
customize AbsoftFCompiler
Could not locate executable f90
Could not locate executable f77
customize IBMFCompiler
Could not locate executable xlf90
Could not locate executable xlf
customize IntelFCompiler
Could not locate executable ifort
Could not locate executable ifc
customize GnuFCompiler
Could not locate executable g77
customize G95FCompiler
Could not locate executable g95
customize PGroupFCompiler
Could not locate executable pgfortran
don't know how to compile Fortran code on platform 'posix'
building 'dfftpack' library
error: library dfftpack has Fortran sources but no Fortran compiler found

Que dois-je faire d'autre?

34
teddy

Résolu par la mise à niveau de pip, même si je viens d'installer à nouveau mon pip/virtualenv le même jour.

(mypy)MAC0227: $ pip install --upgrade pip
...
(mypy)MAC0227: $ pip install theano
/Users/me/.virtualenvs/mypy/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Requirement already satisfied (use --upgrade to upgrade): theano in /Users/me/.virtualenvs/mypy/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.6.2 in /Users/me/.virtualenvs/mypy/lib/python2.7/site-packages (from theano)
Collecting scipy>=0.11 (from theano)
/Users/me/.virtualenvs/mypy/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading scipy-0.15.1-cp27-none-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (19.8MB)
    100% |████████████████████████████████| 19.8MB 23kB/s
Installing collected packages: scipy
Successfully installed scipy-0.15.1
37
teddy

Ce qui suit a fonctionné pour moi:

Sudo apt-get install gfortran

sur mon système:

Ubuntu 15.10 (Linux 4.2.0-19-générique # 23-Ubuntu x86_64 x86_64 x86_64 GNU/Linux)

26
Patricio Astudillo

Cela dépend de la version de gcc. Vérifiez votre version gcc:

Depends: gcc-4.8-base (= 4.8.2-19ubuntu1) but 4.8.4-2ubuntu1~14.04 is to be installed

Mettez à jour votre version de gcc: http://ubuntuhandbook.org/index.php/2013/08/install-gcc-4-8-via-ppa-in-ubuntu-12-04-13-04/

0
Manoj Sahu