ModuleNotFoundError: No module named '_nlopt' (Part 2)

225 views Asked by At

I have the same problem that was presented here.

I am not using anaconda.

I am attempting to run a program importing nlopt in Pycharm and have downloaded the nlopt package in the package installer. After installing it there, I still get the same error message.

Then I tried to install it via the command prompt: pip3 install nlopt

I am still getting the same error.

What could be the problem? I am not having this problem with other packages such as numpy, pandas, scipy, matplotlib, etc.

1

There are 1 answers

0
syockit On

Don't install from pypi. Download the wheel from here instead: https://www.lfd.uci.edu/~gohlke/pythonlibs/#nlopt (it's linked to from NLopt's documentation, under the section NLopt on Windows). Choose the version that matches your Python version. For example, if it's Python 3.11, you should download then one containing cp311.

To install it, execute the following in a command prompt or terminal

pip install path_to_wheel.whl

where path_to_wheel.whl is where you downloaded the wheel.


Just for the record, the one from pypi.org mysteriously contains both _nlopt.pyd and nlopt.dll. The one from the above link only has _nlopt.pyd.