Python using Anaconda

I prefer to install miniforge or Miniconda and then install whatever packages I need. Miniforge can be installed from brew, see below.

conda update conda
conda update --all
conda install numpy scipy sympy matplotlib ipython jupyter
conda install prettytable
conda install pylint autopep8 # vscode wants these
conda install clingo          # needed by spack
conda install meshio          # to read gmsh grids
conda install nose            # needed to use pyclaw
conda install tensorflow      # if you need this

I set PATH to point to anaconda directory

export PATH=/path/to/anaconda/bin:$PATH

See installed packages

conda list

Upgrade all packages

conda upgrade --all

Periodically, delete older versions of packages

conda clean --all

Use Eigen with tensorflow

Install Miniconda and then

conda update conda
conda install nomkl  # use openblas instead of mkl
conda update --all
conda install tensorflow-eigen

Install Mayavi: using anaconda

Make sure you are using pip from anaconda

conda install mayavi
pip install PyQt5

To upgrade pip installed packages

pip install --upgrade PyQt5 PyQt5-sip

Install Mayavi: using pip

Anaconda may not have the latest mayavi, then use pip. Make sure you are using pip from anaconda.

pip install mayavi
pip install PyQt5

To upgrade pip installed packages

pip install --upgrade mayavi PyQt5

To see packages installed with pip

conda list | grep pypi

Install via brew

miniforge is a community version of miniconda which can be easily installed using brew.

brew install --cask miniforge
conda init zsh  # If you use zsh, this modifies your .zshrc file
conda activate

Now you can install the packages you need.

pylab

pylab imports some commonly used modules like numpy. Define an alias

alias pylab="ipython --pylab --matplotlib --nosep --pprint"

Now you can use it like this

$ pylab
Python 3.9.9 | packaged by conda-forge | (main, Dec 20 2021, 02:41:07)
Type 'copyright', 'credits' or 'license' for more information
IPython 8.0.0 -- An enhanced Interactive Python. Type '?' for help.
Using matplotlib backend: MacOSX
In [1]: x = linspace(0, pi, 100)
In [2]: y = sin(10 * x)
In [3]: plot(x, y)

Nbextensions

Install this to get ToC and other features.

conda install  jupyter_contrib_nbextensions