conda-forge / qgis-feedstock

A conda-smithy repository for qgis.
BSD 3-Clause "New" or "Revised" License
41 stars 25 forks source link

faulthandler error arm mac #301

Open joaoponceleao opened 1 year ago

joaoponceleao commented 1 year ago

Solution to issue cannot be found in the documentation.

Issue

Hi,

The latest qgis for mac arm gives a faulthandler error on startup:

An error occurred during execution of following code: faulthandler.enable(file=fault_handler_file)

Traceback (most recent call last):
File "'', line 1, in
PermissionError: [Errno 1] Operation not permitted

Haven't tested to see how it affects QGIS.

Related ( I can split this into a separate issue): I also noticed some errors due to missing python modules which usually come included with QGIS due to a number of plugins requiring them: matplotlib, pandas, scipy. Which brings me to the following error messages in the qgis log on startup:

CRITICAL    Invalid Data Source : /Users/joao/-m is not a valid or recognized data source.
CRITICAL    Invalid Data Source : /Users/joao/pip is not a valid or recognized data source.
CRITICAL    Invalid Data Source : /Users/joao/install is not a valid or recognized data source.
CRITICAL    Invalid Data Source : /Users/joao/scipy is not a valid or recognized data source.

I imagine this is due to a plugin trying to install scipy. QGIS allows plugins to install modules when they're missing. Naturally, we can install ourselves in the conda env, but something should be done about the above errors: I don't see why a plugin would use the system pip to install rather than QGIS's own pip (in this case the conda env).

Finally, getting the following errors, presumably due to current settings from the official package. Would be nice to fix those without having to change the QGIS preferences that are used by the official packages too.

CRITICAL    Problem with SAGA installation: SAGA was not found or is not correctly installed
CRITICAL    Problem with GRASS installation: GRASS was not found or is not correctly installed

Installed packages

