Installing a jupyter notebook extension - python

I tried without success to install some extensions to jupyter notebook and can't figure out how to do it.
So basically I would like to have pep8 code checking in my notebook.
I checked this post:
Verifying PEP8 in iPython notebook code
However %install_ext is deprecated so instead I used
jupyter nbextension install https://raw.githubusercontent.com/SiggyF/notebooks/master/pep8_magic.py --user
So I get:
Copying: /tmp/tmpw74yl7m2/pep8_magic.py -> /home/louis/.local/share/jupyter/nbextensions/pep8_magic.py
To initialize this nbextension in the browser every time the notebook (or other app) loads:
jupyter nbextension enable <the entry point> --user
From now on I could not get it working.
I tried:
~$ jupyter nbextension enable pep8_magic.py --user
Enabling notebook extension pep8_magic.py...
- Validating: problems found:
- require? X pep8_magic.py
Without success.
Can someone explain a simple method to get it working and what I missed about jupyter extensions ?
Thank you !

I manually copied the file from the link and then added to /.ipython/extensions (or /nbextensions) and loaded in the notebook: %load_ext pep8_magic
Currently testing but looks fine to me

Related

VScode fails to export Jupyter notebook to HTML - 'jupyter-nbconvert` not found

I keep on getting error message:
Available subcommands: 1.0.0
Jupyter command `jupyter-nbconvert` not found.
I've tried to reinstall nbconvert using pip to no use. I've also tried the tip from this thread with installing pip install jupyter in vscode terminal but it shows that "Requirement already satisfied"
VSCode fails to export jupyter notebook to html
I've also tried to manually edit jupyter settings.json file to the following:
"python.pythonPath": "C:\\Users\\XYZ\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python39\\Scripts"
I've python 3.9 installed via windows store.
Any tip on what might be the issue for vscode doesn't want to export the notebook?
pip uninstall nbconvert
run CMD as admin
pip install nbconvert
Following above steps resolved my issue. Got this solution from this thread
Unsure exactly what fixed the issue but heres a summary.
Updated to python 3.10
Installed pandoc and miktex
Powershell reinstall nbconvert
Received warning that nbconvert script file is installed in a location not in Path.
Copied said location to System Properties - Envionment Variables - Path
Restart and install all miktex package on the go
PDF export and HTML export seems to work as intended now.
Here's my step to convert .ipynb to html:
Install required module: pip install nbconvert
Turn to the folder that contains .ipynb then run jupyter nbconvert --to html Text.ipynb
You may create a new virtual environment to avoid messing up global one then try again.
For your reference: nbconvert-PyPI and create virtual environment.
Quick answer:
import pip
package= ['nbconvert'] # install any package you need without any error forever
for i in package:
pip.main(['install', i])
After facing a similar problem, I tried to resolve it. None of these solutions didn't resolve my problem.
But found an alternative approach, tried opening the notebook by the following command and succeeded.
python -m notebook
If a notebook was not installed in your system, then install it with pip
pip install notebook
After opening your notebook into Jupiter, export it into your desired file.
I use Pyhton3 and have very limited packages in python, this caused a problem for me.
pip install nbconvert
also try using
pip3 install nbconvert

'jupyter' is not recognized as an internal or external command, operable program or batch file. after install jupyter also

I have recently degraded my python from 3.10 to 3.9 as few of the libraries were not working, specifically I was facing issue with jupyter installation. However since degradation of my python my jupyter command is not working as an example:
I am trying to convert my .ipynb file in .py with following code.
!jupyter nbconvert --to script 'test.ipynb'
or jupyter nbconvert --to script 'test.ipynb'
or trying to enable nbextension with following code
!jupyter nbextension enable
or !jupyter nbextension enable
I am getting an error which says:
'jupyter' is not recognized as an internal or external command,
operable program or batch file.
I have installed,
pip install jupyter
pip install jupyter notebook
not sure what else it is looking for. I am able to open my jupyter notebook and work. No problem there. Any suggestion will be appreciated, thank you in advance.
A better way to install Jupyter Notebook:
First, uninstall jupyter by pip uninstall jupyter.
Then, install jupyter through pip install --upgrade jupyter ipython.

