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

Giuseppe 'ferdy' Miceli ferdy at ferdy.it
Mon Oct 4 10:26:41 UTC 2021


	ciao artemio,

> On 3 Oct 2021, at 23:05, Artemio González López via macports-users <macports-users at lists.macports.org <mailto:macports-users at lists.macports.org>> wrote:
> 
> I have installed the python37 port, and would like to install the scientific libraries numpy, scipy, and matplotlib, and also jupyter. I installed by hand the ports

first of all, unless you have specific reasons, i would suggest to install python39. 

depending on your choice, i would suggest to set the relevant variant in /opt/local/etc/macports/variants.conf

i have installed python39 and these are the variants i set up:

wabi:macports-ports admin$ egrep python /opt/local/etc/macports/variants.conf
+python
-python2
-python27
+python3
+python39
wabi:macports-ports admin$

secondly, installing a python3x port should have installed also python_select and python3_select ports.

these are intended to let you choose which version of python you would use as default (please keep in mind macports allows you to have different versions of python alongside including the apple stock ones).

port select —summary shall show you the correct status:

wabi:macports-ports admin$ port select --summary
Name      Selected       Options
====      ========       =======
docutils  py39-docutils  py39-docutils none
pip       pip39          pip3-apple pip39 none
pip2      none           none
pip3      pip39          pip3-apple pip39 none
pygments  py39-pygments  py39-pygments none
python    python39       python27 python27-apple python38-apple python39 none
python2   python27       python27 python27-apple none
python3   python39       python38-apple python39 none
sphinx    py39-sphinx    none

"sudo port select python[3] python39” allows to choose which one you would like to use.

wabi:macports-ports admin$ sudo port select python3 python39
Selecting 'python39' for 'python3' succeeded. 'python39' is now active.
wabi:macports-ports admin$

at this point you shall install the different modules and port command shall installed and correctly configure the needed ones.

hope it helps, please do not hesitate to ask further should you need.

regards,
—
ferdy

> py-numpy, py-scipy, py-matplotlib, py-jupyter
> 
> (without specifying a version), and port installed python39, py39-jupyter and the 3.7 versions of all of the above packages. However, when I launched jupyter notebook and tried to run one of my notebooks it couldn’t find any of the scientific libraries I had installed. I then deactivated python39 and py39-jupyter, and installed py37-jupyter. It gave me numerous errors complaining that I had to activate by hand several ports (liek, e.g., sudo port -f activate py37-ipython), but in the end was built. However, when I now launch jupyter notebook I get a message complaining that no kernels where found, and when I run my notebook the scientific libraries aren’t found. I would greatly appreciate any help as to how to fix the mess I probably created, so that I could use python's scientific libraries with python’s MacPorts (instead of using, say, miniconda).
> 
> Sorry for my clumsiness, and thank you all in advance!
> 
> Artemio
> 
> 
> Artemio Gonzalez Lopez
> artemiog at mac.com <mailto:artemiog at mac.com>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-users/attachments/20211004/49917ecd/attachment.htm>


More information about the macports-users mailing list