RSE-Sheffield / conda-environments-for-effective-and-reproducible-research

Introduction to Conda for (Data) Scientists
https://rse.shef.ac.uk/conda-environments-for-effective-and-reproducible-research/
Other
0 stars 2 forks source link

Prevent installation with pip when not in virtual environment #39

Open ns-rse opened 7 months ago

ns-rse commented 7 months ago

Random I came across to prevent installing anything with pip outside of a virtual environment.

pip config set global.require-virtualenv True

Creates the file ~/.config/pip/pip.conf with the contents

[global]
require-virtualenv = True

And pip should then complain if you try to pip install outside of a virtualenv.

Apparently you can set the PIP_REQUIRE_VIRTUALENV=true in your .zshrc or .bashrc too.

I wonder if there is similar to prevent installation in the base conda environment. :thinking: