fujiisoup / py3nj

Wigner's 3J, 6J, 9J symbols for python
https://py3nj.readthedocs.io/
Apache License 2.0
18 stars 5 forks source link

Installation issue #18

Open loicsacre opened 1 year ago

loicsacre commented 1 year ago

Whenever I am trying to install the package with pip or from source, using Python3.7 or 3.8, on MacOsX 10.9 (x86_64) or Ubuntu 20, I am getting error while building the wheel for py3nj.

Here are some examples of the error: ubuntu-error.txt macos-error.txt

I have also tried the solution proposed in https://github.com/fujiisoup/py3nj/issues/10#issuecomment-853030283 for MacOs, without success... env CC=/usr/local/Cellar/gcc/11.2.0_3/bin/gcc-11 pip install py3nj

PS: I need to install this package for using https://github.com/QUVA-Lab/escnn

fujiisoup commented 1 year ago

It looks like the following line indicates the cause

clang: error: unsupported option '-fopenmp'

I think openmp must be installed in the system (although the package description does not say that)

loicsacre commented 1 year ago

Thank you for answer. For linux I needed to install gfortran (see https://github.com/QUVA-Lab/escnn/issues/21#issuecomment-1356315791).

For MacOs, I will test it later and will keep you informed

momierr commented 1 year ago

Though the issue is closed, this might help some users: on macOS (M1 pro chip), even after installing gcc via homebrew, the gcc command is an alias to clang. Symlinked gcc to /opt/homebrew/bin/gcc-12 as follows: cd /opt/homebrew/bin ln -s gcc-12 gcc Then CC=gcc pip3 install py3nj installs the package without errors. CC=gcc python setup.py install also works to build from source. That's a workaround as I couldn't manage to make the installation work with clang.

fujiisoup commented 1 year ago

Thank you @momierr for instruction. I made a pull-request readme.md https://github.com/fujiisoup/py3nj/blob/edc1dd18cdb0962487e79e0f85759ca7992cdda1/README.md?plain=1#L56-L68

I have no macOSs and am not able to confirm, but do you think the above description is fine? or if you suggest any alternatives, I will adopt it.

momierr commented 1 year ago

It would be better to mention that it is valid for macOS running on M1 CPU. Otherwise the instructions are fine!