8

I upgraded to Ubuntu 24.04 LTS today. I am facing issues to deal with the python packages. I tried to install with pip, but got this error related to externally-managed-environment. Then I tried with pipx to install a few packages. The pipx list is showing like the following

venvs are in /home/raf/.local/share/pipx/venvs
apps are exposed on your $PATH at /home/raf/.local/bin
manual pages are exposed at /home/raf/.local/share/man
   package h5py 3.11.0, installed using Python 3.12.3
    - f2py (symlink missing or pointing to unexpected location)
    - numpy-config (symlink missing or pointing to unexpected location)
   package ipykernel 6.29.5, installed using Python 3.12.3
    - debugpy
    - ipython
    - ipython3
    - jupyter
    - jupyter-kernel
    - jupyter-kernelspec
    - jupyter-migrate
    - jupyter-run
    - jupyter-troubleshoot
    - pygmentize
    - man1/ipython.1
   package jupyter 1.1.1, installed using Python 3.12.3
    - httpx
    - jlpm
    - jsonpointer
    - jsonschema
    - jupyter-console
    - jupyter-dejavu
    - jupyter-events
    - jupyter-execute
    - jupyter-lab
    - jupyter-labextension
    - jupyter-labhub
    - jupyter-nbconvert
    - jupyter-notebook
    - jupyter-server
    - jupyter-trust
    - normalizer
    - pybabel
    - pyjson5
    - send2trash
    - wsdump
    - debugpy (symlink missing or pointing to unexpected location)
    - ipython (symlink missing or pointing to unexpected location)
    - ipython3 (symlink missing or pointing to unexpected location)
    - jupyter (symlink missing or pointing to unexpected location)
    - jupyter-kernel (symlink missing or pointing to unexpected location)
    - jupyter-kernelspec (symlink missing or pointing to unexpected location)
    - jupyter-migrate (symlink missing or pointing to unexpected location)
    - jupyter-run (symlink missing or pointing to unexpected location)
    - jupyter-troubleshoot (symlink missing or pointing to unexpected location)
    - pygmentize (symlink missing or pointing to unexpected location)
    - man1/ipython.1 (symlink missing or pointing to unexpected location)
   package jupyter-core 5.7.2, installed using Python 3.12.3
    - jupyter (symlink missing or pointing to unexpected location)
    - jupyter-migrate (symlink missing or pointing to unexpected location)
    - jupyter-troubleshoot (symlink missing or pointing to unexpected location)
   package jupyterlab 4.2.5, installed using Python 3.12.3
    - jlpm (symlink missing or pointing to unexpected location)
    - jupyter-lab (symlink missing or pointing to unexpected location)
    - jupyter-labextension (symlink missing or pointing to unexpected location)
    - jupyter-labhub (symlink missing or pointing to unexpected location)
   package matplotlib 3.9.2, installed using Python 3.12.3
    - fonttools
    - pyftmerge
    - pyftsubset
    - ttx
    - f2py (symlink missing or pointing to unexpected location)
    - numpy-config (symlink missing or pointing to unexpected location)
    - man1/ttx.1
   package notebook 7.2.2, installed using Python 3.12.3
    - debugpy (symlink missing or pointing to unexpected location)
    - httpx (symlink missing or pointing to unexpected location)
    - ipython (symlink missing or pointing to unexpected location)
    - ipython3 (symlink missing or pointing to unexpected location)
    - jlpm (symlink missing or pointing to unexpected location)
    - jsonpointer (symlink missing or pointing to unexpected location)
    - jsonschema (symlink missing or pointing to unexpected location)
    - jupyter (symlink missing or pointing to unexpected location)
    - jupyter-dejavu (symlink missing or pointing to unexpected location)
    - jupyter-events (symlink missing or pointing to unexpected location)
    - jupyter-execute (symlink missing or pointing to unexpected location)
    - jupyter-kernel (symlink missing or pointing to unexpected location)
    - jupyter-kernelspec (symlink missing or pointing to unexpected location)
    - jupyter-lab (symlink missing or pointing to unexpected location)
    - jupyter-labextension (symlink missing or pointing to unexpected location)
    - jupyter-labhub (symlink missing or pointing to unexpected location)
    - jupyter-migrate (symlink missing or pointing to unexpected location)
    - jupyter-nbconvert (symlink missing or pointing to unexpected location)
    - jupyter-notebook (symlink missing or pointing to unexpected location)
    - jupyter-run (symlink missing or pointing to unexpected location)
    - jupyter-server (symlink missing or pointing to unexpected location)
    - jupyter-troubleshoot (symlink missing or pointing to unexpected location)
    - jupyter-trust (symlink missing or pointing to unexpected location)
    - normalizer (symlink missing or pointing to unexpected location)
    - pybabel (symlink missing or pointing to unexpected location)
    - pygmentize (symlink missing or pointing to unexpected location)
    - pyjson5 (symlink missing or pointing to unexpected location)
    - send2trash (symlink missing or pointing to unexpected location)
    - wsdump (symlink missing or pointing to unexpected location)
    - man1/ipython.1 (symlink missing or pointing to unexpected location)
   package numpy 2.1.0, installed using Python 3.12.3
    - f2py
    - numpy-config

Now, running jupyter notebook is showing a blank page in the browser. And while trying to run the ipynb notebook on VS code, I am getting Running cells with 'Python 3.12.3' requires the ipykernel package.

raf
  • 579

3 Answers3

8

You can install ipython with apt using sudo apt install python3-ipython jupyter. I have verified that it works in Ubuntu 24.04. Remove the pipx package.

Some users have reported issues with jupyter notebook and snap firefox. You can install the APT version of Firefox for better compatibility. See How to install Firefox as a traditional deb package (without snap) in Ubuntu 22.04 or later versions?

4

My notebook package also got broken, but

pipx reinstall notebook

fixed it.

On a side note, your pipx list shows too many pipx packages. I think you misunderstand what pipx is. pipx installs packages into its own virtual environment and then "exports" its scripts. Different packages are independent, so your package notebook has no access to the package numpy. To install python packages into pipx packages, you need to use pipx inject. So to install numpy and matplotlib into your notebook installation, you would run

pipx inject notebook numpy matplotlib
Dodezv
  • 141
2

Ubuntu can have a python without pip by following this steps.

  1. Install a virtual environment library.

    sudo apt install python3-venv
    
  2. Create an environment (Here I will use my_env).

    python3 -m venv my_env
    
  3. Activate this env.

    source my_env\bin\ activate
    

    Note: You should see the name of my_env in a parentheses first of line.In the below screenshot my environment name is torch.

    Screenshot

  4. Update pip.

    pip install -m pip --upgrade
    
karel
  • 122,292
  • 133
  • 301
  • 332
nima pm
  • 21