conda-forge / qgis-feedstock

A conda-smithy repository for qgis.
BSD 3-Clause "New" or "Revised" License
41 stars 26 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
gillins commented 1 year ago

@SrNetoChan is this the same error you are seeing?

SrNetoChan commented 1 year ago

Yes @gillins the first one is the one I saw, I couldn't investigate more to understand what it implies.

The rest of the errors described by @joaoponceleao are sort of expected. We have no builds with saga or grass (but installing by your own would probably fix it) and about plugins... Well, they are not designed to work with conda. You can install the package using conda, or you can install pip using conda. That way any installation from plugins should use that pip. I would prefer the first option.

gillins commented 1 year ago

@SrNetoChan just tested this on linux_aarch64 and I don't see any of the above errors - all seems to be fine. What is it about the OSX build that is causing this? And is it also a problem on x86 OSX?

SrNetoChan commented 1 year ago

I have no idea. I have limited access to the Mac OS M1 machine, so I didn't get to try much more and see what is failing. There's that error an a bunch of warnings, but for general purpose, everything seems to work fine.

gillins commented 1 year ago

Ah fair enough, I don't have access to OSX either - will leave it for someone with more OSX experience to investigate and resolve. Good to hear it works fine though!

joaoponceleao commented 1 year ago

I suspect it may be more to do with the OS (Ventura) and its new permissions system rather than the arm architecture. I can try installing it under rosetta to see but best would be someone with an M1 testing it under the previous Monterey OS.

ivn951 commented 1 year ago

My system configuration:

macBook pro M1 Pro 16 GB SO Ventura 13.0.1

confirm error @joaoponceleao :

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

Notifications from terminal :

(qgis3_283_env) ivano@MBP-di-Ivano ~ % qgis 
Warning: Broken filename passed to function
Warning: Broken filename passed to function
Warning: Broken filename passed to function
Warning: Broken filename passed to function
Warning: Broken filename passed to function
Warning: Broken filename passed to function
Warning: Broken filename passed to function
Warning: Populating font family aliases took 182 ms. Replace uses of missing font family "FreeSans" with one that exists to avoid this cost. 
Warning: Broken filename passed to function
Warning: Broken filename passed to function
Warning: Broken filename passed to function
Warning: QWidget::insertAction: Attempt to insert null action
Warning: QWidget::insertAction: Attempt to insert null action
Warning: QWidget::insertAction: Attempt to insert null action
Warning: Broken filename passed to function
"<font color=\"red\">An error occurred during execution of following code:<br><tt>faulthandler.enable(file=fault_handler_file)</tt></font><br><pre><br>Traceback (most recent call last):<br>&nbsp; File \"<string>\", line 1, in <module><br>PermissionError: [Errno 1] Operation not permitted<br><br></pre>Python version:<br>3.11.0 | packaged by conda-forge | (main, Jan 14 2023, 12:29:41) [Clang 14.0.6 ]<br><br>QGIS version:<br>3.28.3-Firenze 'Firenze', exported<br><br>Python path:<br>['/opt/homebrew/Caskroom/miniforge/base/envs/qgis3_283_env/share/qgis/python', '/Users/ivano/Library/Application Support/QGIS/QGIS3/profiles/ivangeek/python', '/Users/ivano/Library/Application Support/QGIS/QGIS3/profiles/ivangeek/python/plugins', '/opt/homebrew/Caskroom/miniforge/base/envs/qgis3_283_env/share/qgis/python/plugins', '/opt/homebrew/Caskroom/miniforge/base/envs/qgis3_283_env/share/qgis/python/plugins', '/opt/homebrew/Caskroom/miniforge/base/envs/qgis3_283_env/share/qgis/python', '/Users/ivano', '/opt/homebrew/Caskroom/miniforge/base/envs/qgis3_283_env/lib/python311.zip', '/opt/homebrew/Caskroom/miniforge/base/envs/qgis3_283_env/lib/python3.11', '/opt/homebrew/Caskroom/miniforge/base/envs/qgis3_283_env/lib/python3.11/lib-dynload', '/opt/homebrew/Caskroom/miniforge/base/envs/qgis3_283_env/lib/python3.11/site-packages']"

If you run the installation in an environment with intel packages (rosetta), everything is fine without any error reports.

(qgis3_283_ros) ivano@MBP-di-Ivano ~ % qgis
Warning: Broken filename passed to function
Warning: Broken filename passed to function
Warning: Broken filename passed to function
Warning: Broken filename passed to function
Warning: Broken filename passed to function
Warning: Broken filename passed to function
Warning: Broken filename passed to function
Warning: Populating font family aliases took 339 ms. Replace uses of missing font family "FreeSans" with one that exists to avoid this cost. 
Warning: Broken filename passed to function
Warning: Broken filename passed to function
Warning: Broken filename passed to function
Warning: QWidget::insertAction: Attempt to insert null action
Warning: QWidget::insertAction: Attempt to insert null action
Warning: QWidget::insertAction: Attempt to insert null action
Warning: Broken filename passed to function

Note the difference in performance in (ms).

So I would not say that the problems could be related to the Ventura operating system.

ivn951 commented 1 year ago

qgis3_283_env

## Package Plan ##

  environment location: /opt/homebrew/Caskroom/miniforge/base/envs/qgis3_283_env

  added / updated specs:
    - qgis

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    blosc-1.21.3               |       h1d6ff8b_0          28 KB  conda-forge
    brotlipy-0.7.0             |py311he2be06e_1005         353 KB  conda-forge
    ca-certificates-2022.12.7  |       h4653dfc_0         142 KB  conda-forge
    ceres-solver-2.1.0         |       ha0d94fb_1         974 KB  conda-forge
    cffi-1.15.1                |  py311hae827db_3         272 KB  conda-forge
    coverage-7.1.0             |  py311he2be06e_0         343 KB  conda-forge
    cryptography-39.0.1        |  py311h507f6e9_0         1.1 MB  conda-forge
    curl-7.88.0                |       h9049daf_0         139 KB  conda-forge
    draco-1.5.6                |       hffc8910_0         710 KB  conda-forge
    eigen-3.4.0                |       hc021e02_0         1.2 MB  conda-forge
    exiv2-0.27.6               |       h98a1b47_1         925 KB  conda-forge
    fontconfig-2.14.2          |       h82840c6_0         232 KB  conda-forge
    freetype-2.12.1            |       hd633e50_1         559 KB  conda-forge
    future-0.18.3              |     pyhd8ed1ab_0         357 KB  conda-forge
    gdal-3.6.2                 |  py311h43bd5d3_7         1.5 MB  conda-forge
    geotiff-1.7.1              |       hdcdc974_6         110 KB  conda-forge
    gflags-2.2.2               |    hc88da5d_1004          85 KB  conda-forge
    glib-2.74.1                |       hb5ab8b9_1         473 KB  conda-forge
    glib-tools-2.74.1          |       hb5ab8b9_1          96 KB  conda-forge
    glog-0.6.0                 |       h6da1cb0_0          95 KB  conda-forge
    gmp-6.2.1                  |       h9f76cd9_0         557 KB  conda-forge
    gsl-2.7                    |       h6e638da_0         2.6 MB  conda-forge
    gst-plugins-base-1.22.0    |       h8b7775e_0         1.8 MB  conda-forge
    gstreamer-1.22.0           |       hcb7b3dd_0         1.3 MB  conda-forge
    hdf5-1.12.2                |nompi_ha7af310_101         2.8 MB  conda-forge
    jpeg-9e                    |       h1a8c8d9_3         213 KB  conda-forge
    kealib-1.5.0               |       hfd766a6_0         126 KB  conda-forge
    krb5-1.20.1                |       h69eda48_0         1.0 MB  conda-forge
    laz-perf-3.3.0             |       hffc8910_0          96 KB  conda-forge
    lcms2-2.14                 |       h481adae_1         200 KB  conda-forge
    libaec-1.0.6               |       hb7217d7_1          27 KB  conda-forge
    libclang-14.0.6            |default_h81a5282_0         127 KB  conda-forge
    libclang13-14.0.6          |default_he70ec0d_0         7.4 MB  conda-forge
    libcurl-7.88.0             |       h9049daf_0         315 KB  conda-forge
    libdeflate-1.17            |       h1a8c8d9_0          47 KB  conda-forge
    libgdal-3.6.2              |       hfc7748e_7         7.5 MB  conda-forge
    libgfortran-5.0.0          |11_3_0_hd922786_27         143 KB  conda-forge
    libgfortran5-11.3.0        |      hdaf2cc0_27         1.0 MB  conda-forge
    libllvm14-14.0.6           |       hf6e71e7_1        24.9 MB  conda-forge
    libnetcdf-4.9.1            |nompi_h66d6d65_100         636 KB  conda-forge
    libnghttp2-1.51.0          |       hae82a92_0         549 KB  conda-forge
    libogg-1.3.4               |       h27ca646_1         203 KB  conda-forge
    libopus-1.3.1              |       h27ca646_1         247 KB  conda-forge
    libpng-1.6.39              |       h76d750c_0         253 KB  conda-forge
    libpq-15.2                 |       h1a28acd_0         2.3 MB  conda-forge
    libprotobuf-3.21.12        |       hb5ab8b9_0         1.7 MB  conda-forge
    libspatialite-5.0.1        |      h14115fc_23         2.7 MB  conda-forge
    libtasn1-4.19.0            |       h1a8c8d9_0         114 KB  conda-forge
    libtiff-4.5.0              |       h5dffbdd_2         339 KB  conda-forge
    libvorbis-1.3.7            |       h9f76cd9_0         249 KB  conda-forge
    libwebp-1.2.4              |       h999c80f_1          76 KB  conda-forge
    libxslt-1.1.37             |       h1bd8bc4_0         231 KB  conda-forge
    llvm-openmp-15.0.7         |       h7cfbb63_0         257 KB  conda-forge
    lz4-c-1.9.4                |       hb7217d7_0         138 KB  conda-forge
    markupsafe-2.1.2           |  py311he2be06e_0          25 KB  conda-forge
    metis-5.1.0                |    h9f76cd9_1006         4.1 MB  conda-forge
    mock-5.0.1                 |     pyhd8ed1ab_0          31 KB  conda-forge
    mpfr-4.1.0                 |       h6d7a090_1         379 KB  conda-forge
    mysql-common-8.0.31        |       h518ea0a_0         1.9 MB  conda-forge
    mysql-libs-8.0.31          |       hcb599eb_0         1.9 MB  conda-forge
    nitro-2.7.dev6             |       hb7217d7_5         496 KB  conda-forge
    nspr-4.35                  |       hb7217d7_0         216 KB  conda-forge
    nss-3.88                   |       h789eff7_0         1.7 MB  conda-forge
    numpy-1.24.2               |  py311h60f8152_0         6.4 MB  conda-forge
    openjpeg-2.5.0             |       hbc2ba62_2         300 KB  conda-forge
    openssl-3.0.8              |       h03a7124_0         2.0 MB  conda-forge
    packaging-23.0             |     pyhd8ed1ab_0          40 KB  conda-forge
    pdal-2.5.1                 |       h0b95922_1         2.6 MB  conda-forge
    pip-23.0.1                 |     pyhd8ed1ab_0         1.3 MB  conda-forge
    plotly-5.13.0              |     pyhd8ed1ab_0         4.2 MB  conda-forge
    poppler-23.01.0            |       h9564b9f_0         1.4 MB  conda-forge
    poppler-data-0.4.12        |       hd8ed1ab_0         2.2 MB  conda-forge
    postgresql-15.2            |       h45c140d_0         4.0 MB  conda-forge
    proj-9.1.1                 |       h13f728c_2         2.4 MB  conda-forge
    psycopg2-2.9.3             |  py311hcffe8fe_2         160 KB  conda-forge
    pygments-2.14.0            |     pyhd8ed1ab_0         805 KB  conda-forge
    pyopenssl-23.0.0           |     pyhd8ed1ab_0         124 KB  conda-forge
    pyproj-3.4.1               |  py311hef8691e_1         417 KB  conda-forge
    pyqt-5.15.7                |  py311h7203e35_3         3.7 MB  conda-forge
    pyqt5-sip-12.11.0          |  py311ha397e9f_3          69 KB  conda-forge
    pyqtwebkit-5.15.9          |  py311he2d8cc6_1         123 KB  conda-forge
    python-3.11.0              |h3ba56d0_1_cpython        13.8 MB  conda-forge
    python_abi-3.11            |          3_cp311           6 KB  conda-forge
    pytz-2022.7.1              |     pyhd8ed1ab_0         182 KB  conda-forge
    pyyaml-6.0                 |  py311he2be06e_5         189 KB  conda-forge
    qca-2.3.5                  |       h70399c6_2         768 KB  conda-forge
    qgis-3.28.3                |  py311h1f0c9b3_1        64.5 MB  conda-forge
    qjson-0.9.0                |    hf490b44_1009          55 KB  conda-forge
    qscintilla2-2.13.4         |  py311he2d8cc6_0         1.2 MB  conda-forge
    qt-main-5.15.8             |       hfe8d25c_6        48.3 MB  conda-forge
    qtkeychain-0.13.2          |       hf490b44_2          32 KB  conda-forge
    qtwebkit-5.212             |       hbfb98c5_8         9.6 MB  conda-forge
    qwt-6.2.0                  |       hf490b44_5         3.4 MB  conda-forge
    requests-2.28.2            |     pyhd8ed1ab_0          55 KB  conda-forge
    setuptools-67.3.2          |     pyhd8ed1ab_0         565 KB  conda-forge
    sip-6.7.7                  |  py311ha397e9f_0         556 KB  conda-forge
    suitesparse-5.10.1         |       h7cd81ec_1         2.0 MB  conda-forge
    tbb-2021.7.0               |       hffc8910_1         116 KB  conda-forge
    tenacity-8.2.1             |     pyhd8ed1ab_0          22 KB  conda-forge
    tiledb-2.13.2              |       h9bd36d0_0         3.8 MB  conda-forge
    tzcode-2022g               |       h1a8c8d9_0          60 KB  conda-forge
    urllib3-1.26.14            |     pyhd8ed1ab_0         110 KB  conda-forge
    zstd-1.5.2                 |       hf913c23_6         301 KB  conda-forge
    ------------------------------------------------------------
                                           Total:       264.1 MB

