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.
Related
I am attempting to model a protein using an AlphaFold2 (AlphaFold v2.1.0.) CoLab (https://colab.research.google.com/github/deepmind/alphafold/blob/main/notebooks/AlphaFold.ipynb#scrollTo=pc5-mbsX9PZC).
I have done this successfully on 9/2/2022. However I have repeatedly had issues since 9/7/2022 doing the modelling with a different peptide sequence.
I get the following warning when I run the search against the genetic databases:
/opt/conda/lib/python3.7/site-packages/haiku/_src/data_structures.py:37: FutureWarning: jax.tree_structure is deprecated, and will be removed in a future release. Use jax.tree_util.tree_structure instead.
PyTreeDef = type(jax.tree_structure(None))
I then get several other future warnings when I run AlphaFold2 about other jax.tree_ deprecations.
The problem with AlphaFold running seems to be related to this:
AttributeError: module 'jax' has no attribute 'tree_multimap'
I have tried substituting jax.tree_util.tree_structure with no success.
I see another question on stackoverflow that is similar (AttributeError: module 'jaxlib.xla_extension' has no attribute 'PmapFunction'), however I do not know how best to implement the solution in the CoLab environment.
How should I fix this issue so that AlphaFold2 will run properly?
Traceback shown below:
44 processed_feature_dict = model_runner.process_features(np_example, random_seed=0)
---> 45 prediction = model_runner.predict(processed_feature_dict, random_seed=random.randrange(sys.maxsize))
/opt/conda/lib/python3.7/site-packages/haiku/_src/stateful.py in difference(before, after)
310 params_before, params_after = box_and_fill_missing(before.params,
311 after.params)
--> 312 params_after = jax.tree_multimap(functools.partial(if_changed, is_new_param),
313 params_before, params_after)
jax.tree_multimap was deprecated in JAX version 0.3.5, and removed in JAX version 0.3.16.
You can either change the source to use jax.tree_map as a drop-in replacement for jax.tree_multimap, or install an older version of JAX, e.g.:
!pip install "jax<=0.3.16" "jaxlib<=0.3.16"
And then be sure to restart your runtime to pick up the new versiom.
I am using python 3.8 in spyder3. I am getting an error while doing:
mp=MPRester('api key')
data = mp.query(criteria={}, properties=['task_id']) #this line raises error
The error is :
NameError: name '**IProgress**' is not defined.
During handling of the above exception, another exception occurred:
ImportError: **FloatProgress** not found. Please update jupyter and ipywidgets.
But I'm not working with Jupyter notebook and ipywidgets is updated. This problem doesn't happen while working in Google collab.
Installing these two worked for me:
pip install ipywidgets IProgress
I am not answering the error but showing a worked script for me. Using the following approach might help.
from pymatgen import MPRester
api = MPRester("your key")
# criteria you want
criteria={"elements":{"$all": ["O"]}, "nelements":{'$lt':4}}
# properties you want
properties = ["pretty_formula", "cif", "material_id"]
c = api.query(criteria=criteria,properties=properties)
I am a Python newbie currently looking into Crash Course Ai #5 How to Make an AI read your handwriting (LAB).
Running Step 1.2 gives me *NameError: name 'extract_training_samples' is not defined.
Tried so far: 1) updated pip version to 20.0.2 and installed emnist python package
2) tried an additional line of code: from emnist import extract_training_samples but got a ModuleNotFound error.
Feedback appreciated!
OK, very simple solution!
You just forgot the "s".
I find myself running into that problem all the time when coding. Whenever I run into a Name Error, the first thing I do is check my spelling!
your code:
x, y = extract_training_sample('letters')
the code on the website:
extract_training_samples('letters')
Cheers,
I am using TableauServerClient to update the owner of a report on Tableau server. Here is my simple code:
Try:
single_workbook = server.workbooks.get_by_id(workbook_id) #default ownerid of fsg_tableaureporting
single_workbook.owner_id = ownerid
if (server.workbooks.update(single_workbook)):
print('Workbook owner has been updated successfully')
else:
print('Workbook owner could not be updated. Please try again. Exiting..')
except Exception as e:
print('Exceptions occured while changing the owner.')
print(e)
I get the exception at the statement server.workbooks.update(single_workbook).
Anyone have any suggestions?
Python: 3.7.3
TSC: 0.8.1
Tableau server: 2019.1.3 (20191.19.0417.1429) 64-bit Windows
I just encountered the same issue. Looking at logs (C:\Tableau Server\data\tabsvc\logs\vizportal\vizportal-0.log for Windows), I see the error:
Caused by: com.sun.istack.internal.SAXParseException2; lineNumber: 1; columnNumber: 238; unexpected element (uri:"", local:"dataAccelerationConfig"). Expected elements are <{}owner>,<{}site>,<{}project>,<{}connections>,<{}connectionCredentials>,<{}views>,<{}tags>
The error specifically happens at generating the XML here:
https://github.com/tableau/server-client-python/blob/188be71e0fbe9d87ac36628af21d2f63af32d020/tableauserverclient/server/endpoint/workbooks_endpoint.py#L103
Upon checking whats happening in that request, I see its adding a section in xml for data_acceleration_config which I think is a new feature starting in very recent versions, 2019.4 maybe:
https://github.com/tableau/server-client-python/blob/188be71e0fbe9d87ac36628af21d2f63af32d020/tableauserverclient/server/request_factory.py#L485
Unfortunately the API doesnt handle this properly, yet! I am trying to tweak my code to not generate that xml element; will update again if I get to a solution.
I'm using tableauserverclient version 0.12 and have face the similar issues; However when I downgrade to version 0.10, I didn't encounter this issue when update workbook project.
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.)