# packages in environment at /Users/joao/.conda-envs/qgis:
#
# Name                    Version                   Build  Channel
blosc                     1.21.3               h1d6ff8b_0    conda-forge
boost-cpp                 1.78.0               h1cb353e_1    conda-forge
brotlipy                  0.7.0           py311he2be06e_1005    conda-forge
bzip2                     1.0.8                h3422bc3_4    conda-forge
c-ares                    1.18.1               h3422bc3_0    conda-forge
ca-certificates           2022.12.7            h4653dfc_0    conda-forge
cairo                     1.16.0            h73a0509_1014    conda-forge
ceres-solver              2.1.0                ha0d94fb_1    conda-forge
certifi                   2022.12.7          pyhd8ed1ab_0    conda-forge
cffi                      1.15.1          py311hae827db_3    conda-forge
cfitsio                   4.2.0                h2f961c4_0    conda-forge
charset-normalizer        2.1.1              pyhd8ed1ab_0    conda-forge
coverage                  7.1.0           py311he2be06e_0    conda-forge
cryptography              39.0.1          py311h507f6e9_0    conda-forge
curl                      7.87.0               h9049daf_0    conda-forge
draco                     1.5.6                hffc8910_0    conda-forge
eigen                     3.4.0                hc021e02_0    conda-forge
exiv2                     0.27.6               h98a1b47_1    conda-forge
expat                     2.5.0                hb7217d7_0    conda-forge
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 hab24e00_0    conda-forge
fontconfig                2.14.2               h82840c6_0    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
freetype                  2.12.1               hd633e50_1    conda-forge
freexl                    1.0.6                h1a8c8d9_1    conda-forge
future                    0.18.3             pyhd8ed1ab_0    conda-forge
gdal                      3.6.2           py311h43bd5d3_7    conda-forge
geos                      3.11.1               hb7217d7_0    conda-forge
geotiff                   1.7.1                hdcdc974_6    conda-forge
gettext                   0.21.1               h0186832_0    conda-forge
gflags                    2.2.2             hc88da5d_1004    conda-forge
giflib                    5.2.1                h27ca646_2    conda-forge
glib                      2.74.1               hb5ab8b9_1    conda-forge
glib-tools                2.74.1               hb5ab8b9_1    conda-forge
glog                      0.6.0                h6da1cb0_0    conda-forge
gmp                       6.2.1                h9f76cd9_0    conda-forge
gsl                       2.7                  h6e638da_0    conda-forge
gst-plugins-base          1.22.0               h8b7775e_0    conda-forge
gstreamer                 1.22.0               hcb7b3dd_0    conda-forge
hdf4                      4.2.15               h1a38d6a_5    conda-forge
hdf5                      1.12.2          nompi_ha7af310_101    conda-forge
httplib2                  0.21.0             pyhd8ed1ab_0    conda-forge
icu                       70.1                 h6b3803e_0    conda-forge
idna                      3.4                pyhd8ed1ab_0    conda-forge
jinja2                    3.1.2              pyhd8ed1ab_1    conda-forge
jpeg                      9e                   h1a8c8d9_3    conda-forge
json-c                    0.16                 hc449e50_0    conda-forge
kealib                    1.5.0                hfd766a6_0    conda-forge
krb5                      1.20.1               h69eda48_0    conda-forge
laz-perf                  3.3.0                hffc8910_0    conda-forge
lcms2                     2.14                 h481adae_1    conda-forge
lerc                      4.0.0                h9a09cb3_0    conda-forge
libaec                    1.0.6                hb7217d7_1    conda-forge
libblas                   3.9.0           16_osxarm64_openblas    conda-forge
libcblas                  3.9.0           16_osxarm64_openblas    conda-forge
libclang                  14.0.6          default_h81a5282_0    conda-forge
libclang13                14.0.6          default_he70ec0d_0    conda-forge
libcurl                   7.87.0               h9049daf_0    conda-forge
libcxx                    14.0.6               h2692d47_0    conda-forge
libdeflate                1.17                 h1a8c8d9_0    conda-forge
libedit                   3.1.20191231         hc8eb9b7_2    conda-forge
libev                     4.33                 h642e427_1    conda-forge
libffi                    3.4.2                h3422bc3_5    conda-forge
libgdal                   3.6.2                hfc7748e_7    conda-forge
libgfortran               5.0.0           11_3_0_hd922786_27    conda-forge
libgfortran5              11.3.0              hdaf2cc0_27    conda-forge
libglib                   2.74.1               h4646484_1    conda-forge
libiconv                  1.17                 he4db4b2_0    conda-forge
libkml                    1.3.0             h41464e4_1015    conda-forge
liblapack                 3.9.0           16_osxarm64_openblas    conda-forge
libllvm14                 14.0.6               hf6e71e7_1    conda-forge
libnetcdf                 4.9.1           nompi_h66d6d65_100    conda-forge
libnghttp2                1.51.0               hae82a92_0    conda-forge
libogg                    1.3.4                h27ca646_1    conda-forge
libopenblas               0.3.21          openmp_hc731615_3    conda-forge
libopus                   1.3.1                h27ca646_1    conda-forge
libpng                    1.6.39               h76d750c_0    conda-forge
libpq                     15.2                 h1a28acd_0    conda-forge
libprotobuf               3.21.12              hb5ab8b9_0    conda-forge
librttopo                 1.1.0               h844f84d_12    conda-forge
libspatialindex           1.9.3                hbdafb3b_4    conda-forge
libspatialite             5.0.1               h14115fc_23    conda-forge
libsqlite                 3.40.0               h76d750c_0    conda-forge
libssh2                   1.10.0               h7a5bd25_3    conda-forge
libtasn1                  4.19.0               h1a8c8d9_0    conda-forge
libtiff                   4.5.0                h5dffbdd_2    conda-forge
libvorbis                 1.3.7                h9f76cd9_0    conda-forge
libwebp                   1.2.4                h999c80f_1    conda-forge
libwebp-base              1.2.4                h57fd34a_0    conda-forge
libxml2                   2.10.3               h87b0503_0    conda-forge
libxslt                   1.1.37               h1bd8bc4_0    conda-forge
libzip                    1.9.2                h76ab92c_1    conda-forge
libzlib                   1.2.13               h03a7124_4    conda-forge
llvm-openmp               15.0.7               h7cfbb63_0    conda-forge
lz4-c                     1.9.4                hb7217d7_0    conda-forge
markupsafe                2.1.2           py311he2be06e_0    conda-forge
metis                     5.1.0             h9f76cd9_1006    conda-forge
mock                      5.0.1              pyhd8ed1ab_0    conda-forge
mpfr                      4.1.0                h6d7a090_1    conda-forge
mysql-common              8.0.31               h518ea0a_0    conda-forge
mysql-libs                8.0.31               hcb599eb_0    conda-forge
ncurses                   6.3                  h07bb92c_1    conda-forge
nitro                     2.7.dev6             h6b3803e_5    conda-forge
nose2                     0.9.2                      py_0    conda-forge
nspr                      4.35                 hb7217d7_0    conda-forge
nss                       3.88                 h789eff7_0    conda-forge
numpy                     1.24.2          py311h60f8152_0    conda-forge
openjpeg                  2.5.0                hbc2ba62_2    conda-forge
openssl                   3.0.8                h03a7124_0    conda-forge
owslib                    0.27.2             pyhd8ed1ab_1    conda-forge
packaging                 23.0               pyhd8ed1ab_0    conda-forge
pcre2                     10.40                hb34f9b4_0    conda-forge
pdal                      2.5.1                h0b95922_1    conda-forge
pip                       23.0               pyhd8ed1ab_0    conda-forge
pixman                    0.40.0               h27ca646_0    conda-forge
plotly                    5.13.0             pyhd8ed1ab_0    conda-forge
ply                       3.11                       py_1    conda-forge
poppler                   23.01.0              h9564b9f_0    conda-forge
poppler-data              0.4.12               hd8ed1ab_0    conda-forge
postgresql                15.2                 h45c140d_0    conda-forge
proj                      9.1.1                h13f728c_2    conda-forge
psycopg2                  2.9.3           py311hcffe8fe_2    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pygments                  2.14.0             pyhd8ed1ab_0    conda-forge
pyopenssl                 23.0.0             pyhd8ed1ab_0    conda-forge
pyparsing                 3.0.9              pyhd8ed1ab_0    conda-forge
pyproj                    3.4.1           py311hef8691e_1    conda-forge
pyqt                      5.15.7          py311h7203e35_3    conda-forge
pyqt5-sip                 12.11.0         py311ha397e9f_3    conda-forge
pyqtwebkit                5.15.7          py311he2d8cc6_5    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.11.0          h3ba56d0_1_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python_abi                3.11                    3_cp311    conda-forge
pytz                      2022.7.1           pyhd8ed1ab_0    conda-forge
pyyaml                    6.0             py311he2be06e_5    conda-forge
qca                       2.3.5                h70399c6_2    conda-forge
qgis                      3.28.3          py311h1f0c9b3_1    conda-forge
qjson                     0.9.0             hf490b44_1009    conda-forge
qscintilla2               2.13.4          py311he2d8cc6_0    conda-forge
qt-main                   5.15.8               hfe8d25c_6    conda-forge
qtkeychain                0.13.2               hf490b44_2    conda-forge
qtwebkit                  5.212                hbfb98c5_7    conda-forge
qwt                       6.2.0                hf490b44_5    conda-forge
readline                  8.1.2                h46ed386_0    conda-forge
requests                  2.28.2             pyhd8ed1ab_0    conda-forge
setuptools                67.1.0             pyhd8ed1ab_0    conda-forge
sip                       6.7.7           py311ha397e9f_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
snappy                    1.1.9                h17c5cce_2    conda-forge
sqlite                    3.40.0               h2229b38_0    conda-forge
suitesparse               5.10.1               h7cd81ec_1    conda-forge
tbb                       2021.7.0             hffc8910_1    conda-forge
tenacity                  8.2.1              pyhd8ed1ab_0    conda-forge
tiledb                    2.13.2               h9bd36d0_0    conda-forge
tk                        8.6.12               he1e0b03_0    conda-forge
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
tomli                     2.0.1              pyhd8ed1ab_0    conda-forge
tzcode                    2022g                h1a8c8d9_0    conda-forge
tzdata                    2022g                h191b570_0    conda-forge
urllib3                   1.26.14            pyhd8ed1ab_0    conda-forge
wheel                     0.38.4             pyhd8ed1ab_0    conda-forge
xerces-c                  3.2.4                h627aa08_1    conda-forge
xz                        5.2.6                h57fd34a_0    conda-forge
yaml                      0.2.5                h3422bc3_2    conda-forge
zlib                      1.2.13               h03a7124_4    conda-forge
zstd                      1.5.2                hf913c23_6    conda-forge

