Originally posted by: pentunia
I always end up with same error:
'import pycplex121
ImportError: DLL load failed: The specified module could not be found.'
ILOG CPLEX Teaching Edition version 12.1, Windows XP SP3, Python version 2.6.4, Numpy
I have rebooted and retried- same issues.
I'm suppose to learn these tutorials, but I'm having the hardest time :/
Sorry for the long post, I have tried so many things, spent soooo much time on this.
Summary of what I have tried:
INSTALL CPLEX ADD-INS FOR PYTHON:
I have followed a number of manuals,docs post etc, for instance:
C:\ILOG\CPLEX121tetrial\doc\ps_gscplex.pdf pg 236
1. Added a New Environment / System variable:
Variable name: PYTHONPATH
Variable value: C:\ILOG\CPLEX121tetrial\python\x86_win32
Have tried these values as well:
C:\ILOG\CPLEX121tetrial\python\x86_win32\lib
C:\ILOG\CPLEX121tetrial\python\x86_win32\lib\cplex
2. Open a cmd prompt window and enter these cmds:
cd C:\ILOG\CPLEX121tetrial\python\x86_win32
python setup.py install
running install
running build
running build_py
creating build
creating build\lib
creating build\lib\cplex
copying cplex\callbacks.py -> build\lib\cplex
<snip>
Writing C:\Python26\Lib\site-packages\cplex-12.1.0-py2.6.egg-info
Reply no errors, seems fine?
(I've also tried: python setup.py build --build-base=\ILOG\CPLEX121tetrial\python\x86_win32
and reinstalling all soft, etc )
3. Another doc said to, so I did:
Copy C:\ILOG\CPLEX121tetrial\bin\x86_win32\cplex121.dll
To: C:\ILOG\CPLEX121tetrial\examples\src\python\cplex121.dll
4. (pg 237) Open a cmd prompt window, type in:
python
import cplex
or
from cplex import *
or
import cplex as NAME
All give the same error:
<snip>
import pycplex121
ImportError: DLL load failed: The specified module could not be found.
5. Open a cmd prompt window and type in:
cd C:\ILOG\CPLEX121tetrial\examples\src\python
python
execfile("diet.py")
Reply: Always errors, for all .py files. Error msg's always end with:
File "C:\ILOG\CPLEX121tetrial\python\x86_win32\cplex\_internal\_pycplex.py", line 5, in <module>
import pycplex121
ImportError: DLL load failed: The specified module could not be found.
All same errors:
execfile("lpex1.py")
cpx.read("file.lp")
cpx = cplex.Cplex("file.lp")
Same errors if I use the Python command line and/or the Python IDLE (Python GUI)
The only files I could find name pycplex121 is pycplex121.pyd
google.com didn't find anything named pycplex121
I do have: C:\Python26\Lib\site-packages\cplex\_internal\_pycplex.py
when I try to run it, same error:
C:\Python26\Lib\site-packages\cplex\_internal>python _pycplex.py
Traceback (most recent call last):
File "_pycplex.py", line 5, in <module>
import pycplex121
ImportError: DLL load failed: The specified module could not be found.
6. I then tried using 'http://pycplex.googlecode.com/files/pycplex-2.0.zip'
After setting that up I ended up with thee same errors :(
7. I then try:
Copying pycplex121.pyd C:\ILOG\CPLEX121tetrial\python\x86_win32
Then in a cmd prompt window:
python
import cplex
Reply: same errors:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "cplex\__init__.py", line 149, in <module>
import callbacks
File "cplex\callbacks.py", line 47, in <module>
from _internal._aux_functions import apply_freeform_two_args, apply_freeform_one_arg
File "cplex\_internal\__init__.py", line 19, in <module>
import _list_array_utils
File "cplex\_internal\_list_array_utils.py", line 13, in <module>
import _pycplex as CPX
File "cplex\_internal\_pycplex.py", line 5, in <module>
import pycplex121
ImportError: DLL load failed: The specified module could not be found.
8. I then try:
import sys
sys.path.append("C:/ILOG/CPLEX121tetrial/python/x86_win32")
sys.path.append("C:\ILOG\CPLEX121tetrial\python\x86_win32")
import cplex
Reply: Same error
import pycplex121.pyd
same error
I then copy pycplex121.pyd to here:
C:\Python26\DLLs\pycplex121.pyd
Try again:
import cplex
Same error.
Thank you for taking the time to read this mess :)
#CPLEXOptimizers#DecisionOptimization