enthought / mayavi

3D visualization of scientific data in Python
http://docs.enthought.com/mayavi/mayavi/
Other
1.28k stars 282 forks source link

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 45 #1169

Closed goodi4u-h closed 1 year ago

goodi4u-h commented 1 year ago

I tried to install mayavi with the following command in my conda virtual environment

$ python -m pip install git+https://github.com/enthought/mayavi.git But, there is an issue. I attached the log when running the command It seems an similar issue was reported before (https://github.com/enthought/mayavi/issues/1015) Please check the issue

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 45: ordinal not in range(128) overall log is in the attached txt file mayavi_fail.txt

JulioZhao97 commented 1 year ago

I met the same problem today

ch0rl commented 1 year ago

same issue for me but position 198

JAGulin commented 1 year ago

I added a print for the offending output, and in my case it's:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 45: ordinal not in range(128)
b'gcc: error: unrecognized command line option \xe2\x80\x98-mavx512vnni\xe2\x80\x99; did you mean \xe2\x80\x98-mavx5124vnniw\xe2\x80\x99?\n'

The \xXX are escaped non-ascii characters adding color/style to the error message, which of course is not at all useful in this case. Adding the option -fno-diagnostics-color cleans it up and I'd suggest to include that overall.

gcc -mavx512vnni -fno-diagnostics-color gcc: error: unrecognized command line option ‘-mavx512vnni’; did you mean ‘-mavx5124vnniw’?

I tried to inject the flag from the side, to test if we got a better error message without the DecodeError.

CFLAGS="-fno-diagnostics-color" python setup.py install

Unfortunately, it didn't take effect, although I could see the flag actually listed in the log. I hope the maintainers can make use of the information anyway to get rid of the DecodeError and hopefully instead present the more useful error message. Perhaps it should be considered a problem in distuils itself.


@goodi4u-h I see in your log that you also failed on the mavx512vnni test, so perhaps the root cause is the same as mine.

I found that mavx512vnni was introduced in gcc 8 or so, and my build was successful when using that.

gcc --version gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

sudo apt-get install gcc-8

gcc-8 --version gcc-8 (Ubuntu 8.4.0-1ubuntu1~18.04) 8.4.0

Then make sure to use it:

CC=gcc-8 python -m pip install -e .

or

CC="gcc-8" python setup.py install

Maybe proper handling of the build requirements is part of #1075 already.

goodi4u-h commented 1 year ago

Thanks for the comment I had gcc-9, it worked with the following command in my conda virtual environment

$ git clone https://github.com/enthought/mayavi.git $ cd mayavi $ CC=gcc-9 python setup.py install

Python==3.9.12 vtk==9.2.2 pyqt5==5.15.7 gcc-9 (Ubuntu 9.4.0-1ubuntu1~18.04) 9.4.0

JAGulin commented 1 year ago

@goodi4u-h Great to know that workaround was successful for you as well. I personally think that the issue should be kept open. I hope the maintainers can make use of the information to get rid of the DecodeError (perhaps enforce "gcc -fno-diagnostics-color") and instead present the more useful error message.

@JulioZhao97 @ch0rl What compiler version are you running?