Search code examples
pythonmacoscondavirtualenvpython-venv

Nested Virtual Environment


Hi I am new to MACOS and I am using conda for installing and running Python scripts. While working like that I decided to create project folders and create venvs inside of the folders. So that whenever I create venv I inherit from conda virtual env. Is it meaningful to do that? Is it the best practice? At the final my terminal indicator shown like that (cantaenv) (base) computername..... Thank you.


Solution

  • If you have something that you know you need in all the sub-environments, like a command line tool that you use across all the environments, or some package that you know you need for every environment, then it can make sense to do that. I'd use that sparingly though, since the more you have, the more things can run into each other. Like say one of your sub-environments uses the latest version of some package, but another requires an older version for whatever reason, then you'd want to not do a nest there.

    The more you do it though, the harder it's going to be to track and manage dependencies. When you update something in the base environment, and then one of your sub-environment projects stops working a few weeks later, you're going to have a harder time remembering exactly what might have broken it, or what version of that package you need for it to work.