In rosetta2 environment we have: qgis3_283_ros

## Package Plan ##

  environment location: /opt/homebrew/Caskroom/miniforge/base/envs/qgis3_283_ros

  added / updated specs:
    - qgis

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    ceres-solver-2.1.0         |       h636452b_1         1.3 MB  conda-forge
    cffi-1.15.1                |  py311ha86e640_3         274 KB  conda-forge
    coverage-7.1.0             |  py311h5547dcb_0         343 KB  conda-forge
    cryptography-39.0.1        |  py311h61927ef_0         1.1 MB  conda-forge
    curl-7.88.0                |       h6df9250_0         140 KB  conda-forge
    draco-1.5.6                |       hb8565cd_0         754 KB  conda-forge
    exiv2-0.27.6               |       h882e36a_1         951 KB  conda-forge
    fontconfig-2.14.2          |       h5bb23bf_0         232 KB  conda-forge
    gdal-3.6.2                 |  py311h619941e_7         1.5 MB  conda-forge
    geotiff-1.7.1              |       hd690177_6         113 KB  conda-forge
    gflags-2.2.2               |    hb1e8313_1004          92 KB  conda-forge
    glog-0.6.0                 |       h8ac2a54_0          98 KB  conda-forge
    gmp-6.2.1                  |       h2e338ed_0         774 KB  conda-forge
    gst-plugins-base-1.22.0    |       h37e1711_0         2.3 MB  conda-forge
    gstreamer-1.22.0           |       h1d18e73_0         1.7 MB  conda-forge
    hdf5-1.12.2                |nompi_h48135f9_101         3.0 MB  conda-forge
    jpeg-9e                    |       hb7f2c08_3         226 KB  conda-forge
    kealib-1.5.0               |       h5c1f988_0         138 KB  conda-forge
    krb5-1.20.1                |       h049b76e_0         1.1 MB  conda-forge
    laz-perf-3.3.0             |       hb8565cd_0         100 KB  conda-forge
    lcms2-2.14                 |       h29502cd_1         221 KB  conda-forge
    libaec-1.0.6               |       hf0c8a7f_1          29 KB  conda-forge
    libclang-13.0.1            |default_he082bbe_0         8.0 MB  conda-forge
    libcurl-7.88.0             |       h6df9250_0         335 KB  conda-forge
    libdeflate-1.17            |       hac1461d_0          66 KB  conda-forge
    libgdal-3.6.2              |       hc39f1fd_7         8.3 MB  conda-forge
    libgfortran-5.0.0          |11_3_0_h97931a8_27         143 KB  conda-forge
    libgfortran5-11.3.0        |      h082f757_27         1.4 MB  conda-forge
    libllvm13-13.0.1           |       h64f94b2_2        25.3 MB  conda-forge
    libnetcdf-4.9.1            |nompi_h5456b97_100         686 KB  conda-forge
    libnghttp2-1.51.0          |       he2ab024_0         594 KB  conda-forge
    libpq-15.2                 |       h3640bf0_0         2.2 MB  conda-forge
    libprotobuf-3.21.12        |       hbc0c0cd_0         1.8 MB  conda-forge
    libspatialite-5.0.1        |      hd6e941a_23         2.9 MB  conda-forge
    libssh2-1.10.0             |       h47af595_3         222 KB  conda-forge
    libtiff-4.5.0              |       hee9004a_2         383 KB  conda-forge
    libwebp-1.2.4              |       h70a068d_1          76 KB  conda-forge
    libzip-1.9.2               |       h6db710c_1         117 KB  conda-forge
    llvm-openmp-15.0.7         |       h61d9ccf_0         287 KB  conda-forge
    lz4-c-1.9.4                |       hf0c8a7f_0         153 KB  conda-forge
    markupsafe-2.1.2           |  py311h5547dcb_0          24 KB  conda-forge
    metis-5.1.0                |    h2e338ed_1006         4.1 MB  conda-forge
    mpfr-4.1.0                 |       h0f52abe_1         400 KB  conda-forge
    mysql-common-8.0.31        |       hc4b2c72_0         1.9 MB  conda-forge
    mysql-libs-8.0.31          |       h8658499_0         1.9 MB  conda-forge
    nitro-2.7.dev6             |       hf0c8a7f_5         528 KB  conda-forge
    nss-3.88                   |       h78b00b3_0         1.8 MB  conda-forge
    numpy-1.24.2               |  py311ha9d2c9f_0         7.2 MB  conda-forge
    openjpeg-2.5.0             |       h13ac156_2         322 KB  conda-forge
    pdal-2.5.1                 |       he374a05_1         3.0 MB  conda-forge
    poppler-23.01.0            |       h6e9091c_0         1.5 MB  conda-forge
    postgresql-15.2            |       hbea33b9_0         4.3 MB  conda-forge
    proj-9.1.1                 |       hf909084_2         2.5 MB  conda-forge
    psycopg2-2.9.3             |  py311h557c174_2         159 KB  conda-forge
    pyproj-3.4.1               |  py311hdc3c720_1         419 KB  conda-forge
    pyqt-5.15.7                |  py311h8771221_3         3.9 MB  conda-forge
    pyqt5-sip-12.11.0          |  py311h78fa98d_3          73 KB  conda-forge
    pyqtwebkit-5.15.9          |  py311heb9b8d8_1         122 KB  conda-forge
    python_abi-3.11            |          3_cp311           6 KB  conda-forge
    qca-2.3.5                  |       h0943339_2         791 KB  conda-forge
    qgis-3.28.3                |  py311h8deab50_1        68.0 MB  conda-forge
    qjson-0.9.0                |    h86624fb_1009          58 KB  conda-forge
    qscintilla2-2.13.4         |  py311h6f08df8_0         1.2 MB  conda-forge
    qt-main-5.15.8             |       h1d3b3f8_6        43.3 MB  conda-forge
    qtkeychain-0.13.2          |       hdb26607_2          32 KB  conda-forge
    qtwebkit-5.212             |       h11e631a_8        11.2 MB  conda-forge
    qwt-6.2.0                  |       h86624fb_5         3.4 MB  conda-forge
    sip-6.7.7                  |  py311h814d153_0         559 KB  conda-forge
    suitesparse-5.10.1         |       h7aff33d_1         2.5 MB  conda-forge
    tbb-2021.7.0               |       hb8565cd_1         152 KB  conda-forge
    tiledb-2.13.2              |       h8b9cbf0_0         4.4 MB  conda-forge
    zstd-1.5.2                 |       hbc0c0cd_6         399 KB  conda-forge
    ------------------------------------------------------------
                                           Total:       239.5 MB
