Using Python nlopt on Slicer

Hello

I am trying to use a library called NLopt in Slicer for module development, but I am having a very difficult time getting it to work.

What I did was to download the .whl file of NLopt provided by the authors found here and ran

pip.main(["install", "C:\Users\Stewart\Downloads\NLopt-2.4.2-cp27-cp27m-win_amd64.whl"]) 

It prompted that the install was successful, but when I try to import the module, I get the following error:
image

Then I built the source code of NLopt, then proceeded to place the .dll file in the Slicer Python’s site packages like so:
image
but it still gives me the same errors.

When I pip install the .whl file through my command prompt and import it, it works fine.

I realize that this is a very specific question, but does anyone have any good suggestions on what to do, or got Python NLopt to work with Slicer?

Thank you!

Chad Paik

Slicer uses Python 2.7, built using Visual Studio 2015. You need to build NLopt with Slicer’s Python, using Visual Studio 2015, similarly to how numpy is built. After we release Slicer-4.10, we’ll start migrating to Python3 and then it’ll be possible to pip install any packages.