Converting ipynb to html from Colab not work properly - html

I am using Colab to write a notebook using plotly. Within the notebook everything is fine and I can see the pie, but after converting the notebook into a html I don't see it.
this is the code:
import matplotlib.pyplot as plt
import plotly.express as px
Labels=['No', 'Ex-fumatore', 'Fumatore']
values=[1838, 1293, 574]
fig=px.pie(values = values,names = Labels,hole=.5,title = "Tipologie fumatori In Percentuale")
fig.show()
!jupyter nbconvert --to html /content/pie.ipynb
can somebody help me?
Thanks

There could be various reasons why converting an ipynb file to HTML from Colab is not working properly. Here are some possible solutions you could try:
1. Make sure that you have installed the required libraries in Colab that are needed for conversion. To install nbconvert, run the following command in a new cell:
!pip install nbconvert
2. If the nbconvert library is already installed, try uninstalling and reinstalling it to ensure that you have the latest version. You can uninstall it by running the following command:
!pip uninstall nbconvert
And then reinstall it by running:
!pip install nbconvert
3. Check that your notebook is properly saved and there are no unsaved changes. If there are unsaved changes, try saving the notebook and then converting it again.
4. Check the output of the conversion process for any error messages or warnings. These can help you identify the source of the problem.
5. Try converting the notebook to HTML using a different method. For example, you could download the notebook file to your local machine and then use a local installation of Jupyter Notebook to convert it to HTML.

Related

Voila - Extra padding for cells with no output

I am working on a Jupyter Notebook to build a pdf page using the Voila package (I use Voila to make the render, and then print the page as a PDF) and I have noticed that cells without an output still put padding into the Voila render. I am unsure how to fix this and it is wreaking havoc on my formatting. Please see example below.
Jupyter Code
Voila Output
I am running Voila 0.3.6 and Jupyter 1.0.0 and pandas 1.5.1.
I found a similar question posted to the Voila issues board in 2019, but it should be resolved so I am unsure how to proceed.
EDIT: I used pip install [insert software here] --upgrade --user to install updates and now have Voila 0.4.0 and notebook 6.5.2.
EDIT: This issue appears to be an updating problem and I have posted it on the Jupyter Community Forum as well.

I cannot import sqlalchemy via the anaconda prompt

Because of installing a proxy I deleted Anaconda prompt. After re-installing this I tried to read code in sublime text.
In order to read this sublime text, sqlalchemy is required, which I have justed installed, by typing in;
pip install SQLAlchemy
However, when i type in, i get the error:
import sqlalchemy
'import' is not recognized as an internal or external command,
operable program or batch file.
Can someone please explain what I am doing wrong?
Kind regards

ModuleNotFoundError: No module named 'pyarrow' with satisfied requirements

I am trying to run this command in Jupyter Notebook: import pyarrow, get the same error: "ModuleNotFoundError: No module named 'pyarrow'
I have installed it already with pip3 and brew also. So when I ran pip3install pyarrow it says requirements are already satisfied. All other libraries I have installed runs with no issues from the same directory.
Thank you.
This is an odd one, for sure. I am not familiar enough with pyarrow to know why the following worked.
From the docs, If I do pip3 install pyarrow and run pip3 list, pyarrow shows up in the list but I cannot seem to import it from the python CLI. Yet, if I also run conda install -c conda-forge pyarrow, installing all of it's dependencies, now jupyter notebook can import it properly.
Are you using a venv? Try running jupyter kernelspec list in your console and make sure your kernel is running in the environment you're expecting it to be.
https://github.com/jupyter/notebook/issues/2359 (discussion about this here)

How to install HTML package for python3.7

I want to install HTML package for python3.7 but It's is giving error while installing
I tried command pip install html but getting errors in console
ModuleNotFoundError: No module named 'html.parser'; 'html' is not a package
Command "python setup.py egg_info" failed with error code 1 in C:\Users\username\AppData\Local\Temp\pip-install-apo0cgnw\html\
I am getting the same error: archlinux running a virtualenv. I'm looking around it appears to be a problem with a file in there called 'six.py'. Not sure what the problem is but it appears the project has been orphaned because it was consistently updated until 2011. (Also not sure what all of this code is doing in there, similar libraries like 'vapory' are much smaller. - less bloat, less stuff to go wrong) I would suggest either trying it on Python2.x (since it appears that's where it was developed), contacting the developer, or using a different package.
1) download the .tar.gz file OR .zip file according to your OS from this
link .
2) After downloading , install that downloaded package by the following code : pip install ./downloads/SomeProject-1.0.4.tar.gz
And then again follow the below step
You can import the html package as shown below. pip install is not required, as html comes with the Standard library, post Python v3.x,
>>> from html import HTML
>>> h = HTML()
>>> h.p('Hello, world!')
>>> print h # or print(h) in python 3+
<p>Hello, world!</p>
See the html 1.16 project description for more detail .

How to install models/download packages on Google Colab?

I am using text analytics library "Spacy". I've installed spacy on Google Colab notebook without any issue. But for using it I need to download "en" model.
Generally, that command should look like this:
python -m spacy download en
I tried few ways but I am not able to get it to install on the notebook. Looking for help.
Cheers
If you have a Python interpreter but not a teriminal, you could try:
import spacy.cli
spacy.cli.download("en_core_web_sm")
More manual alternatives can be found here: https://spacy.io/usage/models#download-pip
Fundamentally what needs to happen is the model file needs to be downloaded, unzipped, and placed into the appropriate site-packages directory. You should be able to find a convenient way to do that, e.g. by pip installing the model package directly. But if you get really stuck, you can get the path by looking at the __file__ variable of any module you have installed, e.g. print(spacy.__file__) . That should tell you where on your file-system the site-packages directory is.
or you can use:
import en_core_web_sm
nlp = en_core_web_sm.load()
!python -m spacy download fr_core_news_sm
Worked for me for the French model