paulopes / panel-bootstrap-vue

Use bootstrap-vue VueJs components supporting Bootstrap 4 in Panel templates
Apache License 2.0
2 stars 0 forks source link

Cannot pip install panel-bootstrap-vue and panel-components #2

Open MarcSkovMadsen opened 3 years ago

MarcSkovMadsen commented 3 years ago

I've tried

pip install git+https://github.com/paulopes/panel-components.git

and

pip install git+https://github.com/paulopes/panel-bootstrap-vue.git

But they don't get installed properly

image

image

paulopes commented 3 years ago

Thank you Marc for alerting me to this problem. I am experiencing it now on a fresh environment installation as well. I'll look into what broke the setup and I'll update the packages when I find the cause of this problem.

paulopes commented 3 years ago

I've converted this package and the panel-components package both to poetry and I've uploaded both to pypi.

You should now be able to install just by typing pip install panel-bootstrap-vue but since you had previously installed the bad packages you should probably uninstall them both first with pip uninstall panel-bootstrap-vue panel-components.

Please let me know if you are able to install these packages now.

MarcSkovMadsen commented 3 years ago

I can install and import the packages successfully. But then I get an error in the notebook. I'm running Windows 10.

image

UnicodeDecodeError                        Traceback (most recent call last)
<ipython-input-5-248d5c7e6361> in <module>
----> 1 app = ui.servable()

c:\repos\private\panel-extensions-template\.venv\lib\site-packages\panel_components\component.py in servable(self, *args, **kwargs)
   1031 
   1032         tmpl = pn.Template(
-> 1033             self._get_template(asset_folders),
   1034             nb_template=self._get_nb_template(asset_folders),
   1035         )

c:\repos\private\panel-extensions-template\.venv\lib\site-packages\panel_components\component.py in _get_template(self, asset_folders)
    985             )
    986             + template_escape(self._get_template_contents_bottom_no_nb(asset_folders))
--> 987             + """
    988     {% endblock %}
    989 </body>

c:\repos\private\panel-extensions-template\.venv\lib\site-packages\panel_components\component.py in _get_template_pyviz_resources(self, asset_folders)
    705                                     asset_folders=asset_folders,
    706                                 )
--> 707                                 + "</script>"
    708                             )
    709         return template

c:\repos\private\panel-extensions-template\.venv\lib\site-packages\panel_components\utils.py in get_inline_js(filename, src_folder, dst_folder, asset_folders)
     97 def get_inline_js(filename, src_folder, dst_folder=None, asset_folders=None):
     98     src_file, _ = find_src_file(filename, src_folder, dst_folder, asset_folders)
---> 99     return _read_file(src_file).replace("</script", r"\u003c/script")
    100 
    101 

c:\repos\private\panel-extensions-template\.venv\lib\site-packages\panel_components\utils.py in _read_file(src_path)
     43     if src_path and os.path.isfile(src_path):
     44         with open(src_path) as src_file:
---> 45             file_contents = src_file.read()
     46 
     47     return file_contents

C:\Program Files\Python37\lib\encodings\cp1252.py in decode(self, input, final)
     21 class IncrementalDecoder(codecs.IncrementalDecoder):
     22     def decode(self, input, final=False):
---> 23         return codecs.charmap_decode(input,self.errors,decoding_table)[0]
     24 
     25 class StreamWriter(Codec,codecs.StreamWriter):

UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 14290: character maps to <undefined>
paulopes commented 3 years ago

Hi Marc, that was due to not having specified unicode when opening a resource file, which affects running panel-components on Windows. I fixed that bug in version 0.1.1. You have to pip install -U panel-components now.

There was another problem with the vue-example: I had forgotten to upload the vue-pivot-table-0.3.0.browser.js javascript library to the www/vue/ folder of the panel-bootstrap-vue package, so I'm afraid that you'll need to go get it from the panel-bootstrap-vue repo, which has now been updated, or just git pull it.

paulopes commented 3 years ago

Is it working now, Marc? May I close this issue?

MarcSkovMadsen commented 3 years ago

I have uninstalled and installed

image

But now I get Uncaught ReferenceError: Vue is not defined in the console.

image

This is how the vuefolder looks.

image

paulopes commented 3 years ago

I hadn't tried this in the older notebook interface. I'll need to troubleshoot that. In the mean time you can try these two things: 1) Run the notebook using jupyter lab instead. 2) Launch the notebook using panel, with this CLI command: panel serve vue-example.ipynb

Note that you can add your own panel elements and widgets as additional parameters to the page() component, like this:

Screen Shot 2020-09-29 at 4 05 36 PM
MarcSkovMadsen commented 3 years ago

HI @paulopes

I've tried running the notebook via `panel serve "scripts\vue-example.ipynb" --dev'. But then I get the error

vue-example:1642 Uncaught ReferenceError: VuePivot is not defined at vue-example:1642`

and

vue-example:749 Uncaught Error: Error rendering Bokeh items: either 'docid' or 'sessionid' was expected.
    at v (vue-example:749)
    at vue-example:749

and a lot of loading errors.

I'm running Panel 0.9.7 and bokeh 2.1.1

image

paulopes commented 3 years ago

Hi Marc,

Note that I added later a www/vue folder with this js dependency inside it.

Kind regards,

Paulo Lopes

On Sep 29, 2020, at 11:01 PM, Marc Skov Madsen notifications@github.com wrote:

HI @paulopes https://github.com/paulopes I've tried running the notebook via `panel serve "scripts\vue-example.ipynb" --dev'. But then I get the error

vue-example:1642 Uncaught ReferenceError: VuePivot is not defined at vue-example:1642` and

vue-example:749 Uncaught Error: Error rendering Bokeh items: either 'docid' or 'sessionid' was expected. at v (vue-example:749) at vue-example:749 and a lot of loading errors.

I'm running Panel 0.9.7 and bokeh 2.1.1

https://user-images.githubusercontent.com/42288570/94638283-ebabdd80-02d9-11eb-9a5c-fc50b546c1fa.png — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/paulopes/panel-bootstrap-vue/issues/2#issuecomment-701128270, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYPC7GZCNF6WVGDPR46AFLSIKNPNANCNFSM4R5JFHFQ.