SrNetoChan commented 1 year ago

I don't know enough of Mac system, but if you use an environment with roseta, then it is not using arm architecture. Right?

SrNetoChan commented 1 year ago

Apart from that error, have you noticed anything that does not work when running QGIS on arm?

ivn951 commented 1 year ago

Apart from that error, have you noticed anything that does not work when running QGIS on arm?

The qgis3_283_env environment created is arm, while the one named qgis3_283_ros is in rosetta. I have exposed both configurations.

ivn951 commented 1 year ago

Apart from that error, have you noticed anything that does not work when running QGIS on arm?

I am testing it, for now I had to remove some non-compatible plugins.

SrNetoChan commented 1 year ago

If possible, report which plugins and the errors here, so we can track down what can be the problem (s).

Thanks!

joaoponceleao commented 1 year ago

It seems the issue is taking place during python startup here: https://github.com/qgis/QGIS/blob/1a0936b6fcc1bba776dd1dc69f5e2cd9312f9e22/src/python/qgspythonutilsimpl.cpp#L228 Don't understand why though. I thought it was to do with osx ventura's security settings that require you to grant full disk access to applications, but according to @ivn951 the issue does not show up under rosetta.

ivn951 commented 1 year ago

I want to create a new clean environment and reinstall everything. I will update you.

