Installing python libraries using both mamba and pip

TL;DR: I’m wondering if anyone could tell me whether or not I should worry about installing gradio with pip even if it was strongly suggested in Live Coding 1 to use mamba in order to install python libraries. (I remember from Live Coding 1 that if we accidentally do some installation with pip, we’ll have to, at the worst, delete our mambaforge directory and start from scratch again, that is why I’m so concerned.)

I’m following the “live coding” records and I’ve completed session 1 and 2. I’ve achieved a setup of the python environment exactly as Jeremy shows us, that is, among other things, using mamba to install python libraries and running jupyter notebooks locally. I should recall that there was a strong emphasis in Live Coding 1 that we should install with mamba, instead of pip.

I’m trying to deploy my DL model on Huggingface Spaces, too. In order to run locally one of the notebooks shown in Lesson 2, I need to install gradio. However, in the documentation it is indicated to install with pip. Furthermore, searching in this forum (ctrl+F) “gradio installation” I found that Jeremy also used pip to do this installation in Live Coding 18.

I’m very confused, I don’t understand anymore what has happened with the advice of Live Coding 1 of making a habit to install with mamba. Nonetheless, I’m currently finished with Live Coding 2 and many things could have been said from Live Coding 3 to 18 about why we could also use pip to do python libraries installations.

I also looked through the posts of live coding to see when Jeremy starts to use pip, and thanks to the video timeline of @Daniel, I could find a part where Jeremy talks about using both mamba and pip. And as far as I understand, we actually could use both.

So, I’m wondering if anyone can confirm this, i.e., that I won’t get any problems if I do this installation with pip.

5 Likes

I am also interested in this. The videos are using Mamba but the docs.fast.ai page seems to have changed to use pip instead. I am not sure what the recommended way is nowadays (I assume pip since that is what the doc says?).

I recommend strictly using pip. This don’t cause dependency clashes on my laptop.

For anyone who comes across this, I believe Mamba is the way to go because:

  1. Mamba has built-in support for creating virtual environments whereas with pip you have to use other tools like venv to manage your environments.

  2. pip can only manage Python packages, so if your Python package has an underlying dependency on a C/C++ lib (very common in ML), you would have to make sure that your system has the correct version of that lib and manage that dependency yourself (which create other problems like different Python packages relying on different system libs). Jeremy also mentions the CUDA example in the video the OP linked, where you have to manually make sure your CUDA version (which pip doesn’t install) is compatible with the PyTorch version you are using. If you use Mamba/Conda, those CUDA dependencies are automatically resolved (with the correct version) for you.

  3. By learning Mamba/Conda commands, you can install software for other environments too like Java, etc whereas everything you learn with pip is not transferable to other platforms.

Informative content.