Recommendation for installing Python modules: pip or Macports

Ralph Seichter ralph at ml.seichter.de
Tue Dec 6 19:10:52 UTC 2022


* Thomas Gederberg:

> It appears that you can either install Python modules
> (py310-matplotlib, py310-numpy, etc) either directly from MacPorts or
> you can install pip (for example py30-pip) with MacPorts and then use
> pip to install the modules.

The issue with installing Python modules using MacPorts ports is that
they are shared. That can cause problems if different Python programs
require different versions of particular modules, and in contrast the
storage space saved by sharing modules is negligible.

My go-to method is using Python virtual environments (via the included
"venv" module, which is leightweight and installs its own "pip"); one
venv for each of my various Python applications:

  https://docs.python.org/3/tutorial/venv.html

Using separate environments isolates Python apps. I have not had to deal
with incompatible shared modules since I started using venvs, and this
is well worth a little extra storage space to me.

-Ralph


More information about the macports-users mailing list