I don't write Python code for my work. Last weekend I came across an interesting Jupiter notebook and figured I'd give it a try on my work laptop. "It's probably as easy as brew install pip and then use that to load the other dependencies," I assumed. Over an hour later I had to give up. There was initially some kind of Python version conflict on my Mac. Eventually some version of JupyterLab was installed somewhere,…
Well, there's a long legacy of half-baked solutions and kludges. And, especially, install instructions consistently suggest you do the worst thing: install stuff using pip.
Everyone knows that's bad advice, because it always fails in mysterious ways, and there's no good way to roll everything back.
I recommend:
python3 -m pip install pipx # Don't rely on the pip3 bin.
pipx install jupyterlab
# Now jupyter has an independent virtualenv.
# To install dependencies:
pipx inject jupyterlab numpy
# Where is everything?
pipx list
venvs are in /Users/ben/.local/pipx/venvs
apps are exposed on your $PATH at /Users/ben/.local/bin
...
Once you've done that, never install anything directly with pip3 again. If you're working on a project, use pipx to install poetry / dephell / pipenv and use them to manage the virtualenv.And you can get rid of it all:
pipx uninstall-all
python3 -m pip uninstall pipx