I quite often find that this would be useful but I'm not sure there's any way to do this. I'm often working on a python project where I start the project with a virtual environment for the project and a Jupyter notebook. I start adding libraries to the virtual environment as I experiment in the Jupyter notebook. The problem is that if I run
pip freeze > requirements.txt
at the end of my project that file will include the libraries for jupyter in my virtual environment. Is there some way I can run a Jupyter notebook (e.g. in my base conda environment) but use a kernel associated with another virtual environment? This seems like the nicest solutions but I'm not sure if this is possible? I know I could probably do something to remove these from what is frozen but that seems like a hack. I can't see any way to avoid installing at least ipykernel in the target virtual environment