'IndexedUncParam' object has no attribute '_index'
rnquezada opened this issue · 5 comments
Hi, I already install git and romodel package. I run the Knapsack problem code and got the following error:
ERROR: Constructing component 'w' from data=None failed: AttributeError:
'IndexedUncParam' object has no attribute '_index'
Traceback (most recent call last):
File ~\OneDrive - Colbun S.A\12 Colbún\11 PPA Optimo\Corrida\robust.py:64 in
m = Knapsack()
File ~\OneDrive - Colbun S.A\12 Colbún\11 PPA Optimo\Corrida\robust.py:33 in Knapsack
M.w = UncParam(M.ITEMS, uncset=M.E, nominal=w)
File ~\Anaconda3\lib\site-packages\pyomo\core\base\block.py:544 in setattr
self.add_component(name, val)
File ~\Anaconda3\lib\site-packages\pyomo\core\base\block.py:1089 in add_component
val.construct(data)
File ~\Anaconda3\lib\site-packages\romodel\uncparam.py:219 in construct
for ndx in self._index:
AttributeError: 'IndexedUncParam' object has no attribute '_index'
Do you know what could be the problem?
Thanks.
Hi,
I am also getting the same error. Do you get the workaround of this issue? please let me know
+1 this issue since I am also getting it.
@tambesupriya @rnquezada I have solved this issue by specifying the pyomo version and not installing from the pip command, since setup.py and requirements specify >=6.0, which is ahead of the romodel code. Additionally I have noticed that the release information printed out while installing is not updated (version is v.0.1.0 but the shown information while installing is v.0.0.2).
My quick fix is therefore to specify "pyomo==6.0" and "pyutilib" in the requirements.txt and setup.py and try again.
Thanks @ddceruti for fixing this issue. This works for me also. Which python version(2 or 3) are you using? I am using 3. Are you able to executes all examples along with the output of objective function?
Which python version(2 or 3) are you using? I am using 3. Are you able to executes all examples along with the output of objective function?
I was using python 3.10 and did not throughly check the other problems. Glad you could quickfix the issue.