问题
I am trying to install the PyOptSparse package via the Anaconda Prompt using
(FYP_py37_32bit) C:\Users\nilsg\pyoptsparse>python setup.py install --user
but keep getting the following error
compiling Fortran sources
Fortran f77 compiler: C:\Users\nilsg\Miniconda3\envs\FYP_py37_32bit\Library\mingw-w64\bin\gfortran.exe -Wall -g -ffixed-form -fno-second-underscore -O3 -funroll-loops
Fortran f90 compiler: C:\Users\nilsg\Miniconda3\envs\FYP_py37_32bit\Library\mingw-w64\bin\gfortran.exe -Wall -g -fno-second-underscore -O3 -funroll-loops
Fortran fix compiler: C:\Users\nilsg\Miniconda3\envs\FYP_py37_32bit\Library\mingw-w64\bin\gfortran.exe -Wall -g -ffixed-form -fno-second-underscore -Wall -g -fno-second-underscore -O3 -funroll-loops
compile options: '-Ibuild\src.win32-3.7\build\src.win32-3.7\pyoptsparse\pyFSQP\source\f2py -IC:\Users\nilsg\Miniconda3\envs\FYP_py37_32bit\lib\site-packages\numpy\core\include -IC:\Users\nilsg\Miniconda3\envs\FYP_py37_32bit\include -IC:\Users\nilsg\Miniconda3\envs\FYP_py37_32bit\include -c'
gfortran.exe:f77: build\src.win32-3.7\pyoptsparse\pyFSQP\source\f2py\ffsqp-f2pywrappers.f
C:\Users\nilsg\Miniconda3\envs\FYP_py37_32bit\Library\mingw-w64\bin\gfortran.exe -Wall -g -Wall -g -shared build\temp.win32-3.7\Release\build\src.win32-3.7\pyoptsparse\pyfsqp\source\f2py\ffsqpmodule.o build\temp.win32-3.7\Release\build\src.win32-3.7\build\src.win32-3.7\pyoptsparse\pyfsqp\source\f2py\fortranobject.o build\temp.win32-3.7\Release\build\src.win32-3.7\pyoptsparse\pyFSQP\source\f2py\ffsqp-f2pywrappers.o -LC:\Users\nilsg\Miniconda3\envs\FYP_py37_32bit\Library\mingw-w64\lib\gcc\x86_64-w64-mingw32\5.3.0 -LC:\Users\nilsg\Miniconda3\envs\FYP_py37_32bit\libs -LC:\Users\nilsg\Miniconda3\envs\FYP_py37_32bit\PCbuild\win32 -Lbuild\temp.win32-3.7 -lffsqp -lpython37 -lgfortran -o build\lib.win32-3.7\pyoptsparse\pyFSQP\ffsqp.cp37-win32.pyd
build\temp.win32-3.7\Release\build\src.win32-3.7\pyoptsparse\pyfsqp\source\f2py\ffsqpmodule.o:ffsqpmodule.c:(.data+0x358): undefined reference to `ffsqp_'
collect2.exe: error: ld returned 1 exit status
error: Command "C:\Users\nilsg\Miniconda3\envs\FYP_py37_32bit\Library\mingw-w64\bin\gfortran.exe -Wall -g -Wall -g -shared build\temp.win32-3.7\Release\build\src.win32-3.7\pyoptsparse\pyfsqp\source\f2py\ffsqpmodule.o build\temp.win32-3.7\Release\build\src.win32-3.7\build\src.win32-3.7\pyoptsparse\pyfsqp\source\f2py\fortranobject.o build\temp.win32-3.7\Release\build\src.win32-3.7\pyoptsparse\pyFSQP\source\f2py\ffsqp-f2pywrappers.o -LC:\Users\nilsg\Miniconda3\envs\FYP_py37_32bit\Library\mingw-w64\lib\gcc\x86_64-w64-mingw32\5.3.0 -LC:\Users\nilsg\Miniconda3\envs\FYP_py37_32bit\libs -LC:\Users\nilsg\Miniconda3\envs\FYP_py37_32bit\PCbuild\win32 -Lbuild\temp.win32-3.7 -lffsqp -lpython37 -lgfortran -o build\lib.win32-3.7\pyoptsparse\pyFSQP\ffsqp.cp37-win32.pyd" failed with exit status 1
My conda environment includes the following packages
# packages in environment at C:\Users\nilsg\Miniconda3\envs\FYP_py37_32bit:
#
# Name Version Build Channel
astroid 2.3.3 pypi_0 pypi
atomicwrites 1.3.0 pypi_0 pypi
attrs 19.3.0 pypi_0 pypi
ca-certificates 2020.1.1 0
certifi 2019.11.28 py37_0
chardet 3.0.4 pypi_0 pypi
colorama 0.4.3 pypi_0 pypi
cycler 0.10.0 pypi_0 pypi
floris 1.1.4 dev_0 <develop>
h5pyd 0.3.3 pypi_0 pypi
idna 2.9 pypi_0 pypi
importlib-metadata 1.5.0 pypi_0 pypi
isort 4.3.21 pypi_0 pypi
kiwisolver 1.1.0 pypi_0 pypi
lazy-object-proxy 1.4.3 pypi_0 pypi
libpython 2.1 py37_0
m2w64-binutils 2.25.1 5 msys2
m2w64-bzip2 1.0.6 6 msys2
m2w64-crt-git 5.0.0.4636.2595836 2 msys2
m2w64-gcc 5.3.0 6 msys2
m2w64-gcc-ada 5.3.0 6 msys2
m2w64-gcc-fortran 5.3.0 6 msys2
m2w64-gcc-libgfortran 5.3.0 6 msys2
m2w64-gcc-libs 5.3.0 7 msys2
m2w64-gcc-libs-core 5.3.0 7 msys2
m2w64-gcc-objc 5.3.0 6 msys2
m2w64-gmp 6.1.0 2 msys2
m2w64-headers-git 5.0.0.4636.c0ad18a 2 msys2
m2w64-isl 0.16.1 2 msys2
m2w64-libiconv 1.14 6 msys2
m2w64-libmangle-git 5.0.0.4509.2e5a9a2 2 msys2
m2w64-libwinpthread-git 5.0.0.4634.697f757 2 msys2
m2w64-make 4.1.2351.a80a8b8 2 msys2
m2w64-mpc 1.0.3 3 msys2
m2w64-mpfr 3.1.4 4 msys2
m2w64-pkg-config 0.29.1 2 msys2
m2w64-toolchain 5.3.0 7 msys2
m2w64-tools-git 5.0.0.4592.90b8472 2 msys2
m2w64-windows-default-manifest 6.4 3 msys2
m2w64-winpthreads-git 5.0.0.4634.697f757 2 msys2
m2w64-zlib 1.2.8 10 msys2
matplotlib 3.1.3 pypi_0 pypi
mccabe 0.6.1 pypi_0 pypi
more-itertools 8.2.0 pypi_0 pypi
msys2-conda-epoch 20160418 1 msys2
numpy 1.16.3 pypi_0 pypi
openssl 1.1.1d he774522_4
packaging 20.1 pypi_0 pypi
pandas 0.24.2 pypi_0 pypi
pip 20.0.2 py37_1
pluggy 0.13.1 pypi_0 pypi
py 1.8.1 pypi_0 pypi
pylint 2.4.4 pypi_0 pypi
pyparsing 2.4.6 pypi_0 pypi
pyproj 2.1.3 pypi_0 pypi
pytest 5.3.5 pypi_0 pypi
python 3.7.6 h60c2a47_2
python-dateutil 2.8.1 pypi_0 pypi
pytz 2019.3 pypi_0 pypi
requests 2.23.0 pypi_0 pypi
scipy 1.1.0 pypi_0 pypi
seaborn 0.9.0 pypi_0 pypi
setuptools 45.2.0 py37_0
six 1.14.0 pypi_0 pypi
sqlite 3.31.1 he774522_0
sqlitedict 1.6.0 pypi_0 pypi
swig 3.0.12 h047fa9f_3 anaconda
typed-ast 1.4.1 pypi_0 pypi
urllib3 1.25.8 pypi_0 pypi
vc 14.1 h0510ff6_4
vs2015_runtime 14.16.27012 hf0eaf9b_1
wcwidth 0.1.8 pypi_0 pypi
wheel 0.34.2 py37_0
wincertstore 0.2 py37_0
wrapt 1.11.2 pypi_0 pypi
zipp 3.0.0 pypi_0 pypi
PyOptSparse "compatibility on Windows 64-bit has not been tested" link. I now believe this to be the issue.
If anyone else has successfully installed PyOptSparse package on Windows (or any other operating system) please let me know.
来源:https://stackoverflow.com/questions/60323156/fortran-compiler-error-installing-pyoptsparse