pip error: no Fortran compiler found, but compiler already present
I'm trying to install an external library for PyAstronomy using pip:
pip install PyAstronomy_ext
I do this via Anaconda command prompt.
The first time I ran the command the following errors appeared:
building 'PyAstronomy_ext.forTrans.occultnl' extension
error: extension 'PyAstronomy_ext.forTrans.occultnl' has Fortran sources but no Fortran compiler found
----------------------------------------
Failed building wheel for PyAstronomy-ext
and
Command "c:usersmatteanaconda3python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\matte\AppData\Local\Temp\pip-install-5pkiwi34\PyAstronomy-ext\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersmatteAppDataLocalTemppip-record-bok3jklvinstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:UsersmatteAppDataLocalTemppip-install-5pkiwi34PyAstronomy-ext
So I checked on the internet and found this topic.
I installed MinGW and downloaded all the Fortran related packages, and to be sure I also wrote a test script and compiled it using gFortran, and it worked fine.
When I tried to run the installation again the same errors popped up.
The answer also mentions this:
After the installation, add the path to its binary to the system PATH.
but I can't understand what it means, I tried running the installation command from C:MinGWbin
but the same error occur.
If you need the whole console dialogue that contains the errors:
Collecting PyAstronomy_ext
Using cached https://files.pythonhosted.org/packages/32/11/27b1fee690d7d5801580da2c25145a6fcce3ad3d0a1b8c41de09d5615825/PyAstronomy_ext-1.tar.gz
Requirement already satisfied: numpy in c:usersmatteanaconda3libsite-packages (from PyAstronomy_ext) (1.16.0)
Requirement already satisfied: six in c:usersmatteanaconda3libsite-packages (from PyAstronomy_ext) (1.11.0)
Building wheels for collected packages: PyAstronomy-ext
Building wheel for PyAstronomy-ext (setup.py) ... error
Complete output from command c:usersmatteanaconda3python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\matte\AppData\Local\Temp\pip-install-cg99ug7_\PyAstronomy-ext\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:UsersmatteAppDataLocalTemppip-wheel-0gj25_97 --python-tag cp36:
running bdist_wheel
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "PyAstronomy_ext.forTrans.occultnl" sources
f2py options:
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTransfortranobject.c' to sources.
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTrans' to include_dirs.
building extension "PyAstronomy_ext.forTrans.occultquad" sources
f2py options:
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTransfortranobject.c' to sources.
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTrans' to include_dirs.
adding 'buildsrc.win-amd64-3.6PyAstronomy_extforTransoccultquad-f2pywrappers.f' to sources.
build_src: building npy-pkg config files
running build_py
creating buildlib.win-amd64-3.6
creating buildlib.win-amd64-3.6PyAstronomy_ext
copying PyAstronomy_ext__init__.py -> buildlib.win-amd64-3.6PyAstronomy_ext
creating buildlib.win-amd64-3.6PyAstronomy_extforTrans
copying PyAstronomy_extforTrans__init__.py -> buildlib.win-amd64-3.6PyAstronomy_extforTrans
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
customize MSVCCompiler using build_ext
get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
customize AbsoftFCompiler
Could not locate executable f90
customize CompaqVisualFCompiler
Could not locate executable DF
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Could not locate executable gfortran
Could not locate executable f95
customize G95FCompiler
Could not locate executable g95
customize IntelEM64VisualFCompiler
customize IntelEM64TFCompiler
Could not locate executable efort
Could not locate executable efc
customize PGroupFlangCompiler
Could not locate executable flang
don't know how to compile Fortran code on platform 'nt'
warning: build_ext: f77_compiler=None is not available.
building 'PyAstronomy_ext.forTrans.occultnl' extension
error: extension 'PyAstronomy_ext.forTrans.occultnl' has Fortran sources but no Fortran compiler found
----------------------------------------
Failed building wheel for PyAstronomy-ext
Running setup.py clean for PyAstronomy-ext
Failed to build PyAstronomy-ext
Installing collected packages: PyAstronomy-ext
Running setup.py install for PyAstronomy-ext ... error
Complete output from command c:usersmatteanaconda3python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\matte\AppData\Local\Temp\pip-install-cg99ug7_\PyAstronomy-ext\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersmatteAppDataLocalTemppip-record-5q39xvkiinstall-record.txt --single-version-externally-managed --compile:
running install
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "PyAstronomy_ext.forTrans.occultnl" sources
f2py options:
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTransfortranobject.c' to sources.
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTrans' to include_dirs.
building extension "PyAstronomy_ext.forTrans.occultquad" sources
f2py options:
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTransfortranobject.c' to sources.
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTrans' to include_dirs.
adding 'buildsrc.win-amd64-3.6PyAstronomy_extforTransoccultquad-f2pywrappers.f' to sources.
build_src: building npy-pkg config files
running build_py
creating buildlib.win-amd64-3.6
creating buildlib.win-amd64-3.6PyAstronomy_ext
copying PyAstronomy_ext__init__.py -> buildlib.win-amd64-3.6PyAstronomy_ext
creating buildlib.win-amd64-3.6PyAstronomy_extforTrans
copying PyAstronomy_extforTrans__init__.py -> buildlib.win-amd64-3.6PyAstronomy_extforTrans
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
customize MSVCCompiler using build_ext
get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
customize AbsoftFCompiler
Could not locate executable f90
customize CompaqVisualFCompiler
Could not locate executable DF
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Could not locate executable gfortran
Could not locate executable f95
customize G95FCompiler
Could not locate executable g95
customize IntelEM64VisualFCompiler
customize IntelEM64TFCompiler
Could not locate executable efort
Could not locate executable efc
customize PGroupFlangCompiler
Could not locate executable flang
don't know how to compile Fortran code on platform 'nt'
warning: build_ext: f77_compiler=None is not available.
building 'PyAstronomy_ext.forTrans.occultnl' extension
error: extension 'PyAstronomy_ext.forTrans.occultnl' has Fortran sources but no Fortran compiler found
----------------------------------------
Command "c:usersmatteanaconda3python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\matte\AppData\Local\Temp\pip-install-cg99ug7_\PyAstronomy-ext\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersmatteAppDataLocalTemppip-record-5q39xvkiinstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:UsersmatteAppDataLocalTemppip-install-cg99ug7_PyAstronomy-ext
EDIT: I was able to solve the problem by doing some digging, I had to write a distutils.cfg
file in C:...Anaconda3Libdistutils
with the following:
[build]
compiler=mingw32
And then run the following commands from Anaconda prompt:
conda install libpython
conda install -c msys2 m2w64-toolchain
After that pip install PyAstronomy_ext
worked perfectly.
I'm leaving this here in case anyone encounters this problem.
installation python pip mingw anaconda
add a comment |
I'm trying to install an external library for PyAstronomy using pip:
pip install PyAstronomy_ext
I do this via Anaconda command prompt.
The first time I ran the command the following errors appeared:
building 'PyAstronomy_ext.forTrans.occultnl' extension
error: extension 'PyAstronomy_ext.forTrans.occultnl' has Fortran sources but no Fortran compiler found
----------------------------------------
Failed building wheel for PyAstronomy-ext
and
Command "c:usersmatteanaconda3python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\matte\AppData\Local\Temp\pip-install-5pkiwi34\PyAstronomy-ext\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersmatteAppDataLocalTemppip-record-bok3jklvinstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:UsersmatteAppDataLocalTemppip-install-5pkiwi34PyAstronomy-ext
So I checked on the internet and found this topic.
I installed MinGW and downloaded all the Fortran related packages, and to be sure I also wrote a test script and compiled it using gFortran, and it worked fine.
When I tried to run the installation again the same errors popped up.
The answer also mentions this:
After the installation, add the path to its binary to the system PATH.
but I can't understand what it means, I tried running the installation command from C:MinGWbin
but the same error occur.
If you need the whole console dialogue that contains the errors:
Collecting PyAstronomy_ext
Using cached https://files.pythonhosted.org/packages/32/11/27b1fee690d7d5801580da2c25145a6fcce3ad3d0a1b8c41de09d5615825/PyAstronomy_ext-1.tar.gz
Requirement already satisfied: numpy in c:usersmatteanaconda3libsite-packages (from PyAstronomy_ext) (1.16.0)
Requirement already satisfied: six in c:usersmatteanaconda3libsite-packages (from PyAstronomy_ext) (1.11.0)
Building wheels for collected packages: PyAstronomy-ext
Building wheel for PyAstronomy-ext (setup.py) ... error
Complete output from command c:usersmatteanaconda3python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\matte\AppData\Local\Temp\pip-install-cg99ug7_\PyAstronomy-ext\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:UsersmatteAppDataLocalTemppip-wheel-0gj25_97 --python-tag cp36:
running bdist_wheel
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "PyAstronomy_ext.forTrans.occultnl" sources
f2py options:
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTransfortranobject.c' to sources.
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTrans' to include_dirs.
building extension "PyAstronomy_ext.forTrans.occultquad" sources
f2py options:
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTransfortranobject.c' to sources.
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTrans' to include_dirs.
adding 'buildsrc.win-amd64-3.6PyAstronomy_extforTransoccultquad-f2pywrappers.f' to sources.
build_src: building npy-pkg config files
running build_py
creating buildlib.win-amd64-3.6
creating buildlib.win-amd64-3.6PyAstronomy_ext
copying PyAstronomy_ext__init__.py -> buildlib.win-amd64-3.6PyAstronomy_ext
creating buildlib.win-amd64-3.6PyAstronomy_extforTrans
copying PyAstronomy_extforTrans__init__.py -> buildlib.win-amd64-3.6PyAstronomy_extforTrans
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
customize MSVCCompiler using build_ext
get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
customize AbsoftFCompiler
Could not locate executable f90
customize CompaqVisualFCompiler
Could not locate executable DF
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Could not locate executable gfortran
Could not locate executable f95
customize G95FCompiler
Could not locate executable g95
customize IntelEM64VisualFCompiler
customize IntelEM64TFCompiler
Could not locate executable efort
Could not locate executable efc
customize PGroupFlangCompiler
Could not locate executable flang
don't know how to compile Fortran code on platform 'nt'
warning: build_ext: f77_compiler=None is not available.
building 'PyAstronomy_ext.forTrans.occultnl' extension
error: extension 'PyAstronomy_ext.forTrans.occultnl' has Fortran sources but no Fortran compiler found
----------------------------------------
Failed building wheel for PyAstronomy-ext
Running setup.py clean for PyAstronomy-ext
Failed to build PyAstronomy-ext
Installing collected packages: PyAstronomy-ext
Running setup.py install for PyAstronomy-ext ... error
Complete output from command c:usersmatteanaconda3python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\matte\AppData\Local\Temp\pip-install-cg99ug7_\PyAstronomy-ext\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersmatteAppDataLocalTemppip-record-5q39xvkiinstall-record.txt --single-version-externally-managed --compile:
running install
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "PyAstronomy_ext.forTrans.occultnl" sources
f2py options:
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTransfortranobject.c' to sources.
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTrans' to include_dirs.
building extension "PyAstronomy_ext.forTrans.occultquad" sources
f2py options:
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTransfortranobject.c' to sources.
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTrans' to include_dirs.
adding 'buildsrc.win-amd64-3.6PyAstronomy_extforTransoccultquad-f2pywrappers.f' to sources.
build_src: building npy-pkg config files
running build_py
creating buildlib.win-amd64-3.6
creating buildlib.win-amd64-3.6PyAstronomy_ext
copying PyAstronomy_ext__init__.py -> buildlib.win-amd64-3.6PyAstronomy_ext
creating buildlib.win-amd64-3.6PyAstronomy_extforTrans
copying PyAstronomy_extforTrans__init__.py -> buildlib.win-amd64-3.6PyAstronomy_extforTrans
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
customize MSVCCompiler using build_ext
get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
customize AbsoftFCompiler
Could not locate executable f90
customize CompaqVisualFCompiler
Could not locate executable DF
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Could not locate executable gfortran
Could not locate executable f95
customize G95FCompiler
Could not locate executable g95
customize IntelEM64VisualFCompiler
customize IntelEM64TFCompiler
Could not locate executable efort
Could not locate executable efc
customize PGroupFlangCompiler
Could not locate executable flang
don't know how to compile Fortran code on platform 'nt'
warning: build_ext: f77_compiler=None is not available.
building 'PyAstronomy_ext.forTrans.occultnl' extension
error: extension 'PyAstronomy_ext.forTrans.occultnl' has Fortran sources but no Fortran compiler found
----------------------------------------
Command "c:usersmatteanaconda3python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\matte\AppData\Local\Temp\pip-install-cg99ug7_\PyAstronomy-ext\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersmatteAppDataLocalTemppip-record-5q39xvkiinstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:UsersmatteAppDataLocalTemppip-install-cg99ug7_PyAstronomy-ext
EDIT: I was able to solve the problem by doing some digging, I had to write a distutils.cfg
file in C:...Anaconda3Libdistutils
with the following:
[build]
compiler=mingw32
And then run the following commands from Anaconda prompt:
conda install libpython
conda install -c msys2 m2w64-toolchain
After that pip install PyAstronomy_ext
worked perfectly.
I'm leaving this here in case anyone encounters this problem.
installation python pip mingw anaconda
add a comment |
I'm trying to install an external library for PyAstronomy using pip:
pip install PyAstronomy_ext
I do this via Anaconda command prompt.
The first time I ran the command the following errors appeared:
building 'PyAstronomy_ext.forTrans.occultnl' extension
error: extension 'PyAstronomy_ext.forTrans.occultnl' has Fortran sources but no Fortran compiler found
----------------------------------------
Failed building wheel for PyAstronomy-ext
and
Command "c:usersmatteanaconda3python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\matte\AppData\Local\Temp\pip-install-5pkiwi34\PyAstronomy-ext\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersmatteAppDataLocalTemppip-record-bok3jklvinstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:UsersmatteAppDataLocalTemppip-install-5pkiwi34PyAstronomy-ext
So I checked on the internet and found this topic.
I installed MinGW and downloaded all the Fortran related packages, and to be sure I also wrote a test script and compiled it using gFortran, and it worked fine.
When I tried to run the installation again the same errors popped up.
The answer also mentions this:
After the installation, add the path to its binary to the system PATH.
but I can't understand what it means, I tried running the installation command from C:MinGWbin
but the same error occur.
If you need the whole console dialogue that contains the errors:
Collecting PyAstronomy_ext
Using cached https://files.pythonhosted.org/packages/32/11/27b1fee690d7d5801580da2c25145a6fcce3ad3d0a1b8c41de09d5615825/PyAstronomy_ext-1.tar.gz
Requirement already satisfied: numpy in c:usersmatteanaconda3libsite-packages (from PyAstronomy_ext) (1.16.0)
Requirement already satisfied: six in c:usersmatteanaconda3libsite-packages (from PyAstronomy_ext) (1.11.0)
Building wheels for collected packages: PyAstronomy-ext
Building wheel for PyAstronomy-ext (setup.py) ... error
Complete output from command c:usersmatteanaconda3python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\matte\AppData\Local\Temp\pip-install-cg99ug7_\PyAstronomy-ext\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:UsersmatteAppDataLocalTemppip-wheel-0gj25_97 --python-tag cp36:
running bdist_wheel
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "PyAstronomy_ext.forTrans.occultnl" sources
f2py options:
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTransfortranobject.c' to sources.
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTrans' to include_dirs.
building extension "PyAstronomy_ext.forTrans.occultquad" sources
f2py options:
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTransfortranobject.c' to sources.
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTrans' to include_dirs.
adding 'buildsrc.win-amd64-3.6PyAstronomy_extforTransoccultquad-f2pywrappers.f' to sources.
build_src: building npy-pkg config files
running build_py
creating buildlib.win-amd64-3.6
creating buildlib.win-amd64-3.6PyAstronomy_ext
copying PyAstronomy_ext__init__.py -> buildlib.win-amd64-3.6PyAstronomy_ext
creating buildlib.win-amd64-3.6PyAstronomy_extforTrans
copying PyAstronomy_extforTrans__init__.py -> buildlib.win-amd64-3.6PyAstronomy_extforTrans
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
customize MSVCCompiler using build_ext
get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
customize AbsoftFCompiler
Could not locate executable f90
customize CompaqVisualFCompiler
Could not locate executable DF
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Could not locate executable gfortran
Could not locate executable f95
customize G95FCompiler
Could not locate executable g95
customize IntelEM64VisualFCompiler
customize IntelEM64TFCompiler
Could not locate executable efort
Could not locate executable efc
customize PGroupFlangCompiler
Could not locate executable flang
don't know how to compile Fortran code on platform 'nt'
warning: build_ext: f77_compiler=None is not available.
building 'PyAstronomy_ext.forTrans.occultnl' extension
error: extension 'PyAstronomy_ext.forTrans.occultnl' has Fortran sources but no Fortran compiler found
----------------------------------------
Failed building wheel for PyAstronomy-ext
Running setup.py clean for PyAstronomy-ext
Failed to build PyAstronomy-ext
Installing collected packages: PyAstronomy-ext
Running setup.py install for PyAstronomy-ext ... error
Complete output from command c:usersmatteanaconda3python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\matte\AppData\Local\Temp\pip-install-cg99ug7_\PyAstronomy-ext\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersmatteAppDataLocalTemppip-record-5q39xvkiinstall-record.txt --single-version-externally-managed --compile:
running install
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "PyAstronomy_ext.forTrans.occultnl" sources
f2py options:
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTransfortranobject.c' to sources.
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTrans' to include_dirs.
building extension "PyAstronomy_ext.forTrans.occultquad" sources
f2py options:
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTransfortranobject.c' to sources.
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTrans' to include_dirs.
adding 'buildsrc.win-amd64-3.6PyAstronomy_extforTransoccultquad-f2pywrappers.f' to sources.
build_src: building npy-pkg config files
running build_py
creating buildlib.win-amd64-3.6
creating buildlib.win-amd64-3.6PyAstronomy_ext
copying PyAstronomy_ext__init__.py -> buildlib.win-amd64-3.6PyAstronomy_ext
creating buildlib.win-amd64-3.6PyAstronomy_extforTrans
copying PyAstronomy_extforTrans__init__.py -> buildlib.win-amd64-3.6PyAstronomy_extforTrans
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
customize MSVCCompiler using build_ext
get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
customize AbsoftFCompiler
Could not locate executable f90
customize CompaqVisualFCompiler
Could not locate executable DF
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Could not locate executable gfortran
Could not locate executable f95
customize G95FCompiler
Could not locate executable g95
customize IntelEM64VisualFCompiler
customize IntelEM64TFCompiler
Could not locate executable efort
Could not locate executable efc
customize PGroupFlangCompiler
Could not locate executable flang
don't know how to compile Fortran code on platform 'nt'
warning: build_ext: f77_compiler=None is not available.
building 'PyAstronomy_ext.forTrans.occultnl' extension
error: extension 'PyAstronomy_ext.forTrans.occultnl' has Fortran sources but no Fortran compiler found
----------------------------------------
Command "c:usersmatteanaconda3python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\matte\AppData\Local\Temp\pip-install-cg99ug7_\PyAstronomy-ext\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersmatteAppDataLocalTemppip-record-5q39xvkiinstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:UsersmatteAppDataLocalTemppip-install-cg99ug7_PyAstronomy-ext
EDIT: I was able to solve the problem by doing some digging, I had to write a distutils.cfg
file in C:...Anaconda3Libdistutils
with the following:
[build]
compiler=mingw32
And then run the following commands from Anaconda prompt:
conda install libpython
conda install -c msys2 m2w64-toolchain
After that pip install PyAstronomy_ext
worked perfectly.
I'm leaving this here in case anyone encounters this problem.
installation python pip mingw anaconda
I'm trying to install an external library for PyAstronomy using pip:
pip install PyAstronomy_ext
I do this via Anaconda command prompt.
The first time I ran the command the following errors appeared:
building 'PyAstronomy_ext.forTrans.occultnl' extension
error: extension 'PyAstronomy_ext.forTrans.occultnl' has Fortran sources but no Fortran compiler found
----------------------------------------
Failed building wheel for PyAstronomy-ext
and
Command "c:usersmatteanaconda3python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\matte\AppData\Local\Temp\pip-install-5pkiwi34\PyAstronomy-ext\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersmatteAppDataLocalTemppip-record-bok3jklvinstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:UsersmatteAppDataLocalTemppip-install-5pkiwi34PyAstronomy-ext
So I checked on the internet and found this topic.
I installed MinGW and downloaded all the Fortran related packages, and to be sure I also wrote a test script and compiled it using gFortran, and it worked fine.
When I tried to run the installation again the same errors popped up.
The answer also mentions this:
After the installation, add the path to its binary to the system PATH.
but I can't understand what it means, I tried running the installation command from C:MinGWbin
but the same error occur.
If you need the whole console dialogue that contains the errors:
Collecting PyAstronomy_ext
Using cached https://files.pythonhosted.org/packages/32/11/27b1fee690d7d5801580da2c25145a6fcce3ad3d0a1b8c41de09d5615825/PyAstronomy_ext-1.tar.gz
Requirement already satisfied: numpy in c:usersmatteanaconda3libsite-packages (from PyAstronomy_ext) (1.16.0)
Requirement already satisfied: six in c:usersmatteanaconda3libsite-packages (from PyAstronomy_ext) (1.11.0)
Building wheels for collected packages: PyAstronomy-ext
Building wheel for PyAstronomy-ext (setup.py) ... error
Complete output from command c:usersmatteanaconda3python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\matte\AppData\Local\Temp\pip-install-cg99ug7_\PyAstronomy-ext\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:UsersmatteAppDataLocalTemppip-wheel-0gj25_97 --python-tag cp36:
running bdist_wheel
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "PyAstronomy_ext.forTrans.occultnl" sources
f2py options:
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTransfortranobject.c' to sources.
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTrans' to include_dirs.
building extension "PyAstronomy_ext.forTrans.occultquad" sources
f2py options:
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTransfortranobject.c' to sources.
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTrans' to include_dirs.
adding 'buildsrc.win-amd64-3.6PyAstronomy_extforTransoccultquad-f2pywrappers.f' to sources.
build_src: building npy-pkg config files
running build_py
creating buildlib.win-amd64-3.6
creating buildlib.win-amd64-3.6PyAstronomy_ext
copying PyAstronomy_ext__init__.py -> buildlib.win-amd64-3.6PyAstronomy_ext
creating buildlib.win-amd64-3.6PyAstronomy_extforTrans
copying PyAstronomy_extforTrans__init__.py -> buildlib.win-amd64-3.6PyAstronomy_extforTrans
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
customize MSVCCompiler using build_ext
get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
customize AbsoftFCompiler
Could not locate executable f90
customize CompaqVisualFCompiler
Could not locate executable DF
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Could not locate executable gfortran
Could not locate executable f95
customize G95FCompiler
Could not locate executable g95
customize IntelEM64VisualFCompiler
customize IntelEM64TFCompiler
Could not locate executable efort
Could not locate executable efc
customize PGroupFlangCompiler
Could not locate executable flang
don't know how to compile Fortran code on platform 'nt'
warning: build_ext: f77_compiler=None is not available.
building 'PyAstronomy_ext.forTrans.occultnl' extension
error: extension 'PyAstronomy_ext.forTrans.occultnl' has Fortran sources but no Fortran compiler found
----------------------------------------
Failed building wheel for PyAstronomy-ext
Running setup.py clean for PyAstronomy-ext
Failed to build PyAstronomy-ext
Installing collected packages: PyAstronomy-ext
Running setup.py install for PyAstronomy-ext ... error
Complete output from command c:usersmatteanaconda3python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\matte\AppData\Local\Temp\pip-install-cg99ug7_\PyAstronomy-ext\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersmatteAppDataLocalTemppip-record-5q39xvkiinstall-record.txt --single-version-externally-managed --compile:
running install
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building extension "PyAstronomy_ext.forTrans.occultnl" sources
f2py options:
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTransfortranobject.c' to sources.
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTrans' to include_dirs.
building extension "PyAstronomy_ext.forTrans.occultquad" sources
f2py options:
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTransfortranobject.c' to sources.
adding 'buildsrc.win-amd64-3.6buildsrc.win-amd64-3.6PyAstronomy_extforTrans' to include_dirs.
adding 'buildsrc.win-amd64-3.6PyAstronomy_extforTransoccultquad-f2pywrappers.f' to sources.
build_src: building npy-pkg config files
running build_py
creating buildlib.win-amd64-3.6
creating buildlib.win-amd64-3.6PyAstronomy_ext
copying PyAstronomy_ext__init__.py -> buildlib.win-amd64-3.6PyAstronomy_ext
creating buildlib.win-amd64-3.6PyAstronomy_extforTrans
copying PyAstronomy_extforTrans__init__.py -> buildlib.win-amd64-3.6PyAstronomy_extforTrans
running build_ext
No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
customize MSVCCompiler
customize MSVCCompiler using build_ext
get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelVisualFCompiler
Could not locate executable ifort
Could not locate executable ifl
customize AbsoftFCompiler
Could not locate executable f90
customize CompaqVisualFCompiler
Could not locate executable DF
customize IntelItaniumVisualFCompiler
Could not locate executable efl
customize Gnu95FCompiler
Could not locate executable gfortran
Could not locate executable f95
customize G95FCompiler
Could not locate executable g95
customize IntelEM64VisualFCompiler
customize IntelEM64TFCompiler
Could not locate executable efort
Could not locate executable efc
customize PGroupFlangCompiler
Could not locate executable flang
don't know how to compile Fortran code on platform 'nt'
warning: build_ext: f77_compiler=None is not available.
building 'PyAstronomy_ext.forTrans.occultnl' extension
error: extension 'PyAstronomy_ext.forTrans.occultnl' has Fortran sources but no Fortran compiler found
----------------------------------------
Command "c:usersmatteanaconda3python.exe -u -c "import setuptools, tokenize;__file__='C:\Users\matte\AppData\Local\Temp\pip-install-cg99ug7_\PyAstronomy-ext\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:UsersmatteAppDataLocalTemppip-record-5q39xvkiinstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:UsersmatteAppDataLocalTemppip-install-cg99ug7_PyAstronomy-ext
EDIT: I was able to solve the problem by doing some digging, I had to write a distutils.cfg
file in C:...Anaconda3Libdistutils
with the following:
[build]
compiler=mingw32
And then run the following commands from Anaconda prompt:
conda install libpython
conda install -c msys2 m2w64-toolchain
After that pip install PyAstronomy_ext
worked perfectly.
I'm leaving this here in case anyone encounters this problem.
installation python pip mingw anaconda
installation python pip mingw anaconda
edited Jan 30 at 10:31
Matteo Xon
asked Jan 29 at 17:24
Matteo XonMatteo Xon
12
12
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1399738%2fpip-error-no-fortran-compiler-found-but-compiler-already-present%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1399738%2fpip-error-no-fortran-compiler-found-but-compiler-already-present%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown