Pip is installing all packages in the base environment

I imagine this question has been asked before but I couldn’t find a solution; forgive me if this is a duplicate.

My issue is that pip is installing all packages in the base environment even when I’m in a virtual environment that I created with conda create. My understanding is this is not expected/desired behavior… the package installation should be in the env that I’m currently in.

I think the description below is a related to the problem I described above (based on the answer here: python - Where to install pip packages inside my Conda environment? - Stack Overflow) but this stack overflow post doesn’t offer a solution to the problem.

When I run the below command in a my env tweets, it correctly says I’m in that env

But when I ask which pip while in the tweets env I get the following:
$ which pip
^^ which I think indicates that all packages would be installed in the base env

Based on the stack overflow above I would expect which pip to return:


Hopefully this all makes sense and someone can help me figure out how to get packages installed into my virtual envs rather than the base. Thanks in advance!

When I’ve had this happen it was because I had a bare, new conda environment with nothing inside it yet (no Python, no pip, nothing yet). If I create an environment with conda create -n python=3.10 it installs a lot of base stuff into the environment like pip/python so then once I use pip, it doesn’t revert to the base environment.

I consider this a bug, though, it is really unexpected and bad behavior! At the very least it should give a warning that it is about to pollute your base environment.