2020-11-23 Joost Kremers wrote:
I can include packages installed in `site-packages` and have them available in all code blocks. But is there a way to import my own packages into a session? In particular, packages I haven't installed system-wide?
I do not have a recipe ready for using with org mode, and maybe you have already tried the following instruments:
1. Besides system-wide site-packages directory, there is similar ones for users, used by e.g. `pip install` (unless it is disabled accordingly to some recommendations).
2. It seems that *recommended* and more flexible way is per-project (per-version) virtual environments: venv in python3, similar thing were called virtualenv in python2: https://docs.python.org/3/tutorial/venv.html Maybe there is a convenient way to choose and switch venv's directly from emacs. In simple cases venv could be activated before starting emacs.
3. The Hitchhiker's Guide to Python have a couple of related sections. They might be a bit outdated but could be a source for convincing arguments to use venv's or for some usage patterns.
https://docs.python-guide.org/dev/virtualenvs/ https://docs.python-guide.org/dev/pip-virtualenv/