ivn951 commented 1 year ago

I created a new environment and reinstalled QGIS 3.283. The error is reported again.

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

Python version: 3.11.0 | packaged by conda-forge | (main, Jan 14 2023, 12:29:41) [Clang 14.0.6 ]

QGIS version: 3.28.3-Firenze 'Firenze', exported

Python path: ['/opt/homebrew/Caskroom/miniforge/base/envs/qgis3_283_env/share/qgis/python', '/opt/homebrew/Caskroom/miniforge/base/envs/qgis3_283_env/share/qgis/python/plugins', '/opt/homebrew/Caskroom/miniforge/base/envs/qgis3_283_env/share/qgis/python/plugins', '/opt/homebrew/Caskroom/miniforge/base/envs/qgis3_283_env/share/qgis/python', '/Users/ivano', '/opt/homebrew/Caskroom/miniforge/base/envs/qgis3_283_env/lib/python311.zip', '/opt/homebrew/Caskroom/miniforge/base/envs/qgis3_283_env/lib/python3.11', '/opt/homebrew/Caskroom/miniforge/base/envs/qgis3_283_env/lib/python3.11/lib-dynload', '/opt/homebrew/Caskroom/miniforge/base/envs/qgis3_283_env/lib/python3.11/site-packages']

If you have any suggestions I will proceed with testing.

