Dolfinx installation issue: cannot install UFCx

Hello,
I am on OSX Sonoma 14.1, and I am trying to install Dolfinx. I installed the dependencies Boost, Cmake, pkg-config, Basix, plugixml, PETSc HDF5, but I cannot install UFCx.

I went to the FFCx github website, downloaded the .zip, unpaked it, and saw in the INSTALL file that in order to install FFCx, I have to do

pip install --prefix=/path/to/install/

but I get the errror

% pip install /usr/local/include       
zsh: command not found: pip

I tried pip3, and I get

% pip3 install /usr/local/include
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try brew install
    xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a non-brew-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip.
    
    If you wish to install a non-brew packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

So I don’t know what to do… May you please help me?
Thank you

If you are sure you want to install to /usr/local you may want to try this flag, otherwise you may choose to install elsewhere in the user path (e.g. with --user)

Hello,
I finally managed to install ffcx (which, as far as I can tell, contains the desired package ufcx):

% pip3 install fenics-ffcx
Defaulting to user installation because normal site-packages is **not** writeable
Requirement already satisfied: fenics-ffcx in /Users/x/.local/lib/python3.10/site-packages (0.7.0)
[...]
Requirement already satisfied: pycparser in /Users/x/.local/lib/python3.10/site-packages (from cffi->fenics-ffcx) (2.21)
[notice] A **new** release of pip is available: 23.0.1 -> 24.0
[notice] To update, run: pip3 install --upgrade pip
%

however, when I run the installation of dolfin-x, I still get the error message that ufcx cannot be found

 % cmake ..
fatal: not a git repository (or any of the parent directories): .git
-- Found Boost 1.84.0 at /opt/homebrew/lib/cmake/Boost-1.84.0
[...]
ModuleNotFoundError: No module named 'ffcx'
CMake Error at /usr/local/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find UFCx (missing: UFCX_INCLUDE_DIRS UFCX_SIGNATURE
  UFCX_VERSION) (Required is at least version "0.7")
      Reason given by package: UFCx could not be found.
Call Stack (most recent call first):
  /usr/local/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  cmake/modules/FindUFCx.cmake:72 (find_package_handle_standard_args)
  CMakeLists.txt:359 (find_package)
-- Configuring incomplete, errors occurred!

Do you know how to fix this ? Thank you

Try with

export UFC_DIR=/Users/x/.local

Furthermore,

ModuleNotFoundError: No module named 'ffcx'

seems to imply that /Users/x/.local/lib/python3.10/site-packages is not in your python path

I did export UFC_DIR=/Users/x/.local and cmake .. again, and I get the same error.
How can I add /Users/x/.local/lib/python3.10/site-packages to my python path ?

export PYTHONPATH=/Users/x/.local/lib/python3.10/site-packages:$PYTHONPATH

It works, thank you.