Macports, pip, and vent
Joshua Root
jmr at macports.org
Tue Apr 23 17:33:09 UTC 2024
> I’m setting up to use a collection of python codes developed by someone else, and to run them I’ll need to use some python modules/packages that aren’t available via MacPorts (nvector, pykml, and stripy). From looking over old posts it appears that the best way to do this is to install all of the packages available from MacPorts either in my main environment or in the virtual environment and the PyPI-available packages only in the virtual environment. I’ve not fiddled with venv stuff before - I assume that everything available in my main environment will also be available in the virtual environment unless it is “hidden” behind something installed in the virtual environment. Is this correct?
This is the case only if you use the --system-site-packages option.
<https://docs.python.org/3/library/venv.html#creating-virtual-environments>
If that option is used, I would guess that pip will consider
requirements to be satisfied by MacPorts-installed modules as long as
the version is acceptable, and install a different version in the venv
if not. But I haven't tested that theory. Generally
--system-site-packages is avoided in order to prevent unexpected
behaviour changes due to the presence of random other modules. (Simple
severe failure case: an installed module is buggy and crashes on import.
Anything that inspects all installed modules by importing them will then
hit that crash.)
- Josh
More information about the macports-users
mailing list