I confirm that in Rosetta environment, no error.

gillins commented 1 year ago

I confirm that in Rosetta environment, no error.

Interesting - thanks for running the tests. Is this something we need to report upstream?

joaoponceleao commented 1 year ago

Interesting - thanks for running the tests. Is this something we need to report upstream?

I doubt it, since it works in Rosetta. I would look at other gui applications installed through conda to see if they had to make any adjustments for arm. This error does not show up if you launch the QGIS binary inside the conda environment folder directly from the finder, for instance. But you get other issues since the conda env was not activated.

ivn951 commented 1 year ago

What I don't understand is that with Rosetta 2 the permissions required to access or write to the file specified as fault_handler_file are overridden or bypassed? Which in the ARM architecture is not possible?

joaoponceleao commented 1 year ago

Interesting - thanks for running the tests. Is this something we need to report upstream?

@gillins Maybe we should report this upstream. In the terminal the error (operation not permitted) occurs during faulthandler.enable(file=fault_handler_file), but the File object is "". There is an issue here with qgspythonutilsimpl.cpp, (https://github.com/qgis/QGIS/blob/ec43447292044d953a7854b0d40bdde446b1d449/src/python/qgspythonutilsimpl.cpp#L227). The default for faulthandler.enable is file=sys.stderr. I still don't understand why it would work in Rosetta.......

Btw. Faulthandler is enabled if you open up the python console after qgis starts.

gillins commented 1 year ago

But there is a check for !faultHandlerLogPath.isEmpty() above....

joaoponceleao commented 1 year ago

This is taking place on a ubuntu docker image running on the m1 too apparently. See: https://github.com/camptocamp/docker-qgis-server/issues/590

gillins commented 1 year ago

This seems a different error from above? Would be good to let the qgis maintainers know about what we are seeing, but without access to Apple Silicon I'm not sure what else we can do.

joaoponceleao commented 1 year ago

@gillins My laptop is Apple Silicon. Is there anything you'd like me check out?

gillins commented 1 year ago

Thanks @joaoponceleao. Would be good to print the values of faultHandlerLogPath and see what is going on that might be different from x86....

joaoponceleao commented 1 year ago

Sorry @gillins. I'm afraid that might be beyond my abilities. I'm used to debugging qgis plugins in the terminal, but not qgis itself (and would rather not have to build it from source).

On a, possibly related note(?), python uses an env variable for faulthandler (PYTHONFAULTHANDLER). Starting conda's arm qgis with that env set to anything, will cause a fatal error:

Fatal Python error: _PyFaulthandler_Init: failed to enable faulthandler Python runtime state: core initialized PermissionError: [Errno 1] Operation not permitted

Doing the same with the x86 oficial release (launching it from terminal) causes no errors.

gillins commented 1 year ago

I'm afraid I know very little about OSX so I guess we are stuck for now. Can you find anything about this behaviour changing in recent OSX versions?

nyalldawson commented 1 year ago

Next step would be to try running this in the qgis python console:

import faulthandler
_log = open('/some/path/which/is/definitely/writable.txt', 'wt')
faulthandler.enable(file=_log)

And see if the permission exception is raised. Also testing this in a standalone (non qgis) python session.

That will determine if the fault lies with qgis or conda/upstream python.

joaoponceleao commented 1 year ago

Thanks @nyalldawson No exceptions raised, and the log file is created. Tested on the python console of the official qgis binary, of conda qgis, and on the python of conda qgis env (these were installed with mamba if that makes any difference). What I haven't figured out is what log file, if any, Qgis is trying to create upon startup (the terminal does reference quite a few 'Warning: Broken filename passed to function' msgs just before the PermissionError shows up though).

SrNetoChan commented 1 year ago

Yes. It would be nice to know the exact folder it's trying to write. For some reason it works fine on mac normal builds. But not on arm. Maybe we could use a normal build to force an error and generate the report to understand where it should be by default?

joaoponceleao commented 1 year ago

Don't the nightly builds log more to the terminal? We could always add a nightly to conda whenever there is an issue.

SrNetoChan commented 1 year ago

We could create a branch with the debugging option enabled, even for the stable version. But we should check with the conda forge community if that is ok. Alternatively, we can build it locally in a testing machine enabling the debugging.

SrNetoChan commented 1 year ago

I will try the latter as soon as possible in a borrowed machine

nyalldawson commented 1 year ago

This is how the log file name is generated:

QStandardPaths.standardLocations( QStandardPaths.TempLocation )[0] + "/qgis-python-crash-info-" + str( QCoreApplication.applicationPid() )

What's that return in the qgis python console?

ocefpaf commented 1 year ago

But we should check with the conda forge community if that is ok.

Publishing debug packages, in a similar fashion we do dev packages, from a branch and publishing in a "qgis_debug" is OK. We never formalized that but it would be something similar to the cfep-05 instructions.

SrNetoChan commented 1 year ago

I have installed qgis 3.30 with with python 3.11 using a brand new mamba-forge installation on a Mac arm64. I was not able to reproduce the error.

Running the code suggested by @nyalldawson I got no errors either.

QStandardPaths.standardLocations( QStandardPaths.TempLocation )[0] + "/qgis-python-crash-info-" + str( QCoreApplication.applicationPid() )

joaoponceleao commented 1 year ago

@nyalldawson the return for QStandardPaths.standardLocations( QStandardPaths.TempLocation )[0] + "/qgis-python-crash-info-" + str( QCoreApplication.applicationPid() ) is '/private/var/folders/vc/y37_q_3159j58xbbds0pm8440000gn/T/qgis-python-crash-info-27652'

File exists, folder is writable. Official QGIS binary chooses the same folder to write to.

SrNetoChan commented 1 year ago

@joaoponceleao shouldn't make a difference, but what installer did you use? conda? Mamba? What version?

joaoponceleao commented 1 year ago

@SrNetoChan I was curious to find out if something was wrong with my conda, so I did a new installation. Issue persists with a fresh install. Mambaforge installed through homebrew. Environments are on a custom location $HOME/.conda-envs, instead of /opt/homebrew/Caskroom/mambaforge. Mamba info gives: Mamba 1.4.1 Conda 23.1.0 Python 3.10.10.final.0

Mamba qgis environment gives: QGIS 3.30.3 py311hecefc68_1 Python 3.11.4 h47c9636_0_cpython All packages from conda-forge

gillins commented 1 year ago

@SrNetoChan you've seen this error with an older version of QGIS on OSX arm64 right?

SrNetoChan commented 1 year ago

@gillins yes I did. So I am now wondering what changed in my installation. I will try miniconda instead of mamba-forge and I will try older versions of qgis.

My mamba-forge installation was not from homebrew, but using the follwing command:

curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh"
bash Mambaforge-$(uname)-$(uname -m).sh
joaoponceleao commented 1 year ago

@SrNetoChan that type of installation shouldn’t make a difference, but perhaps there is something going on in my zshrc. I’ll try with a minimal profile.

SrNetoChan commented 1 year ago

@SrNetoChan that type of installation shouldn’t make a difference, but perhaps there is something going on in my zshrc. I’ll try with a minimal profile. @joaoponceleao indeed, but since we can't find a solid replication, I am trying to find what could be different.

Please noticed that an recent contact of my from twitter also reported this error, and I not sure he has any very customized terminal.

antoniolocandro commented 1 year ago

@SrNetoChan Yes, I do not have a custom terminal in fact you can consider my install on clean MacBook Air m1 as until now I only used it to consume/stream videos mainly

Firefishy commented 11 months ago

This looks similar: https://github.com/qgis/QGIS/issues/52987 report says "this does only happens ~ half of the time when starting QGIS" which may imply some some sort of race condition?

Firefishy commented 11 months ago

I get the error on startup...

Some debugged via QGIS python console:

>>> print (qgis.utils.__qgis_fault_handler_file)
<_io.TextIOWrapper name='/private/var/folders/kv/sb*TRIM*gn/T/qgis-python-crash-info-48809' mode='wt' encoding='utf-8'>
>>> import faulthandler
>>> faulthandler.is_enabled()
True
Firefishy commented 11 months ago

Link: https://github.com/qgis/QGIS/issues/46299#issuecomment-1230472526

Firefishy commented 11 months ago

Patch to remove the ?faulty? faulthandler https://github.com/DingoBits/qgis-arm64-apple/blob/main/patches/qgis_disable_py_faulthandler.patch

SrNetoChan commented 11 months ago

That seems to simply remove the functionality. No? I wouldn't use it.

joaoponceleao commented 11 months ago

@SrNetoChan That repo does not use conda. It updates the homebrew build of the official binaries to arm64. If he did this, it would imply that it's not a conda issue but one of the dependencies no?