I want to change the Jupyter notebook theme, so I installed the themes with:
pip install jupyterthemes
The installation seems working fine but when I try to change the theme:
jt -t <theme_name>
I get:
jt: command not found
I tried to uninstall the themes:
pip uninstall jupyterthemes
but I got:
Skipping jupyterthemes as it is not installed
During the installation I got no error though.
What should I do to install the themes properly?
I'm using Ubuntu 16.04, and I installed Jupyter Notebook with pip. Jupyter works fine, it's just the themes that don't work
I solved the issue without sudo access by inputting commands within a Jupyter notebook.
Input the following in the cell of a notebook:
!pip install jupyterthemes
jt commands should work well afterward.
Simply run this. I was facing same issue, it worked
.
sudo pip install jupyterthemes
Go to your bash terminal and execute these commands
$ pip install jupyterthemes
$ ls .local/bin/
$ .local/bin/jt -l
$ .local/bin/jt -t chesterish
If you are trying to change the theme from inside the Jupyter notebook just use the below code.
!jt -l # to see the list of available themes
!jt -t <theme_name> # to set a theme
For example:
!jt -t monokai
Related
I do not have Anaconda, but installed jupyter notebook through pip and python 3.6 (which I downloaded via Visual Studio 2022). I used the command py -m pip install jupyter notebook which worked fine. I now have a windows shortcut which opens the notebook ("C:\Windows\system32\cmd.exe" /k start <link> & py -m jupyter notebook where < link > is the link to the notebook.) I used the command py -m pip install jupyterthemes to successfully install jupyter themes.
The problem is: How do I change the theme from windows cmd? I have tried a couple of different approches. I used jt -l or some version of it to see if it would work. Here are the results:
py -m jt -l Result: C:\Users\<User>\AppData\Local\Programs\Python\Python36-32\python.exe: No module named jt
py -m !jt -l Result: C:\<...>: No module named !jt
py -m jupyter themes Result: <...> Jupyter command 'jupyter themes' not found
py -m jupyterthemes -l Result: C:\...\python.exe: No module named jupyterthemes.__main__; 'jupyterthemes' is a package and cannot be directly executed
py jt -l Result: C:\<...>: can't open file 'jt': [Errono 2] no such file or dictionary
py -m notebook jt -l Result: ... Bad config encountered during initialization Unrecognized flag: '-l'
What am I doing wrong here? Maybe I should use something different than -m (but I don't know what)? I have tried to search for an answer, but can't seem to find one form windows cmd.
What I want to change the theme to is jt -t oceans16 -T -N -kl (oceans16 theme with toolbar, filename, logo and kernel).
I have tried to install jupyter lab on my Kubuntu machine.
If I install jupyter lab with 'pip3 install jupyter jupyterlab' the command 'jupyter notebook' works completly fine. But if I try to run 'jupyter lab' every time I get the message:
Traceback (most recent call last):
File "/usr/local/bin/jupyter", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/jupyter_core/command.py", line 230, in main
command = _jupyter_abspath(subcommand)
File "/usr/local/lib/python3.6/dist-packages/jupyter_core/command.py", line 133, in _jupyter_abspath
'Jupyter command `{}` not found.'.format(jupyter_subcommand)
Exception: Jupyter command `jupyter-lab` not found.
What is wrong?
I tried to reinstall jupyter and jupyterlab multiple times with the same issue.
Its the space. Its always the space. Never ever use spaces within package name. Its always either namepart1-namepart2 or namepart1namepart2. This is because arguments are separated by space. So if you put space in between, it makes pip think that you want to install two different packages named jupyter and lab. Just use:
python -m pip install jupyterlab
Or simply:
pip install jupyterlab
No need to uninstall or reinstall anything. However to run jupyter lab server you might want to add spaces as follows:
jupyter lab
In my case, the only way to fix this was to add the following directory to the PATH in Linux:
/home/ubuntu/.local/bin
When installing jupyterlab, we may get warning like this:
Installing collected packages: jupyterlab
WARNING: The scripts jlpm, jupyter-lab, jupyter-labextension and jupyter-labhub are installed in '/home/tln/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed jupyterlab-3.0.14
So as per this warning, scripts like jupyter-lab will be unavailable unless added to the PATH.
Use below command to add these scripts to be able to use from command line:
tln#tln-X550LD:~$ export PATH="$HOME/.local/bin:$PATH"
That's it. This worked fine for me.
I had the same error on Windows 10. It was with pip install jupyterlab. Then after the error I uninstalled it with pip and reinstalled with "pip install jupyterlab". Everything worked flawlessly thereafter.
In your case you're using pip3. Try it as above or see if pip3 needs an update.
I had same issue. I solved it running pip install jupyterlab in prompt with admin privilegies.
Had the same issue and resolved it by installing with pip3
pip3 install jupyterlab;
jupyter lab
If you face -bash: jupyter-lab: command not found or -bash: jupyter: command not found, etc., you can look for "jupyter-lab" and enter that full path instead.
Mac:
$ /Users/mark/venv/bin/jupyter-lab
Windows:
C:\mark\venv\Scripts\jupyter-lab.exe
I got this same error every time I forgot to activate the virtualenv jupyterlab was installed into. After activating the virtualenv, all's well.
With pip
$ source [path_to_venv]/bin/activate
With pipenv
$ pipenv shell
Then, with a prompt indicating an activated shell, you can enter your command
(venv) $ jupyter lab
With conda or other more holistic python environments, you probably use their gui to activate a virtualenv with jupyter and jupyterlab installed.
Install with Anaconda
conda install -c conda-forge notebook
conda install -c conda-forge jupyter
conda install -c conda-forge jupyter_contrib_nbextensions
Once installed you just have to run
pip install jupyterlab
~/.local/bin/jupyter-lab
and ready and open browser http://localhost:8888/lab
Ubuntu 22
Lubuntu 22
well the problem is like this:
the jupyterlab module has not been packaged for debian, but the jupyterlab_server package has, named python3-jupyterlab-server.
please sudo apt install python3-jupyterlab-server.
then, as your user, run pip3 install jupyterlab, that will install it in your ~/.local/bin a few programs, the missing jupyter-lab among them.
last, but not least, run jupyter-serverextension enable --py jupyterlab.
to be able to run jupyter lab, you first need to run export PATH="/home/$(whoami)/.local/bin:"$PATH. this command will run automatically if added to your ~/.bash_profile.
ubuntu can not find the jupyter-lab because it is not in path.
in order to check the place of installment. run below command
find ~ -name jupyter-lab
possible result: /home/soshiant/.local/bin/jupyter-lab
for adding a directory to the Linux path you can follow below link:
How to add a directory to the PATH
if anyone still struggling ...
try:
find ~ -name jupyter-lab
and then:
export PATH=[path]
then try again: jupyter lab
note:
don't add any extra spaces and PATH is case sensitive and if u still struggling just try to install any missing pkgs after hosting to the main path by opining another tab or changing the path to main.
and then host to localhost:8888/lab
that should works fine...
I was using conda to install
conda install -c conda-forge jupyterlab
and this error came about.
I simply used this command to get it to run.
pip install jupyterlab
In my ubuntu installation this was qused by not using sudo before the install.
sudo pip install jupyterlab
If you already installed jupyterlab, and it dit not work, you can install again using sudo, you dont need to remove the old version first for it to work
after restart my ubuntu 16.04, could not find pip
I can only get my original pip via python3 -m pip freeze
if I use pip freeze there shows bash: /usr/bin/pip: No such file or directory
And I installed my jupyter via pip install and I could not use jupyter notebook command now. It shows jupyter: command not found
And I make sure I use sudo apt-get update and when I want to install a new jupyter with sudo apt-get install jupyter-notebook it shows
E: Unable to locate package jupyter-notebook
Seems several system configuration go wrong? How to recover these? How can I open my jupyter?
bash: /usr/bin/pip: No such file or directory
Verify the file /usr/bin/pip exists. If it does check the first line:
head -1 /usr/bin/pip
The line (called shebang) must be something like #!/usr/bin/python. If it isn't edit the file and fix the shebang line to point to an existing python binary.
I installed my jupyter via pip install and I could not use jupyter notebook command now. It shows jupyter: command not found
It's because pip installed jupyter into a directory not in $PATH. Most probably /usr/local/bin/. Check the directory with pip show --files jupyter and add the directory to your $PATH both in the current shell and in your ~/.bash_profile.
I want to install a new jupyter with sudo apt-get install jupyter-notebook it shows E: Unable to locate package jupyter-notebook
Try sudo apt-get update.
The pip problem has been solved.
The reason is that PATH is somehow modified and it loses the ~/.local/bin, the original pip is in this path and pip also install jupyter notebook in this path.
After I added ~/.local/bin to PATH I can run pip and jupyter notebook, in brief this is a path problem
It says it installed Jupyter Notebook correctly, but when I launch it I get the error in the image:
The installation I used was:
pip
sudo apt-get install python3-pip
Then Pandas
sudo pip3 install pandas
then Jupyter notebook
sudo pip3 install Jupyter
Does it have anything to do with the version of Python (3 vs 2)?
How do I get Jupyter Notebook to start?
I had similar problems firing jupyter notebook on Ubuntu 18.4.x
Since jupyter notebook in itself requires another installation we need to install it. So I used this command and it worked please try and see if it works for you
#user-VirtualBox:~$ sudo apt install jupyter-notebook
It will ask for any password if you have set for Ubuntu once you enter this you should see
Reading package lists.. Done
Building dependency tree
...
...
etc
Once installation completed, type at prompt
#user-VirtualBox:~$ jupyter-notebook
You'll notice that jupyter's notebook system will automatically open Mozilla Firefox and it's ready go.
Let me know how it works.
Thanks
I am using the Jupyter notebook with Python 3 selected. On the first line of a cell I am entering:
import pandas as pd
The error I get from the notebook is, ImportError: No module named 'pandas'. How can I install pandas to the jupyter notebook? The computer I launched the Jupyter notebook from definitely has pandas.
I tried doing:
!pip install pandas
And it says it is already installed but for Python 2.7 at the bottom. My script shows it is a Python 3 script at the top though.
When I do echo $PATH in Ubuntu is shows that '/home/user/anaconda2/bin' is on the first entry. I think I may need to change this to be anaconda3?
UPDATE: When I try and launch a Python3 script through jupyter the command line which launched Jupyter gives me the error "ImportError: No module named 'IPython.paths'. Then there is a timeout waiting for 'kernel_info' reply. Additionally, I tried removing anaconda but still experience the same error. I have tried to make so many quick fixes now, that I am not sure what the next step is to get this working.
As your default python version is 2.x , if you don't have any emphasis on the python 3.x you can try from the first by the below scripts.
pip install --upgrade pip
pip install jupyter
then in jupyter notebook:
!pip install pandas
The version of notebook will be 2.x.
Otherwise install pip3 by the below Linux commands.
sudo apt-get install python3-setuptools
sudo easy_install3 pip
now you can add pandas to the notebook by !pip3 install pandas.
This worked for me
in Jupiter notebook
import sys
print(sys.executable)
copy path eg:
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
install the module on the terminal like this.
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -m pip install pandas
Or it can be installed directly from Jupyter Cell as follows
! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -m pip install pandas
If you use anaconda already as a distribution, stop using pip in that context. Use conda instead and you will stop having headaches. The command lines and procedures for setting up a new environment are pretty well documented here.
Basically upgrading python or having specific branches:
conda update python
conda install python=3.5
Or using specific environments:
conda create -n py35 python=3.5 anaconda
simple step to resolve the problem is
( NOTE: Remember what you have selected python 2 or python 3).
for python 2+
!pip install pandas
or if you have user permission error type
!pip install pandas --user
for python 3+
!pip3 install pandas
or if you have user permission error type
!pip3 install pandas --user
If pip3 is install you could run
!pip3 install pandas
This is what i have done in my system:
I have installed both anaconda for python 2.7 and anaconda for python 3.5. Anaconda helps keep both the environment separate.
In Ubuntu:
The directory structure is like this:
anaconda2/bin/
anaconda3/bin/
Whenever i want to use python 2.7 i go to anaconda2/bin/ and create an environment or activate already existing environment and install or import all the necessary packages and same goes for python3.5 (go to anconda3/bin/ create or activate the required environment). This helps me keep things separate.
Since you are using anaconda you should first use "conda install " if that package is not found, then you can use pip install .
In Windows:
If you install both anaconda2 and anaconda3, its quite easy..
the shortcuts for anaconda prompt are in C:\Users\your-username\
there will be two folders anconda2 and anaconda3, you can start conda prompt for python2.7 from anaconda2 and python3.5 from anconda3
So, once you start the anaconda prompt you can just type "jupyter notebook" to open jupyter notebook in browser and import pandas(or any package).
You can check this link:
http://conda.pydata.org/docs/test-drive.html#managing-conda
I meet the same problem in jupyter notebook, and I run the command below and solve my problem:
!pip install pandas
For Windows
The first step is to create a new conda environment. A conda environment is like a virtualenv that allows you to specify a specific version of Python and set of libraries. Run the following commands from a terminal window:
conda create -n name_of_my_env python
This will create a minimal environment with only Python installed in it. To put your self inside this environment run:
source activate name_of_my_env
On Windows the command is:
activate name_of_my_env
The final step required is to install pandas. This can be done with the following command:
conda install pandas
To install a specific pandas version:
conda install pandas=0.20.3
To install other packages, IPython for example:
conda install ipython
To install the full Anaconda distribution:
conda install anaconda
If you need packages that are available to pip but not conda, then install pip, and then use pip to install those packages:
conda install pip
pip install django
Simple solution : In a Notebook's cell type and execute the code:
import sys
!{sys.executable} -m pip install pandas
Iuse window 7 for work and I had the same problems when I tried to import Pandas. So I tried to install packages under each environment:
Run cmd and type the following code:
activate py27
conda install pandas
If the system asks you do you want to install the following new packages, choose Y for [yes]
And install pandas for each different environment if you installed Python27, Python 35 and Python 36, as I did.
Then problem solved if you run jupyter notebook again and you can import pandas successfully.
You can also solve the same problem for packages like numpy, scipy, etc..
Maybe its a broken (pip) installation. Following worked for me:
sudo apt --fix-broken install
Followed by:
sudo pip3 install pandas
Hope this helps.
I was getting the error
modulenotfounderror: no module named 'pandas'
in jupyter.
I tried the command:
!pip install pandas
and it worked like a charm.
My pandas version was 0.20.3 I have updated to 0.25 using conda update pandas. I have checked in Command Line Interface(CLI) its pd.__version__ '0.25.1'.
In Jupyter notebook its showing '0.20.3'.
Please restart jupyter notebook. note is cache your pandas. or you can create a new notebook
One silly mistake that you could make is to invoke Jupyter with your local machine
python installation and not the anaconda python. I had the same problem and just
setting the PATH did not work for me.
FIX: By default, anaconda binaries are in "<Path_to_anaconda>/bin". For example, in my case, they are in "/home/klakhotia/anaconda3/bin". This directory will also contain the binary to anaconda jupyter. Launch the jupyter from here or create an alias in your .bashrc that points to this file.
What worked for me was:
pip3 install pandas jupyter