Pyviz Panel Examples Returning Attribute Errors - python

Working through the Panel user guide - any example on this page (https://panel.pyviz.org/user_guide/Components.html) that uses .extend does not seem to be working and is returning
AttributeError: 'Tabs' object has no attribute 'extend'
And the gridspec example returns:
AttributeError: module 'panel' has no attribute 'GridSpec'
Currently using Panel 0.3.1
Ben

Panel is currently at 0.6 (https://anaconda.org/pyviz/panel), and 0.3.1 won't support any of the more recent additions. So you should definitely upgrade, at which point it should match the website. If you do want to run the old version, just use the examples included with the package, which will match what's available in that version.

Not sure this is a version issue: I am using v.0.6.2 and running the following example:
radio_group = pn.widgets.RadioButtonGroup(name='Radio Button Group',
options=['Biology', 'Chemistry', 'Physics'],
button_type='success')
radio_group
also yields the same kind of error:
AttributeError: 'RadioButtonGroup' object has no attribute 'value'

Related

TDA AttributeError

I am new to TDA tools in python and I was implementing a simple code to get familiar with these, but I got a strange error
import tadasets
from ripser import ripser
import persim
circle = tadasets.dsphere(d=1)
dgms = ripser(circle)
persim.plot_diagrams(dgms)
AttributeError: 'dict' object has no attribute 'astype'.
Actually I am working on Jupyter notebook with python version 3.8.3

What I get an attribute error from plotly-dash in PYTHON?

Here You can see a Colab code. I basically try to run those codes but I get this error.
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-16-1b48c937269f> in <module>()
----> 1 macrodemos.ARMA()
3 frames
/usr/local/lib/python3.7/dist-packages/dash/_utils.py in __setitem__(self, key, val)
156
157 # pylint: disable=inconsistent-return-statements
--> 158 def first(self, *names):
159 for name in names:
160 value = self.get(name)
AttributeError: ('Read-only: can only be set in the Dash constructor or during init_app()', 'requests_pathname_prefix')
I have no idea about this actually and I am not an expert. Could you please explain the problem? and a solution if you have any. Thanks
It appears there is some issue with the latest version of the package.
Using the following version of the packages appears to work well.
Notebook with changes, for your convenience:
https://colab.research.google.com/drive/1WyPr2p2nXmrNhjqJXl7hKaHtOocP731S?usp=sharing
Explanation:
While installing the packages, simple use:
!pip install macrodemos --upgrade
!pip install -q dash==1.19.0
This will replace the version of dash used to an older one that works, Here is a screenshot for your reference:
Screenshot 1
I am a newbie and I appreciate your feedback about whether this is helpful or not.
Thanks in advance. :)
I was able to fix this error by following the recommendations in the error message pasted here for reference,
AttributeError: ('Read-only: can only be set in the Dash constructor or during init_app()', 'requests_pathname_prefix')
The solution is to only set the Dash config when you first initialize the app application instead of using app.config.update according to the new version of Dash.
So instead of something like this which is trying to update a read-only variable,
app.config.update({
'requests_pathname_prefix': '/dash/' # wrong, will cause read-only error
})
You could do,
app = dash.Dash(
:
requests_pathname_prefix='/dash/')
Which sets those variables when it originally was defined so there will be no read-only error.
This answer might not fully address the original poster's concerns because after looking at the Colab notebook, the library of concern is macrodemos which needs to be updated to be compatible with the newest version of Dash.

Getting an Error for BERT module when trying to access bert.variables

I'm trying to get BERT to do sentiment analysis from the code obtained from here: https://github.com/strongio/keras-bert
But when I try to build the model, I get an error saying,
'Module' object has no attribute 'variables'
This occurs specifically in the build function of the BertLayer class when I try to access self.bert.variables.
I tried a dir(self.bert) to get all the attributes of the object and it indeed did not have an attribute called variables. These are the attributes I obtained:
['\__call__', '\__class__', '\__delattr__', '\__dict__', '\__dir__', '\__doc__', '\__eq__', '\__format__', '\__ge__', '\__getattribute__', '\__gt__', '\__hash__', '\__init__', '\__init_subclass__', '\__le__', '\__lt__', '\__module__', '\__ne__', '\__new__', '\__reduce__', '\__reduce_ex__', '\__repr__', '\__setattr__', '\__sizeof__', '\__str__', '\__subclasshook__', '\__weakref__', '_graph', '_impl', '_name', '_spec', '_tags', '_trainable', 'export', 'get_input_info_dict', 'get_output_info_dict', 'get_signature_names', 'variable_map']
I'm using tf version: 1.13.0 with Python: 3.5
Installing the very latest versions of both tensorflow and tensorflow hub fixed this issue.

Gensim Attribute Error when trying to use pre_scan on a doc2vec object

I am following the tutorial here:
https://github.com/RaRe-Technologies/gensim/blob/develop/docs/notebooks/doc2vec-wikipedia.ipynb
But when I get to this part:
pre = Doc2Vec(min_count=0)
pre.scan_vocab(documents)
I get the following error on scan_vocab:
AttributeError: 'Doc2Vec' object has no attribute 'scan_vocab'
Does anyone know how to fix this? Thanks.
That's a known problem after a 2018 refactoring of the Doc2Vec code:
https://github.com/RaRe-Technologies/gensim/issues/2085
You can just skip that cell to proceed with the rest of that demo notebook. (If you really needed to adjust the min_count using the info from a full-scan, you might be able to call some internal classes/methods mentioned in the above issue.)

Python: Thermopy module "AttributeError: 'module' object has no attribute 'burcat'"

I've just had to try and teach myself python for a project at work and it isn't going so well.
I'm trying to use the module "Thermopy" so that I can make programs for calculating gas dynamics etc.
I thought I had installed Thermopy correctly but when I went to just have a quick test of it, I couldn't get it to work, it imports the module fine and help(thermopy) seems to show it importing the right file (I think?) but If I then try and call any of the classes that should be in the module I get the error AttributeError: 'module' object has no attribute 'psicrometry' (Or whichever class I'm trying to call
e.g.
import thermopy
help(thermopy)
print thermopy.__file__
thermopy.psicrometry.test_wark()
gives the result
Help on package thermopy:
NAME
thermopy
FILE
c:\python27\lib\site-packages\thermopy-0.3-py2.7.egg\thermopy\__init__.py
PACKAGE CONTENTS
burcat
codata
combustion
constants
iapws
psicrometry
units
DATA
__version__ = '0.3'
VERSION
0.3
C:\Python27\lib\site-packages\thermopy-0.3-py2.7.egg\thermopy\__init__.pyc
Traceback (most recent call last):
File "\\FGBD101000.wsatkins.com\GBBSB_Home$\BROW4631\My Documents\Python\thermopy testing", line 7, in <module>
thermopy.psicrometry.test_wark()
AttributeError: 'module' object has no attribute 'psicrometry'
Any help on this is greatly appreciated, I'm very new to all this and don't have any prior programming experience so apologies if I'm doing anything silly, but I couldn't understand any of the other answers I saw to similiar questions on the site.
Many thanks
James

Categories

Resources