What is the best way of installing Python's scientific libraries in MacPorts?

Ryan Schmidt ryandesign at macports.org
Tue Oct 5 22:20:50 UTC 2021


On Oct 4, 2021, at 08:43, Artemio González López wrote:

> 1. Should I activate python39 and decativate python37 before installing the 3.9 versions fo numpy, scipy and matplotlib?

It's not necessary. MacPorts handles dependencies for you. If you install e.g. py39-numpy and python39 is not already active, MacPorts will activate it for you.

> Can both be active at the same time after that, or should I keep 3.7 inactive for good (or unistall it)?

You may keep as many different versions of python and its modules installed and active at the same time as you wish. They are not supposed to conflict with one another. If they do, file a bug report.


> 2. Should I install (say) py-numpy or more specifically py39-numpy?

You should probably install the subport for the specific version of python that you want, e.g. py39-numpy.

If you install py-numpy, that's just a stub port that installs nothing but a readme file, and today it declares a dependency on py39-numpy so that gets installed as well. At some time in the future, however, a py310-numpy might exist and the py-numpy port would then change to depend on that. When you upgrade your ports, py310-numpy would then be installed, in addition to py39-numpy which would remain installed initially, however if you later run "sudo port reclaim" MacPorts might remove py39-numpy if nothing that's installed depends on it anymore. This could break programs you write if your programs specifically need py39-numpy.


> 3. Is it OK if the 3.7 versions of the py-* package are active throughout this installation process (and afterwards), or should I also deactivate them?

See 1.




More information about the macports-users mailing list