question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Description

What steps will reproduce the problem?

Attempted to use variable explorer to edit an integer within an object from package: pymc3, class: multitrace

Traceback

  File "C:\ProgramData\Anaconda3_\envs\GANS2\lib\site-packages\spyder\plugins\variableexplorer\widgets\collectionsdelegate.py", line 273, in <lambda>
    lambda eid=id(editor): self.editor_accepted(eid))
  File "C:\ProgramData\Anaconda3_\envs\GANS2\lib\site-packages\spyder\plugins\variableexplorer\widgets\collectionsdelegate.py", line 566, in editor_accepted
    self.set_value(index, conv_func(value))
  File "C:\ProgramData\Anaconda3_\envs\GANS2\lib\site-packages\spyder\plugins\variableexplorer\widgets\collectionsdelegate.py", line 442, in set_value
    index.model().set_value(index, value)
  File "C:\ProgramData\Anaconda3_\envs\GANS2\lib\site-packages\spyder\plugins\variableexplorer\widgets\objectexplorer\tree_model.py", line 539, in set_value
    setattr(parent, obj_name, value)
AttributeError: can't set attribute

Versions

  • Spyder version: 4.1.5
  • Python version: 3.8.5
  • Qt version: 5.9.7
  • PyQt5 version: 5.9.2
  • Operating System: Windows 10

Dependencies


# Mandatory:
atomicwrites >=1.2.0           :  1.4.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.6.0 (OK)
diff_match_patch >=20181111    :  20200713 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.21.0 (OK)
jedi =0.17.1                   :  0.17.1 (OK)
nbconvert >=4.0                :  6.0.7 (OK)
numpydoc >=0.6.0               :  1.1.0 (OK)
paramiko >=2.4.0               :  2.7.2 (OK)
parso =0.7.0                   :  0.7.0 (OK)
pexpect >=4.4.0                :  4.8.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.8.0 (OK)
pygments >=2.0                 :  2.8.0 (OK)
pylint >=1.0                   :  2.7.1 (OK)
pyls >=0.34.0;<1.0.0           :  0.35.1 (OK)
qdarkstyle >=2.8               :  2.8.1 (OK)
qtawesome >=0.5.7              :  1.0.1 (OK)
qtconsole >=4.6.0              :  5.0.2 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
rtree >=0.8.3                  :  0.9.4 (OK)
sphinx >=0.6.6                 :  3.5.1 (OK)
spyder_kernels >=1.9.4;<1.10.0 :  1.9.4 (OK)
watchdog                       :  None (OK)
zmq >=17                       :  20.0.0 (OK)

# Optional:
cython >=0.21                  :  0.29.22 (OK)
matplotlib >=2.0.0             :  3.3.4 (OK)
numpy >=1.7                    :  1.19.2 (OK)
pandas >=0.13.1                :  1.2.1 (OK)
scipy >=0.17.0                 :  1.6.1 (OK)
sympy >=0.7.3                  :  1.7.1 (OK)

# Spyder plugins:
spyder_notebook                :  0.3.2 (OK)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ccordoba12commented, Apr 5, 2021

Thanks @marcchale for the code.

@dalthviz, please try to reproduce this one because it’s related to the Object Explorer.

0reactions
marcchalecommented, Apr 5, 2021

@ccordoba12 @steff456 I was able to recreate the error by running the following code (adapted from pymc3 documentation) then opening the variable trace from the variable explorer, then clicking on “chains”, clicking on “1” and trying to change the value to another number. You may need to install a few libraries (sorry)

"""
Created on Mon Apr  5 14:49:05 2021

@author: mchale
"""
#%% Import things
import sys
import warnings
import os
os.chdir('C:/Users/mchale/OneDrive/AFIT/Research/Mini-Prospectus/GAN Code/gml-cyber/gml-cyber-master')   # Change current working directory
print('WD Updated to', str(os.getcwd()))

# Useful libraries
import pymc3 as pm
import numpy as np
import matplotlib.pyplot as plt
from theano.tensor.nlinalg import matrix_inverse
from ellipse import plot_ellipse
from print_summary import print_summary
import importKDD
import seaborn as sb
sb.set() 
import pickle # python3
import arviz as az
import math
import pandas as pd
from sklearn import preprocessing
import time
import plotly.express as px
import seaborn as sns
from ipywidgets import widgets
from pyDOE2 import *
import warnings

#%% Create Some data in 2D

# True parameter values
alpha, sigma = 1, 1
beta = [1, 2.5]

# Size of dataset
size = 100

# Predictor variable
X1 = np.random.randn(size)
X2 = np.random.randn(size) * 0.2

# Simulate outcome variable
Y = alpha + beta[0] * X1 + beta[1] * X2 + np.random.randn(size) * sigma




#%% Setup Pymc3 model
#%config InlineBackend.figure_format = 'retina'
# Initialize random number generator
RANDOM_SEED = 8927
np.random.seed(RANDOM_SEED)
az.style.use("arviz-darkgrid")

print(f"Running on PyMC3 v{pm.__version__}")


basic_model = pm.Model()

with basic_model:

    # Priors for unknown model parameters
    alpha = pm.Normal("alpha", mu=0, sigma=10)
    beta = pm.Normal("beta", mu=0, sigma=10, shape=2)
    sigma = pm.HalfNormal("sigma", sigma=1)

    # Expected value of outcome
    mu = alpha + beta[0] * X1 + beta[1] * X2

    # Likelihood (sampling distribution) of observations
    Y_obs = pm.Normal("Y_obs", mu=mu, sigma=sigma, observed=Y)

# Fit model with NUTS Sampling
with basic_model:
    # draw 500 posterior samples
    trace = pm.sample(500, return_inferencedata=False)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Overriding val in scala - Stack Overflow
You don't need to use the override keyword to override a var field in a subclass (or trait), but you do need to...
Read more >
Scala | Field Overriding - GeeksforGeeks
In order to execute a Field Overriding, we need to override variables that are declared utilizing only the val keyword in both super...
Read more >
Override object inner trait - Google Groups
I go an "overriding object writes in trait BaseEnum" but my eclipse said all is ok. I wonder why it's impossible to override...
Read more >
Object.assign() - JavaScript - MDN Web Docs
The Object.assign() method copies all enumerable own properties from one or more ... Later sources' properties overwrite earlier ones.
Read more >
Override only specified val property defaults? - Support
I am wondering if Kotlin provides a type-safe way to construct an object whose properties are val s by providing only a dynamically...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found