Environment info

active environment : qgis
    active env location : /Users/joao/.conda-envs/qgis
            shell level : 1
       user config file : /Users/joao/.condarc
 populated config files : /opt/homebrew/Caskroom/mambaforge/base/.condarc
                          /Users/joao/.condarc
          conda version : 22.11.1
    conda-build version : not installed
         python version : 3.10.9.final.0
       virtual packages : __archspec=1=arm64
                          __osx=13.2=0
                          __unix=0=0
       base environment : /opt/homebrew/Caskroom/mambaforge/base  (writable)
      conda av data dir : /opt/homebrew/Caskroom/mambaforge/base/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-arm64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://conda.anaconda.org/udst/osx-arm64
                          https://conda.anaconda.org/udst/noarch
                          https://conda.anaconda.org/bioconda/osx-arm64
                          https://conda.anaconda.org/bioconda/noarch
                          https://repo.anaconda.com/pkgs/main/osx-arm64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-arm64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /opt/homebrew/Caskroom/mambaforge/base/pkgs
                          /Users/joao/.conda/pkgs
       envs directories : /Users/joao/.conda-envs
                          /opt/homebrew/Caskroom/mambaforge/base/envs
                          /Users/joao/.conda/envs
               platform : osx-arm64
             user-agent : conda/22.11.1 requests/2.28.2 CPython/3.10.9 Darwin/22.3.0 OSX/13.2
                UID:GID : 501:20
             netrc file : None
           offline mode : False
