How to solve problem with CVX toolbox

How can I solve this error in order to implement the CVX toolbox?

This is the output I got:

cvx_setup


CVX: Software for Disciplined Convex Programming (c)2014 CVX Research
Version 3.0beta, Build 1183 (dda2109) Sun Dec 17 18:58:10 2017

Installation info:
Path: /Users/merelwinters/Downloads/cvx
MATLAB version: 9.14 (R2023a)
OS: Mac OS X x86_64 version 12.6.7
Java version: 1.8.0_202
Verfying CVX directory contents:
WARNING: The following files/directories are missing:
/Users/merelwinters/Downloads/cvx/gurobi/maci64/gurobi.mexmaci64
/Users/merelwinters/Downloads/cvx/lib/cvx_classify_mex.mexmaci64
/Users/merelwinters/Downloads/cvx/mosek/maci64/mosekopt.mexmaci64
These omissions may prevent CVX from operating properly.
WARNING: The following extra files/directories were found:
/Users/merelwinters/Downloads/cvx/shims/cvx_license.dat
These files may alter the behavior of CVX in unsupported ways.

ERROR: the following CVX MEX files are missing:
/Users/merelwinters/Downloads/cvx/lib/cvx_classify_mex.mexmaci64
CVX will not operate without these files. Please visit
Download CVX | CVX Research, Inc.
and download a distribution built for this platform.

ERROR: ----------------------
Error using cvx_setup
Error detected by cvx_version
-----------------------------

The installation of CVX was not completed. Please correct the error
and re-run CVX_SETUP.

I tried rerunning the CVX setup, but unfortunately it doesn’t work. Does anyone know how to solve this?

Do not use CVX 3.0beta. It is riddled with bugs which will never be fixed.

Remove all directories associated with CVX from your MATLAB path. Then start a new session of MATLAB, and install CVX 2.2.

Thank you for your response. Unfortunately, also when deleting all cvx files and downloading the 2.2 version, I still get an error.

cvx_setup


CVX: Software for Disciplined Convex Programming (c)2014 CVX Research
Version 2.2, Build 1148 (62bfcca) Tue Jan 28 00:51:35 2020

Installation info:
Path: /Users/merelwinters/Downloads/cvx
MATLAB version: 9.14 (R2023a)
OS: Mac OS X x86_64 version 12.6.7
Java version: 1.8.0_202
Verfying CVX directory contents:
WARNING: The following files/directories are missing:
/Users/merelwinters/Downloads/cvx/sedumi/.travis.yml
These omissions may prevent CVX from operating properly.
Preferences: error during load:
Your CVX preferences file seems out of date; default preferences will
be used.
License host:
Username: merelwinters
Host ID: 14c213039f8c (en0,192.168.1.44)
Installed license:
No license installed.
No valid licenses found.
Click here to fill out an academic license request
for the username and first hostid listed above.

Setting CVX paths…already set!
Searching for solvers…5 shims found.
2 solvers initialized (* = default):

  • SDPT3 4.0 {cvx}/sdpt3
    SeDuMi 1.3.4 {cvx}/sedumi
    3 solvers skipped:
    GLPK
    Could not find a GLPK installation.
    Gurobi unknown {cvx}/gurobi/maci64
    Invalid MEX-file
    ‘/Users/merelwinters/Downloads/cvx/gurobi/maci64/gurobi.mexmaci64’:
    dlopen(/Users/merelwinters/Downloads/cvx/gurobi/maci64/gurobi.mexmaci64,
    0x0006): tried:
    ‘/Users/merelwinters/Downloads/cvx/gurobi/maci64/gurobi.mexmaci64’
    (code signature in
    ‘/Users/merelwinters/Downloads/cvx/gurobi/maci64/gurobi.mexmaci64’
    not valid for use in process: library load disallowed by
    system policy)
    Mosek unknown {cvx}/mosek/maci64
    Unexpected MEX file failure:
    Invalid MEX-file
    ‘/Users/merelwinters/Downloads/cvx/mosek/maci64/mosekopt.mexmaci64’:
    dlopen(/Users/merelwinters/Downloads/cvx/mosek/maci64/mosekopt.mexmaci64,
    0x0006): tried:
    ‘/Users/merelwinters/Downloads/cvx/mosek/maci64/mosekopt.mexmaci64’
    (code signature in <7F764D39-9B9D-361F-B88C-A6D8F88DC664>
    ‘/Users/merelwinters/Downloads/cvx/mosek/maci64/mosekopt.mexmaci64’
    not valid for use in process: library load disallowed by
    system policy)
    Saving updated preferences…done.
    Testing with a simple model…
    UNEXPECTED ERROR: -------------------------------------------------------
    Invalid MEX-file
    ‘/Users/merelwinters/Downloads/cvx/lib/cvx_bcompress_mex.mexmaci64’:
    dlopen(/Users/merelwinters/Downloads/cvx/lib/cvx_bcompress_mex.mexmaci64,
    0x0006): tried:
    ‘/Users/merelwinters/Downloads/cvx/lib/cvx_bcompress_mex.mexmaci64’
    (code signature in

    ‘/Users/merelwinters/Downloads/cvx/lib/cvx_bcompress_mex.mexmaci64’
    not valid for use in process: library load disallowed by system
    policy)
    Error in cvx_bcompress (line 29)
    [ ndxs, scls ] = cvx_bcompress_mex( sparse( x ), mode, num_sorted
    );
    Error in cvx/bcompress (line 21)
    [ xR, xb ] = cvx_bcompress( xb, mode, nsrt );
    Error in cvx/svec (line 13)
    [ xR, y ] = bcompress( x );
    Error in cvx/norm (line 46)
    x = svec( x, p );
    Error in cvx_setup (line 212)
    minimize( norm(A*x-b,1) );

Please report this error to support, and include entire output of
CVX_SETUP in your support request.

I think you can ignore
## WARNING: The following files/directories are missing: /Users/merelwinters/Downloads/cvx/sedumi/.travis.yml
which perhaps everyone gets, and I think is harmless.

As for gurobi and mosek, are they installed and working under MATLAB? If so, I think they should not produce those error messages. If those solvers are not installed under MATLAB, then you can ignore those messages, and use either SeDuMi or SDPT3 as solver.

So you mean that if I am not using gurobi and mosek as solvers, I can ignore all errors and the cvx toolbox should work just fine?

As far as I know.

If you do get an error using SDPT3 or SeDuMi., you can report the details here.

When I try to solve a simple optimization problem like this:

A = randn(5, 3);
b = randn(5, 1);

cvx_begin
variable x(3);
minimize(norm(A*x - b, 1))
subject to
-0.5 <= x;
x <= 0.3;
cvx_end

I still get an error, namely:
Warning: A non-empty cvx problem already exists in this scope.
It is being overwritten.

In cvxprob (line 28)
In cvx_begin (line 41)
In Example1 (line 4)
Unrecognized function or variable ‘cvx_bcompress_mex’.

Error in cvx_bcompress (line 29)
[ ndxs, scls ] = cvx_bcompress_mex( sparse( x ), mode, num_sorted );

Error in cvx/bcompress (line 21)
[ xR, xb ] = cvx_bcompress( xb, mode, nsrt );

Error in cvx/svec (line 13)
[ xR, y ] = bcompress( x );

Error in cvx/norm (line 46)
x = svec( x, p );

Error in Example1 (line 6)
minimize(norm(A*x - b, 1))

This might be related to using a Mac. I’,m not a Mac person.

Anyhow, you can try specifying a different solver.

You can try removing all CVX directories from MATLAB path, starting a new MATLAB session, and reinstalling CVX. I don’t know whether that will help.

Yeah unfortunately I’ve already tried that a couple of times and it didn’t help. It worked for a previous version of matlab so I might try using an older version then. Thanks for your help!