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 on Mac #10

Open fujiisoup opened 3 years ago

fujiisoup commented 3 years ago

Copied from an email from Soumen Basak

I am unable to install the "PY3NJ" package in Thonny (https://thonny.org/). The installation error message had a single-version-externally-managed flag. The page https://pypi.org/project/py3nj/ says Python 3.6 only. This suggests that it is incompatible with the interpreter that Thonny is using (in my case 3.7.7). So, I request you to update P3NJ such that I can install it in THONNY.

fujiisoup commented 3 years ago

py3nj is tested also with python 3.7.

Can you leave the detailed error message? Although I don't use THONY, I'll take a look.

soumenbasak commented 3 years ago

See below for the whole messages. The error messages are at the end.

Collecting py3nj Downloading https://files.pythonhosted.org/packages/f4/10/edd6cc68949c914a9c08e1947e302a9d8569ea0e9f348dd28b0fcaca1303/py3nj-0.1.1.tar.gz Building wheels for collected packages: py3nj Building wheel for py3nj (setup.py): started Building wheel for py3nj (setup.py): finished with status 'error' ERROR: Command errored out with exit status 1: command: /Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/x6/vlm2g8gd4yl_gj7042rp8w8m0000gn/T/pip-install-sfhtnvic/py3nj/setup.py'"'"'; file='"'"'/private/var/folders/x6/vlm2g8gd4yl_gj7042rp8w8m0000gn/T/pip-install-sfhtnvic/py3nj/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/x6/vlm2g8gd4yl_gj7042rp8w8m0000gn/T/pip-wheel-tkqflf8j --python-tag cp37 cwd: /private/var/folders/x6/vlm2g8gd4yl_gj7042rp8w8m0000gn/T/pip-install-sfhtnvic/py3nj/ Complete output (48 lines): running bdist_wheel running build running config_cc unifing config_cc, config, build_clib, build_ext, build commands --compiler options running config_fc unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options running build_src build_src building py_modules sources building extension "py3nj._wigner" sources f2py options: [] adding 'build/src.macosx-10.9-x86_64-3.7/build/src.macosx-10.9-x86_64-3.7/fortran/fortranobject.c' to sources. adding 'build/src.macosx-10.9-x86_64-3.7/build/src.macosx-10.9-x86_64-3.7/fortran' to include_dirs. build_src: building npy-pkg config files running build_py creating build/lib.macosx-10.9-x86_64-3.7 creating build/lib.macosx-10.9-x86_64-3.7/py3nj copying py3nj/init.py -> build/lib.macosx-10.9-x86_64-3.7/py3nj copying py3nj/_version.py -> build/lib.macosx-10.9-x86_64-3.7/py3nj copying py3nj/wigner.py -> build/lib.macosx-10.9-x86_64-3.7/py3nj running build_ext customize UnixCCompiler customize UnixCCompiler using build_ext get_default_fcompiler: matching types: '['gnu95', 'nag', 'absoft', 'ibm', 'intel', 'gnu', 'g95', 'pg']' customize Gnu95FCompiler Could not locate executable gfortran Could not locate executable f95 customize NAGFCompiler customize AbsoftFCompiler Could not locate executable f90 Could not locate executable f77 customize IBMFCompiler Could not locate executable xlf90 Could not locate executable xlf customize IntelFCompiler Could not locate executable ifort Could not locate executable ifc customize GnuFCompiler Could not locate executable g77 customize G95FCompiler Could not locate executable g95 customize PGroupFCompiler Could not locate executable pgfortran don't know how to compile Fortran code on platform 'posix' warning: build_ext: f77_compiler=None is not available.

building 'py3nj._wigner' extension error: extension 'py3nj._wigner' has Fortran sources but no Fortran compiler found

ERROR: Failed building wheel for py3nj Running setup.py clean for py3nj Failed to build py3nj Installing collected packages: py3nj Running setup.py install for py3nj: started Running setup.py install for py3nj: finished with status 'error' ERROR: Command errored out with exit status 1: command: /Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/x6/vlm2g8gd4yl_gj7042rp8w8m0000gn/T/pip-install-sfhtnvic/py3nj/setup.py'"'"'; file='"'"'/private/var/folders/x6/vlm2g8gd4yl_gj7042rp8w8m0000gn/T/pip-install-sfhtnvic/py3nj/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/x6/vlm2g8gd4yl_gj7042rp8w8m0000gn/T/pip-record-ju1void0/install-record.txt --single-version-externally-managed --compile --user --prefix= cwd: /private/var/folders/x6/vlm2g8gd4yl_gj7042rp8w8m0000gn/T/pip-install-sfhtnvic/py3nj/ Complete output (48 lines): running install running build running config_cc unifing config_cc, config, build_clib, build_ext, build commands --compiler options running config_fc unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options running build_src build_src building py_modules sources building extension "py3nj._wigner" sources f2py options: [] adding 'build/src.macosx-10.9-x86_64-3.7/build/src.macosx-10.9-x86_64-3.7/fortran/fortranobject.c' to sources. adding 'build/src.macosx-10.9-x86_64-3.7/build/src.macosx-10.9-x86_64-3.7/fortran' to include_dirs. build_src: building npy-pkg config files running build_py creating build/lib.macosx-10.9-x86_64-3.7 creating build/lib.macosx-10.9-x86_64-3.7/py3nj copying py3nj/init.py -> build/lib.macosx-10.9-x86_64-3.7/py3nj copying py3nj/_version.py -> build/lib.macosx-10.9-x86_64-3.7/py3nj copying py3nj/wigner.py -> build/lib.macosx-10.9-x86_64-3.7/py3nj running build_ext customize UnixCCompiler customize UnixCCompiler using build_ext get_default_fcompiler: matching types: '['gnu95', 'nag', 'absoft', 'ibm', 'intel', 'gnu', 'g95', 'pg']' customize Gnu95FCompiler Could not locate executable gfortran Could not locate executable f95 customize NAGFCompiler customize AbsoftFCompiler Could not locate executable f90 Could not locate executable f77 customize IBMFCompiler Could not locate executable xlf90 Could not locate executable xlf customize IntelFCompiler Could not locate executable ifort Could not locate executable ifc customize GnuFCompiler Could not locate executable g77 customize G95FCompiler Could not locate executable g95 customize PGroupFCompiler Could not locate executable pgfortran don't know how to compile Fortran code on platform 'posix' warning: build_ext: f77_compiler=None is not available.

building 'py3nj._wigner' extension
error: extension 'py3nj._wigner' has Fortran sources but no Fortran compiler found
----------------------------------------

ERROR: Command errored out with exit status 1: /Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/x6/vlm2g8gd4yl_gj7042rp8w8m0000gn/T/pip-install-sfhtnvic/py3nj/setup.py'"'"'; file='"'"'/private/var/folders/x6/vlm2g8gd4yl_gj7042rp8w8m0000gn/T/pip-install-sfhtnvic/py3nj/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/x6/vlm2g8gd4yl_gj7042rp8w8m0000gn/T/pip-record-ju1void0/install-record.txt --single-version-externally-managed --compile --user --prefix= Check the logs for full command output.

Process failed, return code: 1

fujiisoup commented 3 years ago

Thanks for posting the error message. It looks that you don't have a Fortran compiler.

Please install gfortran or its alternative. I think this page helps. https://scipy.github.io/old-wiki/pages/F2PY_Windows.html

soumenbasak commented 3 years ago

I use mac osx. Please send me the same link for mac

Soumen

On Sun, Oct 11, 2020, 13:59 Keisuke Fujii notifications@github.com wrote:

Thanks for posting the error message. It looks that you don't have a Fortran compiler.

Please install gfortran or its alternative. I think this page helps. https://scipy.github.io/old-wiki/pages/F2PY_Windows.html

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fujiisoup/py3nj/issues/10#issuecomment-706669972, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARDQLACPOTESITQVK6JYB2LSKFUH5ANCNFSM4SLTMFRA .

fujiisoup commented 3 years ago

Just google "how to install gfortran on macos" This is my quick search. https://gcc.gnu.org/wiki/GFortranBinaries

soumenbasak commented 3 years ago

I have installed gfortran using homebrew.

Soumens-MacBook-Pro:~ soumenbasak$ which gfortran

/usr/local/bin/gfortran

Soumens-MacBook-Pro:~ soumenbasak$ /usr/local/bin/gfortran -v

Using built-in specs.

COLLECT_GCC=/usr/local/bin/gfortran

COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin15.6.0/7.1.0/lto-wrapper

Target: x86_64-apple-darwin15.6.0

Configured with: ../gcc-7.1.0/configure --enable-languages=c++,fortran

Thread model: posix

gcc version 7.1.0 (GCC)

Soumens-MacBook-Pro:~ soumenbasak$

However, I am getting the same error messages when I try to install py3nj within thonny.

Soumen

On Sun, Oct 11, 2020 at 2:44 PM Keisuke Fujii notifications@github.com wrote:

Just google "how to install gfortran on macos" This is my quick search. https://gcc.gnu.org/wiki/GFortranBinaries

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fujiisoup/py3nj/issues/10#issuecomment-706674981, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARDQLAHLKV3UZHPWA6TTWUDSKFZQPANCNFSM4SLTMFRA .

-- Dr. Soumen Basak Associate Professor School of Physics Indian Institute of Science Education and Research Thiruvananthapuram m: +91-9674388077, +91-8304927959 a: Maruthamala Post Office, Vithura, Thiruvananthapuram - 695005, Kerala, India w: www.iisertvm.ac.in e: sbasak2006@gmail.com

fujiisoup commented 3 years ago

Is the error message then same? Then maybe the compiler cannot be seen from the python environment.

I don't know how Thony works. Maybe installing py3nj from pip solves the problem?

soumenbasak commented 3 years ago

See the attachment for the error messages. I use Thonny for my work. So, i need to call py3nj functions in my code. Otherwise it will be very inconvenient for me to use py3nj.

Does py3nj work in python3.6 only or does it work in python3.7 as well ?

Soumen

On Sun, Oct 11, 2020 at 6:26 PM Keisuke Fujii notifications@github.com wrote:

Is the error message there same? Then meet be the compiler cannot be seen from the other environment.

However, I don't know how Thony works. Maybe installing py3nj from pip solves the problem?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fujiisoup/py3nj/issues/10#issuecomment-706701032, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARDQLAFNMMXWQ6U3HXKWQSDSKGTRPANCNFSM4SLTMFRA .

-- Dr. Soumen Basak Associate Professor School of Physics Indian Institute of Science Education and Research Thiruvananthapuram m: +91-9674388077, +91-8304927959 a: Maruthamala Post Office, Vithura, Thiruvananthapuram - 695005, Kerala, India w: www.iisertvm.ac.in e: sbasak2006@gmail.com

soumenbasak commented 3 years ago

I will speak to my system administrator on this issue tomorrow. If you have specific suggestions, that may resolve this issue, for him, please let me know.

Best regards Soumen

On Sun, Oct 11, 2020 at 7:46 PM Soumen Basak sbasak@iisertvm.ac.in wrote:

See the attachment for the error messages. I use Thonny for my work. So, i need to call py3nj functions in my code. Otherwise it will be very inconvenient for me to use py3nj.

Does py3nj work in python3.6 only or does it work in python3.7 as well ?

Soumen

On Sun, Oct 11, 2020 at 6:26 PM Keisuke Fujii notifications@github.com wrote:

Is the error message there same? Then meet be the compiler cannot be seen from the other environment.

However, I don't know how Thony works. Maybe installing py3nj from pip solves the problem?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/fujiisoup/py3nj/issues/10#issuecomment-706701032, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARDQLAFNMMXWQ6U3HXKWQSDSKGTRPANCNFSM4SLTMFRA .

-- Dr. Soumen Basak Associate Professor School of Physics Indian Institute of Science Education and Research Thiruvananthapuram m: +91-9674388077, +91-8304927959 a: Maruthamala Post Office, Vithura, Thiruvananthapuram - 695005, Kerala, India w: www.iisertvm.ac.in e: sbasak2006@gmail.com

-- Dr. Soumen Basak Associate Professor School of Physics Indian Institute of Science Education and Research Thiruvananthapuram m: +91-9674388077, +91-8304927959 a: Maruthamala Post Office, Vithura, Thiruvananthapuram - 695005, Kerala, India w: www.iisertvm.ac.in e: sbasak2006@gmail.com

fujiisoup commented 3 years ago

Does py3nj work in python3.6 only or does it work in python3.7 as well ?

py3nj is being tested also with python 3.7. This is not the python compatibility problem, but the problem of the environment construction.

If you have specific suggestions, that may resolve this issue, for him, please let me

Please ask him to expose your fortran compiler to python.

SergeiDBykov commented 3 years ago

Have the same issue of MacOS with gfortran, gcc, etc installed. Any ideas what to do?

fujiisoup commented 3 years ago

@SergeiDBykov Thanks for your post. Are you also using THONNY?

Could you post the error message here?

SergeiDBykov commented 3 years ago

@SergeiDBykov Thanks for your post. Are you also using THONNY?

Could you post the error message here?

Sure, thanks, here it is: https://pastebin.com/ahJynN4E

I use anaconda, not THONNY, but I think it does not matter since the problem is in installation, not execution.

SergeiDBykov commented 3 years ago

Hey @fujiisoup @soumenbasak, I solved the problem (at my second laptop, I will try on my first one tomorrow)

this solution works:

env CC=/usr/local/Cellar/gcc/10.2.0_2/bin/gcc-10 pip install py3nj

wheree 10.2.0_2 is the latest version of your gcc.

fujiisoup commented 3 years ago

@SergeiDBykov Thank you! This info helps as I don't have a macOS.

I'd try updating setup.py to avoid this confusion.

If you have any spare time, could you try the following

pip install git+https://github.com/fujiisoup/py3nj@openmp_in_macos 

without setting the environmental variable?

It would be nice if other macOS users will not be bothered again.

SergeiDBykov commented 3 years ago

Sure, I'll try tomorrow when I get to work.

SergeiDBykov commented 3 years ago

@fujiisoup Hi, your build does not help so far, here is the error: https://pastebin.com/C055RT2z

I did install the package at my second laptop, but have to do this beforehand:

brew install llvm libomp

export PATH=/usr/bin:$PATH

env CC=/usr/local/Cellar/gcc/10.2.0_2/bin/gfortran pip install py3nj

may be env CC=/usr/local/Cellar/gcc/10.2.0_2/bin/gcc-10 pip install py3nj also works, but I have not tried

fujiisoup commented 3 years ago

@SergeiDBykov Thank you for your help. It looks be difficult for me to improve this issue without macOS. I'll just add some tips on readme and wait for contributions from mac users.

Thank you for raising an issue.

Rody50 commented 3 years ago

Hi @fujiisoup @SergeiDBykov, I had the same error message as Sergei while trying to install the package and I could resolve it by using Sergei's solution: env CC=/usr/local/Cellar/gcc/10.2.0_4/bin/gcc-10 pip install py3nj

fujiisoup commented 3 years ago

@Rody50 Thanks for the report!

A contribution to our setup.py is very welcome!

srijaniiserprinceton commented 10 months ago

Hi, I think I tried almost all the available solutions in the other issues for MAC OS installation but nothing seems to work. The more interesting part is that I have been using py3nj extensively and only now see an issue when trying to create a different environment. What I then did was I went back to the environment I use all the time and uninstalled py3nj using pip uninstall py3nj and then attempted reinstalling by pip install py3nj and end up with this error

(env-qdPy) bash-3.2$ pip install py3nj
Collecting py3nj
  Using cached py3nj-0.2.0.tar.gz (50 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
    Preparing wheel metadata ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/srijanbharatidas/opt/anaconda3/envs/env-qdPy/bin/python3.7 /Users/srijanbharatidas/opt/anaconda3/envs/env-qdPy/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/zs/7xl5phjx0lb8y9xc74styyhh0000gq/T/tmpw3fbnb7m
         cwd: /private/var/folders/zs/7xl5phjx0lb8y9xc74styyhh0000gq/T/pip-install-06oomyz2/py3nj_355f3fbab75641b2a356554155a54749
    Complete output (20 lines):
    + meson setup /private/var/folders/zs/7xl5phjx0lb8y9xc74styyhh0000gq/T/pip-install-06oomyz2/py3nj_355f3fbab75641b2a356554155a54749 /private/var/folders/zs/7xl5phjx0lb8y9xc74styyhh0000gq/T/pip-install-06oomyz2/py3nj_355f3fbab75641b2a356554155a54749/.mesonpy-a1w9_rla -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/private/var/folders/zs/7xl5phjx0lb8y9xc74styyhh0000gq/T/pip-install-06oomyz2/py3nj_355f3fbab75641b2a356554155a54749/.mesonpy-a1w9_rla/meson-python-native-file.ini
    The Meson build system
    Version: 1.2.3
    Source dir: /private/var/folders/zs/7xl5phjx0lb8y9xc74styyhh0000gq/T/pip-install-06oomyz2/py3nj_355f3fbab75641b2a356554155a54749
    Build dir: /private/var/folders/zs/7xl5phjx0lb8y9xc74styyhh0000gq/T/pip-install-06oomyz2/py3nj_355f3fbab75641b2a356554155a54749/.mesonpy-a1w9_rla
    Build type: native build
    Project name: py3nj
    Project version: 0.2.0
    Fortran compiler for the host machine: gfortran (gcc 10.2.0 "GNU Fortran (GCC) 10.2.0")
    Fortran linker for the host machine: gfortran ld64 556.5
    C compiler for the host machine: cc (clang 11.0.3 "Apple clang version 11.0.3 (clang-1103.0.32.29)")
    C linker for the host machine: cc ld64 556.5
    Host machine cpu family: x86_64
    Host machine cpu: x86_64
    Program python found: YES (/Users/srijanbharatidas/opt/anaconda3/envs/env-qdPy/bin/python3.7)
    Run-time dependency OpenMP found: NO (tried system)

    ../meson.build:39:17: ERROR: Dependency "openmp" not found, tried system

    A full log can be found at /private/var/folders/zs/7xl5phjx0lb8y9xc74styyhh0000gq/T/pip-install-06oomyz2/py3nj_355f3fbab75641b2a356554155a54749/.mesonpy-a1w9_rla/meson-logs/meson-log.txt
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/21/f9/799cfe5dcc73e0fcd15ccb7776272f13071bc339d3e33c4e39f87f4648b0/py3nj-0.2.0.tar.gz#sha256=8a25820d5375ea677344d9752b190115bf0b46129979279e8d82e744d870a374 (from https://pypi.org/simple/py3nj/). Command errored out with exit status 1: /Users/srijanbharatidas/opt/anaconda3/envs/env-qdPy/bin/python3.7 /Users/srijanbharatidas/opt/anaconda3/envs/env-qdPy/lib/python3.7/site-packages/pip/_vendor/pep517/in_process/_in_process.py prepare_metadata_for_build_wheel /var/folders/zs/7xl5phjx0lb8y9xc74styyhh0000gq/T/tmpw3fbnb7m Check the logs for full command output.
  Using cached py3nj-0.1.2-cp37-cp37m-macosx_10_9_x86_64.whl
Installing collected packages: py3nj
Successfully installed py3nj-0.1.2

Does anyone else see this when trying to install py3nj now?

fujiisoup commented 10 months ago

Hi @srijaniiserprinceton It looks like you need OpenMP installed in your system. I am not familiar with mac, but probably brew install libomp does it

srijaniiserprinceton commented 10 months ago

Hi @fujiisoup

I had tried brew install libomp earlier but it gives me the same error. I tried downgrading python to 3.7 and re-ran the installation. I even made sure I installed gfortran in the local environment and it still returns me the following error

(astero_avni) bash-3.2$ pip install py3nj
Collecting py3nj                                                                                                                               
  Using cached py3nj-0.2.0.tar.gz (50 kB)                                                                                                      
  Installing build dependencies ... done                                                                                                       
  Getting requirements to build wheel ... done                                                                                                 
  Installing backend dependencies ... done                                                                                                     
  Preparing metadata (pyproject.toml) ... error                                                                                                
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      + meson setup /private/var/folders/zs/7xl5phjx0lb8y9xc74styyhh0000gq/T/pip-install-s183_g78/py3nj_3cac00a359384a43a485532ee833d3cc /private/var/folders/zs/7xl5phjx0lb8y9xc74styyhh0000gq/T/pip-install-s183_g78/py3nj_3cac00a359384a43a485532ee833d3cc/.mesonpy-e1zjweog -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/private/var/folders/zs/7xl5phjx0lb8y9xc74styyhh0000gq/T/pip-install-s183_g78/py3nj_3cac00a359384a43a485532ee833d3cc/.mesonpy-e1zjweog/meson-python-native-file.ini
      The Meson build system
      Version: 1.2.3
      Source dir: /private/var/folders/zs/7xl5phjx0lb8y9xc74styyhh0000gq/T/pip-install-s183_g78/py3nj_3cac00a359384a43a485532ee833d3cc
      Build dir: /private/var/folders/zs/7xl5phjx0lb8y9xc74styyhh0000gq/T/pip-install-s183_g78/py3nj_3cac00a359384a43a485532ee833d3cc/.mesonpy-e1zjweog
      Build type: native build
      Project name: py3nj
      Project version: 0.2.0

      ../meson.build:1:0: ERROR: Compiler /Users/srijanbharatidas/opt/anaconda3/envs/astero_avni/bin/x86_64-apple-darwin13.4.0-gfortran cannot compile programs.

      A full log can be found at /private/var/folders/zs/7xl5phjx0lb8y9xc74styyhh0000gq/T/pip-install-s183_g78/py3nj_3cac00a359384a43a485532ee833d3cc/.mesonpy-e1zjweog/meson-logs/meson-log.txt
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
WARNING: There was an error checking the latest version of pip.

I think I am most confused with the line ../meson.build:1:0: ERROR: Compiler /Users/srijanbharatidas/opt/anaconda3/envs/astero_avni/bin/x86_64-apple-darwin13.4.0-gfortran cannot compile programs.. I have also tried the solution suggested above by @SergeiDBykov with

env CC=/usr/local/Cellar/gcc/13.2.0/bin/gcc-13 pip install py3nj

but that returns me the same error with x86_64-apple-darwin13.4.0-gfortran replaced by gcc-13.