SrNetoChan commented 1 year ago

@joaoponceleao Yes, exactly. Are there any know results of this error? Besides the error itself? If not, I would let the error be. There's no point in disable it just to omit the error message IMHO.

joaoponceleao commented 1 year ago

Problem is the error pops up a window that needs to be clicked to continue loading qgis. Many will fail to see the window pop up and just wait... This behaviour would need to be disabled for this particular error.

SrNetoChan commented 1 year ago

Well, I am -0 to apply this patch n our conda builds.

If others feel it's important we can do it. Truth is that most folks will not miss this functionality, but we should keep this ticket open to keep an eye on it. Even if it's not a conda issue (which is a relief)

gillins commented 1 year ago

So no one knows what causes the error? Sorry, I'm just trying to catch up here.

SrNetoChan commented 1 year ago

No. It only happens in macos arm, not in x64. We were the first to build in MacOS arm, but seems that the same error appear in mac os arm64 using homebrew, so it's not a conda thing. besides, it seems that the folder have write permissions so...

gillins commented 1 year ago

Hmm would be good to have a QGIS developer comment on this. Or someone who knows the finer details of OSX security....

justinbb commented 1 year ago

Another couple of observations. Although the call to faulthandler.enable() fails, the traceback file is nevertheless created (empty). As @Firefishy notes, faulthandler.is_enabled() returns true but nothing is ever written to the file. (To test the faulthandler by provoking a python crash, see the Example at the end of https://docs.python.org/3/library/faulthandler.html)

If, in the QGIS python console, I do

faulthandler.disable()
faulthandler.enable(file=qgis.utils.__qgis_fault_handler_file)

the call succeeds without any error messages. If I then provoke a python crash, the traceback file does contain the expected information about the crash.

All this to say that the problem seems to be with the timing of the attempt to open the file, or some other state-related problem that is resolved by the time QGIS has finished starting up.

I wonder if delaying the initialization of python would help any (or just break many other things). I wonder if the problem might have something to do with app startup procedures that are handled by Qt calling Mac system routines, and if the whole thing might just go away with the impending upgrade to Qt 6.

nilason commented 11 months ago

FYI, same issue on ARM machines with MacPorts too https://trac.macports.org/ticket/67844.

gillins commented 2 months ago

Has this been fixed upstream?

justinbb commented 2 months ago

No, the bug https://github.com/qgis/QGIS/issues/52987 is still open with no recent activity.