Updating CasADi on Windows?

288 views
Skip to first unread message

msi

unread,
Jun 24, 2015, 5:54:01 AM6/24/15
to casadi...@googlegroups.com
In the previous version of CasADi I installed the CasADi parts were actually installed in the Python27 directory. Looking at the new istallation instructions, the CasADi installation contains of three folders to be placed anywhere. How should one go about going from an older version to the new? It appears to work to just replace the casadi folder in Python27/Lib/site-packages, but what about the folders include and lib that are also provided? Or should I somehow first de-install the old CasADi and then follow the new installation instructions? If so, how do I do that?

Martin

msi

unread,
Jun 24, 2015, 6:14:44 AM6/24/15
to casadi...@googlegroups.com
After some more testing it doesn't work to just switch the casadi folder. A follow up question is where should the HSL libraries be placed in the new version? If I just drop them in the casadi folder and replace it in site-packages it is not found.

Joris Gillis

unread,
Jun 24, 2015, 7:27:56 AM6/24/15
to casadi...@googlegroups.com
Dear Martin,

This is a quick answer, I will give you a proper one later today or tomorrow.
To get working with your 2.3.0 installation, put the folder where the hsl libraries reside in the LD_LIBRARY_PATH (linux) or PATH (windows) environmental variable.
One way to do this in Python is to use os.environ.

Best regards,
  Joris Gillis

Joris Gillis

unread,
Jun 24, 2015, 1:06:25 PM6/24/15
to casadi...@googlegroups.com
Dear Martin,

Indeed the binaries have had a major overhaul from installers (exe/deb) to zipped folders. The reasons for this are:
 * the ability to let multiple versions of CasADi coexist (the upcoming versions: 2.4.0, 2.5.0 ...)
 * the ability to install CasADi on a machine when you dont have admin rights.

There may be issues with this new approach, so I am very much welcoming your feedback.

I have adapted the wiki pages to address your questions.
In short, it is recommended you remove the old installation first (use the "remove installed programs" functionality on Windows, or sudo dpkg --remove python-casadi in Linux).

Further, it is recommended that you put the unzipped binary somewhere in your home folder, and not in site-packages.

Do not hesistate to ask for more information on this.

Best regards,
   Joris Gillis

Siri Holthe Mathisen

unread,
Aug 25, 2015, 4:14:47 AM8/25/15
to CasADi
Hi Joris,

I'm also looking at the installation instructions on the wiki-page (https://github.com/casadi/casadi/wiki/InstallationInstructions). It says that after extracting the files, you can immediately test out the installation. When I'm working with a previous version of casadi, I don't need to use sys.path.append("casadiinstalldir") and I can't see that I have updated any PYTHONPATH variable. 

In this new installation (it does not look as though it is really installed), it does not work although I use sys.path.append("casadiinstalldir"). 

I have windows 8 64 bit. What I have done is to install Spyder via python(xy), and then download casadi version 2.3 ("looking for the latest version?"). After downloading casadi, I unpacked all files to a folder with the same name in the "downloads" folder. According to the wiki page, everything should work now, but it all sounds a bit too simple =)

I copy the test message in the Casadi wiki page, and nothing works.

My error message is:

runfile(r'C:\Users\Siri Mathisen\.spyder2\.temp.py', wdir=r'C:\Users\Siri Mathisen\.spyder2')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 487, in runfile
    execfile(filename, namespace)
  File "C:\Users\Siri Mathisen\.spyder2\.temp.py", line 11, in <module>
    from casadi import *
  File "C:\Users\Siri Mathisen\Downloads\casadi-python27-numpy1.9.1-v2.3.0\casadi\__init__.py", line 34, in <module>
    CasadiOptions.setCasadiPath(os.path.dirname(__file__))
NameError: name 'CasadiOptions' is not defined
 
Do you know what the mistake can be?

Best regards, Siri Mathisen

Joris Gillis

unread,
Aug 25, 2015, 4:24:50 AM8/25/15
to CasADi
Hello Siri,

Could you show the contents of C:\Users\Siri Mathisen\.spyder2\.temp.py?
What is the error if you don't do sys.path.append?

Best regards,
  Joris

Siri Holthe Mathisen

unread,
Aug 25, 2015, 4:37:15 AM8/25/15
to CasADi
Hi Joris,

Thanks for your quick reply!
In C:\Users\Siri Mathisen\.spyder2\.temp.py, the content is:

# -*- coding: utf-8 -*-
"""
Spyder Editor
This temporary script file is located here:

C:\Users\Siri Mathisen\.spyder2\.temp.py
"""
import sys
sys.path.append("C:\Users\Siri Mathisen\Downloads\casadi-python27-numpy1.9.1-v2.3.0")
from casadi import *
x = MX.sym("x")

Without sys.path.append(..), I get:

runfile(r'C:\Users\Siri Mathisen\.spyder2\.temp.py', wdir=r'C:\Users\Siri Mathisen\.spyder2')
UMD has deleted: casadi.casadi_loader

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 487, in runfile
    execfile(filename, namespace)
  File "C:\Users\Siri Mathisen\.spyder2\.temp.py", line 11, in <module>
    from casadi import *
  File "C:\Users\Siri Mathisen\Downloads\casadi-python27-numpy1.9.1-v2.3.0\casadi\__init__.py", line 34, in <module>
    CasadiOptions.setCasadiPath(os.path.dirname(__file__))
NameError: name 'CasadiOptions' is not defined 

Which looks like the same error message.

Best regards,
Siri 

Joris Gillis

unread,
Aug 25, 2015, 4:47:55 AM8/25/15
to CasADi
As for my second question, what if you open a new terminal first?
Now it unwillingly picked up the changed path.

This may be a Windows 8 specific issue.

Could you run depends.exe (Dependency Walker) on casadi/_casadi.pyd and have a screenshot?
I'll try to replicate on a Windows 8 machine, but this may take some time.

Best regards,
   Joris



Siri Holthe Mathisen

unread,
Aug 25, 2015, 4:56:06 AM8/25/15
to CasADi
Hi Joris,

Yes of course, in a new terminal it gives:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 487, in runfile
    execfile(filename, namespace)
  File "C:\Users\Siri Mathisen\.spyder2\.temp.py", line 11, in <module>
    from casadi import *
ImportError: No module named casadi

Yes, I have also thought it might be windows 8 specific. My computer has a dual boot so I have tried to install casadi on linux mint too, only then I built from sources. But I got a problem with IPOPT, and since I am normally working on a windows 7 machine, I thought I should return to windows 8 (on the dual boot machine) and do the simple install =)

Best regards,
Siri

Joris Gillis

unread,
Aug 25, 2015, 5:00:10 AM8/25/15
to CasADi
Interesting.. Have you tried using the binary on Linux? I'd think there's a fair change it would work.
I'll keep hunting the Windows 8 issue.

   Joris

Siri Holthe Mathisen

unread,
Aug 25, 2015, 5:08:01 AM8/25/15
to CasADi
Yes, I started with the simple solution on Linux too, I can switch and try that again and then see if I can find out (maybe with your help) what the issue is.

When running Dependency Walker, the screenshot is as shown in the attachment.

Siri
screenshot_depends.png

Joris Gillis

unread,
Aug 25, 2015, 5:18:28 AM8/25/15
to CasADi
I cannot reproduce the error in my Windows 8.1

Could you please run another diagnostic:

import sys
sys.path.append("C:\Users\Siri Mathisen\Downloads\casadi-python27-numpy1.9.1-v2.3.0\casadi")

import _casadi
print _casadi

    Joris

Joris Gillis

unread,
Aug 25, 2015, 5:24:07 AM8/25/15
to CasADi
Apparently, it is possible to save the depends.exe information. Could you save it as a txt file and attach, please?

    Joris

Siri Holthe Mathisen

unread,
Aug 25, 2015, 5:28:37 AM8/25/15
to CasADi
The return message then is

runfile(r'C:\Users\Siri Mathisen\.spyder2\.temp.py', wdir=r'C:\Users\Siri Mathisen\.spyder2')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 487, in runfile
    execfile(filename, namespace)
  File "C:\Users\Siri Mathisen\.spyder2\.temp.py", line 12, in <module>
    import _casadi
ImportError: DLL load failed: Den angitte prosedyren ble ikke funnet.
>>> 

Sorry about the Norwegian, the translation is: The given procedure was not found.

Siri

Siri Holthe Mathisen

unread,
Aug 25, 2015, 5:33:05 AM8/25/15
to CasADi
I hope this was what you meant, at least it was what was saveable.

Siri
_casadi_information.txt

Joris Gillis

unread,
Aug 25, 2015, 5:34:01 AM8/25/15
to CasADi
What is start-up line of your IPython shell?
For me it looks like:

Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)]

   Joris

Siri Holthe Mathisen

unread,
Aug 25, 2015, 5:37:58 AM8/25/15
to CasADi
I normally don't use the IPython shell, but a Python interpreter (the other alternative on Spyder), and then the startup line is:

Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32


If I choose an IPython shell, the startup line is

Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)]

Joris Gillis

unread,
Aug 25, 2015, 6:05:57 AM8/25/15
to CasADi
Sorry for the persistent questions, but I would like to solve this :-)

Could you run the 32-bit version of depends.exe on casadi/_casadi.pyd please?
You can find it for example here: http://www.dependencywalker.com/depends22_x86.zip

   Joris

Siri Holthe Mathisen

unread,
Aug 25, 2015, 6:43:41 AM8/25/15
to CasADi
I'm very happy for your persistent questions =) I would also very much like to solve it ;)

I run depends22_x86 on _casadi.pyd, and get the screenshot and the .txt file that I have attached.

Siri
_casadi_information_x86.txt
screenshot_depends22_x86.png

Joris Gillis

unread,
Aug 25, 2015, 7:36:31 AM8/25/15
to CasADi
Okay so it seems you have no 32-bit IEShims.dll on your path.
Could you search your C:/ drive for "IEShims.dll" and show the locattions, sizes, dates?


Also, you may try to reinstall the most recent python(x,y)
     Joris

Joris Gillis

unread,
Aug 25, 2015, 7:42:56 AM8/25/15
to CasADi
If the new python(x,y) does not help, try installing this: http://www.microsoft.com/en-us/download/details.aspx?id=5555
  Joris

Siri Holthe Mathisen

unread,
Aug 25, 2015, 7:57:48 AM8/25/15
to CasADi
Ok: I have 12 of them, and they all lie in the region of:

C:\Windows\WinSxS\amd64_microsoft-windows-ie-ieshims_31bf3856ad364e35_11.0.9600.17937_none_4b0c6e967d6309bd
374 kb, 16.07.2015,

and more as shown in the attachment.

I installed python(x,y) yesterday so I guess it's the most recent one, and I think I will try Linux before migrating over to Visual C++.


screenshot_dll.png
Reply all
Reply to author
Forward
0 new messages