Error using snoptmex

459 views
Skip to first unread message

chunan...@gmail.com

unread,
Jun 1, 2018, 5:32:18 PM6/1/18
to SNOPT
Hi, I downloaded the snoptV2.5.0 folder and the licence file snopt7.lic, I added all the folders to matlab path, including the folder for 'snoptmex.mexw64'. I run this command: setenv('SNOPT_LICENSE','E:\GPOPS_II\nlp\snopt\matlab\snopt7.lic'), this is where I keep the license file. Then I ran 'runNPexample.m'. But I got the error: -----
Error using snoptmex
XXX Please set SNOPT_LICENSE to the the license file
Error in snopt (line 294)
xstate,Fstate,itn,mjritn] = snoptmex(solveopt, ...
Error in t1diet (line 12)
[x,F,INFO,xmul,Fmul,xstate,Fstate,output]= snopt( x, xlow, xupp, xmul, xstate, ...
Error in runNPexamples (line 11)
[x,xmul,F,Fmul,info] = t1diet;

I am using Matlab 2016a, Win10. How can I solve this problem? Thanks in advance!

SNOPT

unread,
Jun 4, 2018, 12:55:13 PM6/4/18
to SNOPT
Hi,

If you do 'getenv' in matlab, do you see the correct directory?

--Elizabeth

alexan...@gmail.com

unread,
Jun 4, 2018, 1:23:47 PM6/4/18
to SNOPT

Hello everyone.

I am having the same issue. I put the license in:

C:\Users\alexandre.oliveira\Documents\MATLAB\lic-snopt\snopt-matlab-2.5.0\matlab


>> setenv('SNOPT_LICENSE','C:\Users\alexandre.oliveira\Documents\MATLAB\lic-snopt\snopt-matlab-2.5.0\matlab\snopt7.lic')
>> getenv('SNOPT_LICENSE')
ans =
C:\Users\alexandre.oliveira\Documents\MATLAB\lic-snopt\snopt-matlab-2.5.0\matlab\snopt7.lic
>> runNPexamples

=============================================================
sntoy: Solving diet LP problem using SNOPT ...

Begin t1diet problem

SNSPEC EXIT 100 -- finished successfully
SNSPEC INFO 101 -- SPECS file read

Trial version of SNOPT -- for evaluation or academic purposes only


Error using snoptmex
XXX Please set SNOPT_LICENSE to the the license file
Error in snopt (line 294)
xstate,Fstate,itn,mjritn] = snoptmex(solveopt, ...
Error in t1diet (line 12)
[x,F,INFO,xmul,Fmul,xstate,Fstate,output]= snopt( x, xlow, xupp, xmul, xstate, ...

Error in runNPexamples (line 10)
[x,xmul,F,Fmul,info] = t1diet;

I think it is the same problem that you are having.

Thanks in advance for any help in fixing this issue.

Att.
Alexandre Oliveira.

chunan...@gmail.com

unread,
Jun 4, 2018, 1:31:04 PM6/4/18
to SNOPT

Yeah it is the same problem as mine. I did getenv('SNOPT_LICENSE') and I got the right directory back. The message I got after running 'runNPexamples' is exactly the same with Alexandre Oliveira's.

I wonder if this is because I did not install some other toolboxes?

SNOPT

unread,
Jun 4, 2018, 1:45:42 PM6/4/18
to SNOPT
The path might be too long.  For reasons I won't go into, there's a limit on the length of the SNOPT_LICENSE path.  Try putting the license file in the "current" directory so you can do setenv('SNOPT_LICENSE','./snopt7.lic')

--Elizabeth

Chunan Huang

unread,
Jun 4, 2018, 2:22:08 PM6/4/18
to SNOPT
unfortunately, it is not because of that... This is what I did:
>> setenv('SNOPT_LICENSE','./snopt7.lic')
>> getenv('SNOPT_LICENSE')
ans =
./snopt7.lic

And when I run 'runNPexamples' the error message is same as before.

I also tried with this 'E:\snopt7.lic' directory, and it did not solve the problem.

--
You received this message because you are subscribed to a topic in the Google Groups "SNOPT" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/snopt/SWV0gKj4Nis/unsubscribe.
To unsubscribe from this group and all its topics, send an email to snopt+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

SNOPT

unread,
Jun 4, 2018, 3:00:59 PM6/4/18
to SNOPT
That's very strange.  I'm not really sure what's wrong. I just checked our distributable libraries and it worked for me on 2018a.  That particular error message should only print if the program thinks SNOPT_LICENSE does not exists (i.e., it hasn't been set) so there seems to be an issue with the program picking up the environment variable from Matlab.  I'll investigate further...

--Elizabeth

alexan...@gmail.com

unread,
Jun 4, 2018, 3:48:38 PM6/4/18
to SNOPT
Em sexta-feira, 1 de junho de 2018 18:32:18 UTC-3, chunan...@gmail.com escreveu:


I got the same error. I am also using R2016a. Could the problem be the matlab version?

SNOPT

unread,
Jun 6, 2018, 5:19:24 PM6/6/18
to SNOPT
Ok.  Can confirm for some reason, 'setenv' isn't working in r2016a.

As an alternative, you can set the environment variable outside of Matlab. Go into the Control Panel --> System and Security --> System.  On the left sidebar, click on "Advanced system settings".  Then click on "Environment variables..." and add a new entry for SNOPT_LICENSE and the appropriate value.  When you restart Matlab, it should pick it up when you do 'runNPexamples'.  I tried this on r2016a and it did seem to work.  Let me know though if that is not the case...

--Elizabeth

alexan...@gmail.com

unread,
Jun 7, 2018, 1:47:01 PM6/7/18
to SNOPT
Problem solved! Thank you Elizabeth!
Message has been deleted

Luke Hunsberger

unread,
May 21, 2024, 8:05:09 AM5/21/24
to SNOPT
hi,
how would you do this in mac os?  i am having the same issue?
thanks,
luke

Reply all
Reply to author
Forward
0 new messages