Error enabling splitcell/splitcell extension for jupyter notebooks

If I want split slides into two columns in my rise presentation, I have to install the jupyter_contrib_nbextensions:
pip install jupyter_contrib_nbextensions
but, I can't be enabled by running:
jupyter nbextension enable splitcell/splitcell
with this problem
Enabling notebook extension splitcell/splitcell...
- Validating: problems found:
- require? X splitcell/splitcell
Some solution?
Did you add the nbextensions to jupyter by running
jupyter nbextensions_configurator enable --user
or similar? See Step 2 of the nbextensions README.

How to get auto completion on jupyter notebook?

I am new to Python language programming. I found that we can have auto completion on Jupyter notebook. I found this suggestion:
"The auto-completion with Jupyter Notebook is so weak, even with hinterland extension. Thanks for the idea of deep-learning-based code auto-completion. I developed a Jupyter Notebook Extension based on TabNine which provides code auto-completion based on Deep Learning. Here's the Github link of my work: jupyter-tabnine.
It's available on pypi index now. Simply issue following commands, then enjoy it:)
pip3 install jupyter-tabnine,
jupyter nbextension install --py jupyter_tabnine,
jupyter nbextension enable --py jupyter_tabnine,
jupyter serverextension enable --py jupyter_tabnine"
I did 4 steps installation and it looked installed well. However, when I tried using Jupyter notebook its auto completion didn't work. Basically my question is please help how to get auto completion on Jupiter notebook? Thank you very much.
Press tab twice while you are writing your code and the autocomplete tab will show for you. Just select one and press enter
After installing Nbextensions, go to Nbextensions in jupyter notebook, tick on Hinterland. Then reopen your jupyter notebook.

The command "jupyter lab" does not work as the file does not exist

I installed Jupyter Lab but cannot launch it (jupyter lab) due to the error: Error executing Jupyter command 'lab': [Errno 2] No such file or directory.
However, it is installed, and is show as one of available subcommands (via jupyter lab):
Available subcommands: bundlerextension console kernelspec lab labextension
labhub migrate nbconvert nbextension notebook qtconsole run serverextension
troubleshoot trust
Why does it not work and is there something I'm missing here? jupyter notebook works without any problems. I also added jupyter serverextension enable --py jupyterlab --sys-prefix according to the documentation on Github, FYI.
My working environment:
jupyter notebook --version # 5.0.0
jupyter version # 4.3.0
#Blazard open the .profile in your home using VIM add the following path
export PATH=$PATH:/home/<user-name>/.local/bin
save it
$ source ~/.profile (Dont forget to do this)
I had the same problem. Installing it over PyCharm IDE solved the problem for me. I am using Windows as an OS. Installing packages over PyCharm works in general better for me than over Windows cmd.
#Blaszard could you try the following
/home/<your-user-name>/.local/bin/jupyter-lab
SOURCE
EDIT
Alternatively, you would have to add /home/<your-user-name>/.local/bin to your PATH variable. However, you should probably just try it manually first and see if that even works at all.
simple solution I found for my mac powerbook is:
go to a working directory in the terminal and then type jupyter lab.
IT WORKS,
We need to find jupyter-lab command. In my case on a mac it is in /opt/local/Library/Frameworks/Python.framework/Versions/3.9/bin/.
I'm using macports so my binaries are in /opt/local/bin. It's on my path:
> echo $PATH
.../opt/local/bin...
I have to create a symbolic link in this directory:
ln -s /opt/local/Library/Frameworks/Python.framework/Versions/3.9/bin/jupyter-lab jupyter-lab

Categories

Resources