You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I follow the instructions to install NLopt on Windows 10 with cmake and specified python plugin. It seems to be successful. However, when I want to import nlopt module in python, it fails with the following error. Would you please help me? Thank you very much.
(By the way, I found a similar problem when I install on Mac.)
python
import nlopt
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'nlopt'
"cmake" command and output are:
cmake -G "Unix Makefiles" -DCMAKE_CXX_COMPILER=C:/cygwin64/bin/g++.exe -DCMAKE_C_COMPILER=C:/cygwin64/bin/gcc.exe -DPYTHON_EXECUTABLE=C:/Users/joann/Anaconda3/python.exe -DSWIG_EXECUTABLE=C:/cygwin64/home/joann/code_store/swigwin-4.0.1/swig.exe ..
-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: C:/cygwin64/bin/gcc.exe
-- Check for working C compiler: C:/cygwin64/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/cygwin64/bin/g++.exe
-- Check for working CXX compiler: C:/cygwin64/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- NLopt version 2.6.1
-- Looking for dlfcn.h
-- Looking for dlfcn.h - found
-- Looking for getopt.h
-- Looking for getopt.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for string.h
-- Looking for string.h - found
-- Looking for strings.h
-- Looking for strings.h - found
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for memory.h
-- Looking for memory.h - found
-- Looking for stdlib.h
-- Looking for stdlib.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for time.h
-- Looking for time.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for sys/time.h
-- Looking for sys/time.h - found
-- Looking for getpid
-- Looking for getpid - found
-- Looking for syscall
-- Looking for syscall - not found
-- Looking for isinf
-- Looking for isinf - found
-- Looking for isnan
-- Looking for isnan - found
-- Looking for gettimeofday
-- Looking for gettimeofday - found
-- Looking for qsort_r
-- Looking for qsort_r - found
-- Looking for time
-- Looking for time - found
-- Looking for copysign
-- Looking for copysign - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of uint32_t
-- Check size of uint32_t - done
-- Check size of unsigned int
-- Check size of unsigned int - done
-- Check size of unsigned long
-- Check size of unsigned long - done
-- Looking for sqrt in m
-- Looking for sqrt in m - found
-- Looking for fpclassify
-- Looking for fpclassify - TRUE
-- Performing Test HAVE_THREAD_LOCAL_STORAGE
-- Performing Test HAVE_THREAD_LOCAL_STORAGE - Success
-- Performing Test HAVE_THREAD_LOCAL_STORAGE
-- Performing Test HAVE_THREAD_LOCAL_STORAGE - Success
-- Looking for __cplusplus
-- Looking for __cplusplus - found
-- Performing Test SUPPORTS_STDCXX11
-- Performing Test SUPPORTS_STDCXX11 - Success
-- Found PythonInterp: C:/Users/joann/Anaconda3/python.exe (found version "3.7.4")
-- Found PythonLibs: C:/Users/joann/Anaconda3/libs/python37.lib (found suitable exact version "3.7.4")
-- Could NOT find Guile (missing: GUILE_EXECUTABLE GUILE_ROOT_DIR GUILE_INCLUDE_DIRS GUILE_LIBRARIES)
-- Found SWIG: C:/cygwin64/home/joann/code_store/swigwin-4.0.1/swig.exe (found version "4.0.1")
-- Performing Test UNDEFINED_SYMBOLS_ALLOWED - Failed
-- Could NOT find Octave (missing: OCTAVE_EXECUTABLE OCTAVE_ROOT_DIR OCTAVE_LIBRARIES)
-- Could NOT find Matlab (missing: Matlab_MEX_LIBRARY Matlab_MEX_EXTENSION Matlab_MX_LIBRARY Matlab_ENGINE_LIBRARY Matlab_DATAARRAY_LIBRARY MX_LIBRARY) (found version "9.5")
-- Configuring done
-- Generating done
-- Build files have been written to: C:/cygwin64/home/joann/code_store/nlopt/build
"make" outputs are:
make
Scanning dependencies of target nlopt
[ 1%] Building C object CMakeFiles/nlopt.dir/src/algs/direct/DIRect.c.obj
[ 3%] Building C object CMakeFiles/nlopt.dir/src/algs/direct/direct_wrap.c.obj
[ 5%] Building C object CMakeFiles/nlopt.dir/src/algs/direct/DIRserial.c.obj
[ 7%] Building C object CMakeFiles/nlopt.dir/src/algs/direct/DIRsubrout.c.obj
[ 9%] Building C object CMakeFiles/nlopt.dir/src/algs/cdirect/cdirect.c.obj
[ 10%] Building C object CMakeFiles/nlopt.dir/src/algs/cdirect/hybrid.c.obj
[ 12%] Building C object CMakeFiles/nlopt.dir/src/algs/praxis/praxis.c.obj
[ 14%] Building C object CMakeFiles/nlopt.dir/src/algs/luksan/plis.c.obj
[ 16%] Building C object CMakeFiles/nlopt.dir/src/algs/luksan/plip.c.obj
[ 18%] Building C object CMakeFiles/nlopt.dir/src/algs/luksan/pnet.c.obj
[ 20%] Building C object CMakeFiles/nlopt.dir/src/algs/luksan/mssubs.c.obj
[ 21%] Building C object CMakeFiles/nlopt.dir/src/algs/luksan/pssubs.c.obj
[ 23%] Building C object CMakeFiles/nlopt.dir/src/algs/crs/crs.c.obj
[ 25%] Building C object CMakeFiles/nlopt.dir/src/algs/mlsl/mlsl.c.obj
[ 27%] Building C object CMakeFiles/nlopt.dir/src/algs/mma/mma.c.obj
[ 29%] Building C object CMakeFiles/nlopt.dir/src/algs/mma/ccsa_quadratic.c.obj
[ 30%] Building C object CMakeFiles/nlopt.dir/src/algs/cobyla/cobyla.c.obj
[ 32%] Building C object CMakeFiles/nlopt.dir/src/algs/newuoa/newuoa.c.obj
[ 34%] Building C object CMakeFiles/nlopt.dir/src/algs/neldermead/nldrmd.c.obj
[ 36%] Building C object CMakeFiles/nlopt.dir/src/algs/neldermead/sbplx.c.obj
[ 38%] Building C object CMakeFiles/nlopt.dir/src/algs/auglag/auglag.c.obj
[ 40%] Building C object CMakeFiles/nlopt.dir/src/algs/bobyqa/bobyqa.c.obj
[ 41%] Building C object CMakeFiles/nlopt.dir/src/algs/isres/isres.c.obj
[ 43%] Building C object CMakeFiles/nlopt.dir/src/algs/slsqp/slsqp.c.obj
[ 45%] Building C object CMakeFiles/nlopt.dir/src/algs/esch/esch.c.obj
[ 47%] Building C object CMakeFiles/nlopt.dir/src/api/general.c.obj
[ 49%] Building C object CMakeFiles/nlopt.dir/src/api/options.c.obj
[ 50%] Building C object CMakeFiles/nlopt.dir/src/api/optimize.c.obj
[ 52%] Building C object CMakeFiles/nlopt.dir/src/api/deprecated.c.obj
[ 54%] Building C object CMakeFiles/nlopt.dir/src/api/f77api.c.obj
[ 56%] Building C object CMakeFiles/nlopt.dir/src/util/mt19937ar.c.obj
[ 58%] Building C object CMakeFiles/nlopt.dir/src/util/sobolseq.c.obj
[ 60%] Building C object CMakeFiles/nlopt.dir/src/util/timer.c.obj
[ 61%] Building C object CMakeFiles/nlopt.dir/src/util/stop.c.obj
[ 63%] Building C object CMakeFiles/nlopt.dir/src/util/redblack.c.obj
[ 65%] Building C object CMakeFiles/nlopt.dir/src/util/qsort_r.c.obj
[ 67%] Building C object CMakeFiles/nlopt.dir/src/util/rescale.c.obj
[ 69%] Building CXX object CMakeFiles/nlopt.dir/src/algs/stogo/global.cc.o
[ 70%] Building CXX object CMakeFiles/nlopt.dir/src/algs/stogo/linalg.cc.o
[ 72%] Building CXX object CMakeFiles/nlopt.dir/src/algs/stogo/local.cc.o
[ 74%] Building CXX object CMakeFiles/nlopt.dir/src/algs/stogo/stogo.cc.o
[ 76%] Building CXX object CMakeFiles/nlopt.dir/src/algs/stogo/tools.cc.o
[ 78%] Building CXX object CMakeFiles/nlopt.dir/src/algs/ags/evolvent.cc.o
[ 80%] Building CXX object CMakeFiles/nlopt.dir/src/algs/ags/solver.cc.o
[ 81%] Building CXX object CMakeFiles/nlopt.dir/src/algs/ags/local_optimizer.cc.o
[ 83%] Building CXX object CMakeFiles/nlopt.dir/src/algs/ags/ags.cc.o
[ 85%] Linking CXX shared library libnlopt.dll
[ 85%] Built target nlopt
Scanning dependencies of target testopt
[ 87%] Building C object test/CMakeFiles/testopt.dir/testfuncs.c.obj
[ 89%] Building C object test/CMakeFiles/testopt.dir/testopt.c.obj
[ 90%] Building C object test/CMakeFiles/testopt.dir//src/util/timer.c.obj
[ 92%] Building C object test/CMakeFiles/testopt.dir//src/util/mt19937ar.c.obj
[ 94%] Building C object test/CMakeFiles/testopt.dir/__/src/util/nlopt-getopt.c.obj
[ 96%] Linking CXX executable testopt.exe
[ 96%] Built target testopt
Scanning dependencies of target t_tutorial
[ 98%] Building CXX object test/CMakeFiles/t_tutorial.dir/t_tutorial.cxx.o
[100%] Linking CXX executable t_tutorial.exe
[100%] Built target t_tutorial
I follow the instructions to install NLopt on Windows 10 with cmake and specified python plugin. It seems to be successful. However, when I want to import nlopt module in python, it fails with the following error. Would you please help me? Thank you very much.
(By the way, I found a similar problem when I install on Mac.)
python
import nlopt
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'nlopt'
"cmake" command and output are:
cmake -G "Unix Makefiles" -DCMAKE_CXX_COMPILER=C:/cygwin64/bin/g++.exe -DCMAKE_C_COMPILER=C:/cygwin64/bin/gcc.exe -DPYTHON_EXECUTABLE=C:/Users/joann/Anaconda3/python.exe -DSWIG_EXECUTABLE=C:/cygwin64/home/joann/code_store/swigwin-4.0.1/swig.exe ..
-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: C:/cygwin64/bin/gcc.exe
-- Check for working C compiler: C:/cygwin64/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/cygwin64/bin/g++.exe
-- Check for working CXX compiler: C:/cygwin64/bin/g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- NLopt version 2.6.1
-- Looking for dlfcn.h
-- Looking for dlfcn.h - found
-- Looking for getopt.h
-- Looking for getopt.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Looking for string.h
-- Looking for string.h - found
-- Looking for strings.h
-- Looking for strings.h - found
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for memory.h
-- Looking for memory.h - found
-- Looking for stdlib.h
-- Looking for stdlib.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for time.h
-- Looking for time.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for sys/stat.h
-- Looking for sys/stat.h - found
-- Looking for sys/time.h
-- Looking for sys/time.h - found
-- Looking for getpid
-- Looking for getpid - found
-- Looking for syscall
-- Looking for syscall - not found
-- Looking for isinf
-- Looking for isinf - found
-- Looking for isnan
-- Looking for isnan - found
-- Looking for gettimeofday
-- Looking for gettimeofday - found
-- Looking for qsort_r
-- Looking for qsort_r - found
-- Looking for time
-- Looking for time - found
-- Looking for copysign
-- Looking for copysign - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of uint32_t
-- Check size of uint32_t - done
-- Check size of unsigned int
-- Check size of unsigned int - done
-- Check size of unsigned long
-- Check size of unsigned long - done
-- Looking for sqrt in m
-- Looking for sqrt in m - found
-- Looking for fpclassify
-- Looking for fpclassify - TRUE
-- Performing Test HAVE_THREAD_LOCAL_STORAGE
-- Performing Test HAVE_THREAD_LOCAL_STORAGE - Success
-- Performing Test HAVE_THREAD_LOCAL_STORAGE
-- Performing Test HAVE_THREAD_LOCAL_STORAGE - Success
-- Looking for __cplusplus
-- Looking for __cplusplus - found
-- Performing Test SUPPORTS_STDCXX11
-- Performing Test SUPPORTS_STDCXX11 - Success
-- Found PythonInterp: C:/Users/joann/Anaconda3/python.exe (found version "3.7.4")
-- Found PythonLibs: C:/Users/joann/Anaconda3/libs/python37.lib (found suitable exact version "3.7.4")
-- Could NOT find Guile (missing: GUILE_EXECUTABLE GUILE_ROOT_DIR GUILE_INCLUDE_DIRS GUILE_LIBRARIES)
-- Found SWIG: C:/cygwin64/home/joann/code_store/swigwin-4.0.1/swig.exe (found version "4.0.1")
-- Performing Test UNDEFINED_SYMBOLS_ALLOWED - Failed
-- Could NOT find Octave (missing: OCTAVE_EXECUTABLE OCTAVE_ROOT_DIR OCTAVE_LIBRARIES)
-- Could NOT find Matlab (missing: Matlab_MEX_LIBRARY Matlab_MEX_EXTENSION Matlab_MX_LIBRARY Matlab_ENGINE_LIBRARY Matlab_DATAARRAY_LIBRARY MX_LIBRARY) (found version "9.5")
-- Configuring done
-- Generating done
-- Build files have been written to: C:/cygwin64/home/joann/code_store/nlopt/build
"make" outputs are:
make
Scanning dependencies of target nlopt
[ 1%] Building C object CMakeFiles/nlopt.dir/src/algs/direct/DIRect.c.obj
[ 3%] Building C object CMakeFiles/nlopt.dir/src/algs/direct/direct_wrap.c.obj
[ 5%] Building C object CMakeFiles/nlopt.dir/src/algs/direct/DIRserial.c.obj
[ 7%] Building C object CMakeFiles/nlopt.dir/src/algs/direct/DIRsubrout.c.obj
[ 9%] Building C object CMakeFiles/nlopt.dir/src/algs/cdirect/cdirect.c.obj
[ 10%] Building C object CMakeFiles/nlopt.dir/src/algs/cdirect/hybrid.c.obj
[ 12%] Building C object CMakeFiles/nlopt.dir/src/algs/praxis/praxis.c.obj
[ 14%] Building C object CMakeFiles/nlopt.dir/src/algs/luksan/plis.c.obj
[ 16%] Building C object CMakeFiles/nlopt.dir/src/algs/luksan/plip.c.obj
[ 18%] Building C object CMakeFiles/nlopt.dir/src/algs/luksan/pnet.c.obj
[ 20%] Building C object CMakeFiles/nlopt.dir/src/algs/luksan/mssubs.c.obj
[ 21%] Building C object CMakeFiles/nlopt.dir/src/algs/luksan/pssubs.c.obj
[ 23%] Building C object CMakeFiles/nlopt.dir/src/algs/crs/crs.c.obj
[ 25%] Building C object CMakeFiles/nlopt.dir/src/algs/mlsl/mlsl.c.obj
[ 27%] Building C object CMakeFiles/nlopt.dir/src/algs/mma/mma.c.obj
[ 29%] Building C object CMakeFiles/nlopt.dir/src/algs/mma/ccsa_quadratic.c.obj
[ 30%] Building C object CMakeFiles/nlopt.dir/src/algs/cobyla/cobyla.c.obj
[ 32%] Building C object CMakeFiles/nlopt.dir/src/algs/newuoa/newuoa.c.obj
[ 34%] Building C object CMakeFiles/nlopt.dir/src/algs/neldermead/nldrmd.c.obj
[ 36%] Building C object CMakeFiles/nlopt.dir/src/algs/neldermead/sbplx.c.obj
[ 38%] Building C object CMakeFiles/nlopt.dir/src/algs/auglag/auglag.c.obj
[ 40%] Building C object CMakeFiles/nlopt.dir/src/algs/bobyqa/bobyqa.c.obj
[ 41%] Building C object CMakeFiles/nlopt.dir/src/algs/isres/isres.c.obj
[ 43%] Building C object CMakeFiles/nlopt.dir/src/algs/slsqp/slsqp.c.obj
[ 45%] Building C object CMakeFiles/nlopt.dir/src/algs/esch/esch.c.obj
[ 47%] Building C object CMakeFiles/nlopt.dir/src/api/general.c.obj
[ 49%] Building C object CMakeFiles/nlopt.dir/src/api/options.c.obj
[ 50%] Building C object CMakeFiles/nlopt.dir/src/api/optimize.c.obj
[ 52%] Building C object CMakeFiles/nlopt.dir/src/api/deprecated.c.obj
[ 54%] Building C object CMakeFiles/nlopt.dir/src/api/f77api.c.obj
[ 56%] Building C object CMakeFiles/nlopt.dir/src/util/mt19937ar.c.obj
[ 58%] Building C object CMakeFiles/nlopt.dir/src/util/sobolseq.c.obj
[ 60%] Building C object CMakeFiles/nlopt.dir/src/util/timer.c.obj
[ 61%] Building C object CMakeFiles/nlopt.dir/src/util/stop.c.obj
[ 63%] Building C object CMakeFiles/nlopt.dir/src/util/redblack.c.obj
[ 65%] Building C object CMakeFiles/nlopt.dir/src/util/qsort_r.c.obj
[ 67%] Building C object CMakeFiles/nlopt.dir/src/util/rescale.c.obj
[ 69%] Building CXX object CMakeFiles/nlopt.dir/src/algs/stogo/global.cc.o
[ 70%] Building CXX object CMakeFiles/nlopt.dir/src/algs/stogo/linalg.cc.o
[ 72%] Building CXX object CMakeFiles/nlopt.dir/src/algs/stogo/local.cc.o
[ 74%] Building CXX object CMakeFiles/nlopt.dir/src/algs/stogo/stogo.cc.o
[ 76%] Building CXX object CMakeFiles/nlopt.dir/src/algs/stogo/tools.cc.o
[ 78%] Building CXX object CMakeFiles/nlopt.dir/src/algs/ags/evolvent.cc.o
[ 80%] Building CXX object CMakeFiles/nlopt.dir/src/algs/ags/solver.cc.o
[ 81%] Building CXX object CMakeFiles/nlopt.dir/src/algs/ags/local_optimizer.cc.o
[ 83%] Building CXX object CMakeFiles/nlopt.dir/src/algs/ags/ags.cc.o
[ 85%] Linking CXX shared library libnlopt.dll
[ 85%] Built target nlopt
Scanning dependencies of target testopt
[ 87%] Building C object test/CMakeFiles/testopt.dir/testfuncs.c.obj
[ 89%] Building C object test/CMakeFiles/testopt.dir/testopt.c.obj
[ 90%] Building C object test/CMakeFiles/testopt.dir//src/util/timer.c.obj
[ 92%] Building C object test/CMakeFiles/testopt.dir//src/util/mt19937ar.c.obj
[ 94%] Building C object test/CMakeFiles/testopt.dir/__/src/util/nlopt-getopt.c.obj
[ 96%] Linking CXX executable testopt.exe
[ 96%] Built target testopt
Scanning dependencies of target t_tutorial
[ 98%] Building CXX object test/CMakeFiles/t_tutorial.dir/t_tutorial.cxx.o
[100%] Linking CXX executable t_tutorial.exe
[100%] Built target t_tutorial
"make install" outputs are: (I run as Administrator.)
make install
[ 85%] Built target nlopt
[ 96%] Built target testopt
[100%] Built target t_tutorial
Install the project...
-- Install configuration: "Release"
-- Installing: C:/Program Files (x86)/nlopt/lib/pkgconfig/nlopt.pc
-- Installing: C:/Program Files (x86)/nlopt/include/nlopt.h
-- Installing: C:/Program Files (x86)/nlopt/include/nlopt.hpp
-- Installing: C:/Program Files (x86)/nlopt/include/nlopt.f
-- Installing: C:/Program Files (x86)/nlopt/lib/libnlopt.dll.a
-- Installing: C:/Program Files (x86)/nlopt/bin/libnlopt.dll
-- Installing: C:/Program Files (x86)/nlopt/lib/cmake/nlopt/NLoptLibraryDepends.cmake
-- Installing: C:/Program Files (x86)/nlopt/lib/cmake/nlopt/NLoptLibraryDepends-release.cmake
-- Installing: C:/Program Files (x86)/nlopt/lib/cmake/nlopt/NLoptConfig.cmake
-- Installing: C:/Program Files (x86)/nlopt/lib/cmake/nlopt/NLoptConfigVersion.cmake
-- Up-to-date: C:/Program Files (x86)/nlopt/share/man/man3/nlopt.3
-- Up-to-date: C:/Program Files (x86)/nlopt/share/man/man3/nlopt_minimize.3
-- Up-to-date: C:/Program Files (x86)/nlopt/share/man/man3/nlopt_minimize_constrained.3
The text was updated successfully, but these errors were encountered: