I get an error about cvxpy.Parameter objects being initialized with an unexpected keyword argument, "sign". This must be some kind of install error.
I've gotten this error with new installs in a couple places: in a new conda environment on MacOSX and on Linux machines otherwise following the conda install instructions exactly.
Traceback (most recent call last):
File "idLogit.py", line 234, in <module>
actual_run( L )
File "idLogit.py", line 224, in actual_run
betas , delta , loglk , success = trace_idLogit( I , A , N , inds , LR , y )
File "idLogit.py", line 156, in trace_idLogit
p , Lambda , prob , YX = make_idLogit( I , A , N , inds , LR , y )
File "idLogit.py", line 126, in make_idLogit
Lambda = cp.Parameter( sign="positive" )
File "/Users/morrowwr/anaconda/envs/cvxpy/lib/python3.6/site-packages/cvxpy/expressions/constants/parameter.py", line 44, in __init__
super(Parameter, self).__init__(shape, value, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'sign'
We only support CVXPY 1.0 and later now. For any older version of CVXPY, you'll need to solve your own problems. Sorry to be harsh but I don't want a Python 2 vs 3 situation!
Might want to ask some questions before closing. This is 1.0.1, according to conda list
GSB-C02TF2BAGTFL:runs morrowwr$ source activate cvxpy
(cvxpy) GSB-C02TF2BAGTFL:runs morrowwr$ conda list
# packages in environment at /Users/morrowwr/anaconda/envs/cvxpy:
#
# Name Version Build Channel
blas 1.0 openblas
ca-certificates 2018.03.07 0
certifi 2018.4.16 py36_0
cvxcanon 0.1.1 py36_0 cvxgrp
cvxpy 1.0.1 py36_0 cvxgrp
dill 0.2.7.1 py36hdf89ffe_0
ecos 2.0.5 py36hf9b3073_0 cvxgrp
fastcache 1.0.2 py36h1de35cc_2
intel-openmp 2018.0.0 8
lapack 3.6.1 1 conda-forge
libcxx 4.0.1 h579ed51_0
libcxxabi 4.0.1 hebd6815_0
libedit 3.1.20170329 hb402a30_2
libffi 3.2.1 h475c297_4
libgcc 4.8.5 hdbeacc1_10
libgfortran 3.0.1 h93005f0_2
libopenblas 0.2.20 hdc02c5d_7
mkl 2018.0.2 1
multiprocess 0.70.4 py36_0 cvxgrp
ncurses 6.1 h0a44026_0
numpy 1.14.3 py36he6379a5_2
numpy-base 1.14.3 py36h9797aa9_2
openssl 1.0.2o h26aff7b_0
pandas 0.23.0 py36h1702cab_0
pip 10.0.1 py36_0
python 3.6.5 hc167b69_1
python-dateutil 2.7.3 py36_0
pytz 2018.4 py36_0
readline 7.0 hc1231fa_4
scipy 1.1.0 py36hcaad992_0
scs 1.2.6 py36_0 cvxgrp
setuptools 39.2.0 py36_0
six 1.11.0 py36h0e22d5e_1
sqlite 3.23.1 hf1716c9_0
tk 8.6.7 h35a86e2_3
toolz 0.9.0 py36_0
wheel 0.31.1 py36_0
xz 5.2.4 h1de35cc_4
zlib 1.2.11 hf3cbc9b_2
(cvxpy) GSB-C02TF2BAGTFL:runs morrowwr$ python
Python 3.6.5 |Anaconda, Inc.| (default, Apr 26 2018, 08:42:37)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cvxpy as cp
>>> cp.Parameter( sign="positive" )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/morrowwr/anaconda/envs/cvxpy/lib/python3.6/site-packages/cvxpy/expressions/constants/parameter.py", line 44, in __init__
super(Parameter, self).__init__(shape, value, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'sign'
I received the same error trying to follow along with the examples here.
gamma = Parameter(sign='positive')
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/anaconda3/lib/python3.6/site-packages/cvxpy/expressions/constants/parameter.py", line 44, in __init__
super(Parameter, self).__init__(shape, value, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'sign'
The Parameter(sign='positive') is CVXPY 0.4 syntax. In CVXPY 1.0 you write Parameter(nonneg=True), as discussed here: http://www.cvxpy.org/updates/index.html#attributes
I updated the examples you pointed to to use the new syntax.
Thank you.
Most helpful comment
The
Parameter(sign='positive')is CVXPY 0.4 syntax. In CVXPY 1.0 you writeParameter(nonneg=True), as discussed here: http://www.cvxpy.org/updates/index.html#attributesI updated the examples you pointed to to use the new syntax.