I'm following the example for composing new panels in the Getting Started page and having issues with the @pn.depends decorator. If I copy and paste everything works up through the Composing new Panels section, but I get an AttributeError using @pn.depends.
import panel.widgets as pnw
frequency = pnw.FloatSlider(name='frequency', value=1, start=1.0, end=5)
amplitude = pnw.FloatSlider(name='amplitude', value=1, start=0.1, end=10)
@pn.depends(frequency.param.value, amplitude.param.value)
def reactive_sine(frequency, amplitude):
return sine(frequency, amplitude)
widgets = pn.Column("<br>\n# Sine waves", frequency, amplitude)
sine_panel = pn.Row(reactive_sine, widgets)
sine_panel
I get back this error:
--------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-6-25b8eddf5fa6> in <module>
4 amplitude = pnw.FloatSlider(name='amplitude', value=1, start=0.1, end=10)
5
----> 6 @pn.depends(frequency.param.value, amplitude.param.value)
7 def reactive_sine(frequency, amplitude):
8 return sine(frequency, amplitude)
AttributeError: module 'panel' has no attribute 'depends'
This is happening in Jupyter Lab (0.35.4) with panel (0.4.0).
Thanks!
I was looking around and realized that 0.4.0 didn't seem like the latest version so tried ran an update which brought me to 0.5.1, which didn't fix the problem. Turns out when I updated it switched back to conda-forge, so I ran update again with -c pyviz and finally got 0.6.0 which resolved the issue.
Did I just have bad timing with the pyviz channel being updated? Only want to highlight it as I don't want other users to get turned off because Panel looks awesome.
To summarize:
~09:30am 6/4/2019: conda install -c pyviz panel --> 0.4.0
~10:00am 6/4/2019: conda update panel --> 0.5.1 (from conda-forge)
~10:10am 6/4/2019: conda update -c pyviz panel --> 0.6.0 (from pyviz)
It looks like Panel was updated to 0.6.0 in the pyviz channel on 6/2/2019 so I'm not sure how I got 0.4.0 at all. Hopefully a fluke (or user error) for me and not something that affects other people.
Thanks for reporting this, it's definitely worth investigating, conda is not always entirely transparent about the way it resolves dependencies and versions. Usually this is because you have some version of a package that is incompatible with the latest version installed in which case it sometimes ends up installing an older version. The problem with that theory is that panel does not pin a maximum version of anything.
No problem! I felt bad when I realized I was just not using the latest version but am still puzzled as to how I ended up with the old version. Not Panel's fault though, and I'm really excited about using it more.
On the topic of issues with the Getting Started page, I think the links in the "Exploring Further" section are broken. For example, Interact links to https://panel.pyviz.org/getting_started/Interact.html when it should link to https://panel.pyviz.org/user_guide/Interact.html. It looks like it's coming from a notebook in the examples section and something is going wrong when the docs get compiled. Looks like it affects all the links in that section.
Thanks again!
For example, Interact links to https://panel.pyviz.org/getting_started/Interact.html when it should link to https://panel.pyviz.org/user_guide/Interact.html. It looks like it's coming from a notebook in the examples section and something is going wrong when the docs get compiled. Looks like it affects all the links in that section.
More good feedback, the getting started guide was originally user_guide/Introduction.ipynb and it looks like the links weren't updated in the move.
If I have time (and it's not resolved already) I could try to contribute updates through a pull request this weekend, but I'm still a bit of a novice when it comes to contributing.
Happy to walk you through it. The source for that page is examples/getting_started/Introduction.ipynb I'm at a workshop and will be traveling so there's a good chance this will not get fixed before the weekend.
Recently discovered panel and wanted to try it out. Opened up a mybinder notebook. I initialised the binder notebook on the master branch approximately 30 mins ago and can report that I also experienced this issue of depends not existing. Not sure if this information is valuable, but thought I'd share in any case.
@swayson, sounds like you are also getting an old version; you'll need panel=0.6. You probably have some older libraries in your environment that are steering conda to choose an older panel version to match them. Try conda install -c pyviz panel=0.6.
We need to find a better solution for this. A good fraction of bug reports have been due to older versions. I really think conda should have an option to upgrade to the latest version of the package(s) you specify, if it doesn't already conda install panel --latest or something.
This is definately a sad problem. Some of my customers only allow to install packages from conda / conda-forge, so I'm stuck to 0.5.1 and have to wait until anaconda includes it in the main channels. I'll check the sources if the "depends" decorator is somewhere else. I thought I saw it in a docstring in the tagged commit for 0.5.1.
Some of my customers only allow to install packages from conda / conda-forge
panel 0.6.0 is on conda-forge, did you mean the main channel only?
Yes
We'll ask for an update on the main channel soon.
I've finally asked for it to be added, should happen soon.
Most helpful comment
@swayson, sounds like you are also getting an old version; you'll need panel=0.6. You probably have some older libraries in your environment that are steering conda to choose an older panel version to match them. Try
conda install -c pyviz panel=0.6.