pySTEPS / pysteps

Python framework for short-term ensemble prediction systems.
https://pysteps.github.io/
BSD 3-Clause "New" or "Revised" License
466 stars 168 forks source link

Problem with pyproject.toml #263

Closed leducanhmti closed 2 years ago

leducanhmti commented 2 years ago

I have this error when try to install pysteps by pip. Can anyone help me with this?

Screen Shot 2022-02-08 at 13 50 38
aperezhortal commented 2 years ago

Hi @leducanhmti, welcome to Pysteps!

On which platform are you trying to install pysteps (windows, Linux, OSX)? Which python version do you have?

leducanhmti commented 2 years ago

Hi @aperezhortal, thanks for your reply. I'm working on macOS BigSur, python 3.8.9 in HomeBrew.

aperezhortal commented 2 years ago

Probably there is a problem with the GCC compiler.

Try the following steps:

brew install gcc

export CC=gcc-9
export CXX=g++-9

pip install -v pysteps

The -v flag in the last command should provide information on the error (if any). If pip fails and you don't see a more detailed error, try running python setup.py build_ext -i and paste here the output of that command.

leducanhmti commented 2 years ago

Here is the output when I try to run

pip install -v pysteps

error: command 'gcc-9' failed: No such file or directory error: subprocess-exited-with-error

× Building wheel for pysteps (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip. full command: /Library/Developer/CommandLineTools/usr/bin/python3 /Users/anhld/Library/Python/3.8/lib/python/site-packages/pip/_vendor/pep517/in_process/_in_process.py buildwheel /var/folders/p/8vgqnkvx3r72cb461r4ryqxhs93dyy/T/tmpm8l532c cwd: /private/var/folders/p/8vgqnkvx3r72cb461r4ryqxhs93dyy/T/pip-install-4e333lxi/pysteps_26eda09c279d4a93969a3af3252720bf Building wheel for pysteps (pyproject.toml) ... error ERROR: Failed building wheel for pysteps Failed to build pysteps ERROR: Could not build wheels for pysteps, which is required to install pyproject.toml-based projects

aperezhortal commented 2 years ago

It seems that homebrew is installing a newer version of the gcc compiler (v11): https://formulae.brew.sh/formula/gcc

Possible solutions:

Option 1

Use gcc version 11 to compile pysteps.

export CC=gcc-11
export CXX=g++-11

pip install -v pysteps

Option 2

Install gcc-9 and use it to compile pysteps.

brew install gcc@9

export CC=gcc-9
export CXX=g++-9

pip install -v pysteps
leducanhmti commented 2 years ago

I already try this before but it still have an error like this

Option 2

gcc-9 -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x8664 -Werror=implicit-function-declaration -I/private/var/folders/p/8vgqnkvx3r72cb461r4ryqxhs93dyy/T/pip-build-env-328qa4mg/overlay/lib/python3.8/site-packages/numpy/core/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c pysteps/motion/_proesmans.c -o build/temp.macosx-10.14-x86_64-3.8/pysteps/motion/_proesmans.o -fopenmp -O3 -ffast-math gcc-9: error: this compiler does not support arm64 gcc-9: error: unrecognized command line option '-iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders' gcc-9: error: unrecognized command line option '-iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers' error: command '/usr/local/bin/gcc-9' failed with exit code 1 error: subprocess-exited-with-error

× Building wheel for pysteps (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip. full command: /Library/Developer/CommandLineTools/usr/bin/python3 /Users/anhld/Library/Python/3.8/lib/python/site-packages/pip/_vendor/pep517/in_process/_in_process.py buildwheel /var/folders/p/8vgqnkvx3r72cb461r4ryqxhs93dyy/T/tmpr_jjdr3 cwd: /private/var/folders/p/8vgqnkvx3r72cb461r4ryqxhs93dyy/T/pip-install-3abhphfp/pysteps_4f0f8a1cffcd440a90d143d5482ef05d Building wheel for pysteps (pyproject.toml) ... error ERROR: Failed building wheel for pysteps Failed to build pysteps ERROR: Could not build wheels for pysteps, which is required to install pyproject.toml-based projects

Optoin 1

gcc-11 -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers -arch arm64 -arch x8664 -Werror=implicit-function-declaration -I/private/var/folders/p/8vgqnkvx3r72cb461r4ryqxhs93dyy/T/pip-build-env-0cak4u7m/overlay/lib/python3.8/site-packages/numpy/core/include -I/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/include/python3.8 -c pysteps/motion/_proesmans.c -o build/temp.macosx-10.14-x86_64-3.8/pysteps/motion/_proesmans.o -fopenmp -O3 -ffast-math gcc-11: error: this compiler does not support arm64 gcc-11: error: unrecognized command-line option '-iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders' gcc-11: error: unrecognized command-line option '-iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/Headers' error: command '/usr/local/bin/gcc-11' failed with exit code 1 error: subprocess-exited-with-error

× Building wheel for pysteps (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip. full command: /Library/Developer/CommandLineTools/usr/bin/python3 /Users/anhld/Library/Python/3.8/lib/python/site-packages/pip/_vendor/pep517/in_process/_in_process.py buildwheel /var/folders/p/8vgqnkvx3r72cb461r4ryqxhs93dyy/T/tmpycedljg cwd: /private/var/folders/p/8vgqnkvx3r72cb461r4ryqxhs93dyy/T/pip-install-v2zl25lb/pysteps_ce3a0f8b85f44c55b8e3907e7ca3813c Building wheel for pysteps (pyproject.toml) ... error ERROR: Failed building wheel for pysteps Failed to build pysteps ERROR: Could not build wheels for pysteps, which is required to install pyproject.toml-based projects

leducanhmti commented 2 years ago

Hi @aperezhortal, thanks for your help.

After upgrading to python 3.9.2, I can install pySTEPS now. I will close this issue. Thanks a lot.