Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS: import from scipy fails and starts new QGIS instance #405

Open
1 task done
jakimowb opened this issue Feb 22, 2024 · 3 comments
Open
1 task done

macOS: import from scipy fails and starts new QGIS instance #405

jakimowb opened this issue Feb 22, 2024 · 3 comments
Labels

Comments

@jakimowb
Copy link
Contributor

Solution to issue cannot be found in the documentation.

  • I checked the documentation.

Issue

I create a new empty conda environment with QGIS and scipy as:

mamba create -n example
mamba activate example
conda config --add channels conda-forge
conda config --set channel_priority strict
mamba install qgis scipy

When I now start QGIS and from scipy.interpolate import interp1d from the python shell, (the first) QGIS gets stucked and starts a second QGIS instance.

First QGIS

The first QGIS instance does not respond anymore, until the second is closed:
image

It shows the following python shell stacktrace:

# Python Console
# Use iface to access QGIS API interface or type '?' for more info
# Security warning: typing commands from an untrusted source can harm your computer
from scipy.interpolate import interp1d
Traceback (most recent call last):
  File "/Users/jakimowb/miniforge3/envs/example/lib/python3.12/code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "/Users/jakimowb/miniforge3/envs/example/share/qgis/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jakimowb/miniforge3/envs/example/lib/python3.12/site-packages/scipy/__init__.py", line 67, in <module>
    from scipy._lib import _pep440
  File "/Users/jakimowb/miniforge3/envs/example/share/qgis/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jakimowb/miniforge3/envs/example/lib/python3.12/site-packages/scipy/_lib/__init__.py", line 12, in <module>
    from scipy._lib._testutils import PytestTester
  File "/Users/jakimowb/miniforge3/envs/example/share/qgis/python/qgis/utils.py", line 888, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jakimowb/miniforge3/envs/example/lib/python3.12/site-packages/scipy/_lib/_testutils.py", line 21, in <module>
    _tags = list(sys_tags())
            ^^^^^^^^^^^^^^^^
  File "/Users/jakimowb/miniforge3/envs/example/lib/python3.12/site-packages/packaging/tags.py", line 543, in sys_tags
    yield from cpython_tags(warn=warn)
  File "/Users/jakimowb/miniforge3/envs/example/lib/python3.12/site-packages/packaging/tags.py", line 212, in cpython_tags
    platforms = list(platforms or platform_tags())
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jakimowb/miniforge3/envs/example/lib/python3.12/site-packages/packaging/tags.py", line 412, in mac_platforms
    version = cast("MacVersion", tuple(map(int, version_str.split(".")[:2])))
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: ''

Second QGIS

The new QGIS instance shows several warnings & errors in the log panel. Users/jakimow is the current directory from which the 1st qgis instance was started from shell:

General Log:

2024-02-22T11:41:07     WARNING    Unable to load /Users/jakimowb/-sS
2024-02-22T11:41:07     WARNING    Unable to load /Users/jakimowb/-c
2024-02-22T11:41:07     WARNING    Unable to load /Users/jakimowb/import platform; print(platform.mac_ver()[0])

Messages Log:

2024-02-22T11:41:07     CRITICAL    Authentication System : DISABLED. Resources authenticating via the system can not be accessed
2024-02-22T11:41:07     CRITICAL    Invalid Data Source : /Users/jakimowb/-sS is not a valid or recognized data source.
2024-02-22T11:41:07     CRITICAL    Invalid Data Source : /Users/jakimowb/-c is not a valid or recognized data source.
2024-02-22T11:41:07     CRITICAL    Invalid Data Source : /Users/jakimowb/import platform; print(platform.mac_ver()[0]) is not a valid or recognized data source.

All plugins are disabled. Open the plugin manager fails with:
image

System tested on

macBook Pro, 2020
1,4 GHz Quad-Core Intel Core i5
macOS 14.3.1 Sonoma

QGIS version 3.34.3-Prizren QGIS code branch Release 3.34
Qt version 5.15.8
Python version 3.12.2
GDAL/OGR version 3.8.3
PROJ version 9.3.1
EPSG Registry database version v10.098 (2023-11-24)
GEOS version 3.12.1-CAPI-1.18.1
SQLite version 3.45.1
PDAL version 2.6.3
PostgreSQL client version unknown
SpatiaLite version 5.1.0
QWT version 6.2.0
QScintilla2 version 2.14.1
OS version macOS 10.16
       
Active Python plugins
processing 2.12.99
grassprovider 2.12.99
db_manager 0.1.20
MetaSearch 0.3.6

Installed packages

# packages in environment at /Users/jakimowb/miniforge3/envs/example:
#
# Name                    Version                   Build  Channel
azure-core-cpp            1.10.3               hbb1e571_1    conda-forge
azure-storage-blobs-cpp   12.10.0              he51d815_0    conda-forge
azure-storage-common-cpp  12.5.0               hf4badfb_2    conda-forge
blosc                     1.21.5               heccf04b_0    conda-forge
brotli-python             1.1.0           py312heafc425_1    conda-forge
bzip2                     1.0.8                h10d778d_5    conda-forge
c-ares                    1.26.0               h10d778d_0    conda-forge
ca-certificates           2024.2.2             h8857fd0_0    conda-forge
cairo                     1.18.0               h99e66fa_0    conda-forge
ceres-solver              2.2.0                haa0d064_2    conda-forge
certifi                   2024.2.2           pyhd8ed1ab_0    conda-forge
cfitsio                   4.3.1                h60fb419_0    conda-forge
charset-normalizer        3.3.2              pyhd8ed1ab_0    conda-forge
coverage                  7.4.2           py312h41838bb_0    conda-forge
curl                      8.5.0                h726d00d_0    conda-forge
draco                     1.5.7                h7728843_0    conda-forge
eigen                     3.4.0                h1c7c39f_0    conda-forge
exiv2                     0.28.2               h239cba9_0    conda-forge
expat                     2.5.0                hf0c8a7f_1    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                 h77eed37_1    conda-forge
fontconfig                2.14.2               h5bb23bf_0    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
freetype                  2.12.1               h60636b9_2    conda-forge
freexl                    2.0.0                h3ec172f_0    conda-forge
future                    0.18.3             pyhd8ed1ab_0    conda-forge
gdal                      3.8.3           py312h1be6df0_2    conda-forge
geos                      3.12.1               h93d8f39_0    conda-forge
geotiff                   1.7.1               h509af15_15    conda-forge
gettext                   0.21.1               h8a4c099_0    conda-forge
gflags                    2.2.2             hb1e8313_1004    conda-forge
giflib                    5.2.1                hb7f2c08_3    conda-forge
glib                      2.78.4               h2d185b6_0    conda-forge
glib-tools                2.78.4               h2d185b6_0    conda-forge
glog                      0.7.0                h31b1b29_0    conda-forge
gmp                       6.3.0                h93d8f39_0    conda-forge
gsl                       2.7                  h93259b0_0    conda-forge
gst-plugins-base          1.22.9               h3fb38fc_0    conda-forge
gstreamer                 1.22.9               hf63bbb8_0    conda-forge
hdf4                      4.2.15               h8138101_7    conda-forge
hdf5                      1.14.3          nompi_h691f4bf_100    conda-forge
httplib2                  0.22.0             pyhd8ed1ab_0    conda-forge
icu                       73.2                 hf5e326d_0    conda-forge
idna                      3.6                pyhd8ed1ab_0    conda-forge
jinja2                    3.1.3              pyhd8ed1ab_0    conda-forge
json-c                    0.17                 h8e11ae5_0    conda-forge
kealib                    1.5.3                h5f07ac3_0    conda-forge
khronos-opencl-icd-loader 2023.04.17           hb7f2c08_0    conda-forge
krb5                      1.21.2               hb884880_0    conda-forge
laz-perf                  3.4.0                h1c7c39f_0    conda-forge
lcms2                     2.16                 ha2f27b4_0    conda-forge
lerc                      4.0.0                hb486fe8_0    conda-forge
libabseil                 20230802.1      cxx17_h048a20a_0    conda-forge
libaec                    1.1.2                he965462_1    conda-forge
libarchive                3.7.2                hd35d340_1    conda-forge
libblas                   3.9.0           21_osx64_openblas    conda-forge
libboost-headers          1.84.0               h694c41f_1    conda-forge
libbrotlicommon           1.1.0                h0dc2134_1    conda-forge
libbrotlidec              1.1.0                h0dc2134_1    conda-forge
libbrotlienc              1.1.0                h0dc2134_1    conda-forge
libcblas                  3.9.0           21_osx64_openblas    conda-forge
libclang                  15.0.7          default_h6b1ee41_4    conda-forge
libclang13                15.0.7          default_h89cd682_4    conda-forge
libcrc32c                 1.1.2                he49afe7_0    conda-forge
libcurl                   8.5.0                h726d00d_0    conda-forge
libcxx                    16.0.6               hd57cbcb_0    conda-forge
libdeflate                1.19                 ha4e1b8e_0    conda-forge
libedit                   3.1.20191231         h0678c8f_2    conda-forge
libev                     4.33                 h10d778d_2    conda-forge
libexpat                  2.5.0                hf0c8a7f_1    conda-forge
libffi                    3.4.2                h0d85af4_5    conda-forge
libgdal                   3.8.3                hf248df1_2    conda-forge
libgfortran               5.0.0           13_2_0_h97931a8_3    conda-forge
libgfortran5              13.2.0               h2873a65_3    conda-forge
libglib                   2.78.4               hab64008_0    conda-forge
libgoogle-cloud           2.12.0               he77a663_5    conda-forge
libgrpc                   1.60.1               h038e8f1_0    conda-forge
libhwloc                  2.9.3           default_h24e0189_1009    conda-forge
libiconv                  1.17                 hd75f5a5_2    conda-forge
libjpeg-turbo             3.0.0                h0dc2134_1    conda-forge
libkml                    1.3.0             hab3ca0e_1018    conda-forge
liblapack                 3.9.0           21_osx64_openblas    conda-forge
libllvm15                 15.0.7               hbedff68_4    conda-forge
libnetcdf                 4.9.2           nompi_h7760872_113    conda-forge
libnghttp2                1.58.0               h64cf6d3_1    conda-forge
libogg                    1.3.4                h35c211d_1    conda-forge
libopenblas               0.3.26          openmp_hfef2a42_0    conda-forge
libopus                   1.3.1                hc929b4f_1    conda-forge
libpng                    1.6.42               h92b6c6a_0    conda-forge
libpq                     16.2                 ha925e61_0    conda-forge
libprotobuf               4.25.1               hc4f2305_2    conda-forge
libre2-11                 2023.06.02           h4694dbf_0    conda-forge
librttopo                 1.1.0               hf05f67e_15    conda-forge
libspatialindex           1.9.3                he49afe7_4    conda-forge
libspatialite             5.1.0                hebe6af1_4    conda-forge
libsqlite                 3.45.1               h92b6c6a_0    conda-forge
libssh2                   1.11.0               hd019ec5_0    conda-forge
libtasn1                  4.19.0               hb7f2c08_0    conda-forge
libtiff                   4.6.0                h684deea_2    conda-forge
libvorbis                 1.3.7                h046ec9c_0    conda-forge
libwebp                   1.3.2                h44782d1_1    conda-forge
libwebp-base              1.3.2                h0dc2134_0    conda-forge
libxml2                   2.12.5               hc0ae0f7_0    conda-forge
libxslt                   1.1.39               h03b04e6_0    conda-forge
libzip                    1.10.1               hc158999_3    conda-forge
libzlib                   1.2.13               h8a1eda9_5    conda-forge
llvm-openmp               17.0.6               hb6ac08f_0    conda-forge
lxml                      5.1.0           py312h799ce31_0    conda-forge
lz4-c                     1.9.4                hf0c8a7f_0    conda-forge
lzo                       2.10              haf1e3a3_1000    conda-forge
markupsafe                2.1.5           py312h41838bb_0    conda-forge
metis                     5.1.0             he965462_1007    conda-forge
minizip                   4.0.4                h37d7099_0    conda-forge
mock                      5.1.0              pyhd8ed1ab_0    conda-forge
mpfr                      4.2.1                h0c69b56_0    conda-forge
mysql-common              8.0.33               h1d20c9b_6    conda-forge
mysql-libs                8.0.33               hed35180_6    conda-forge
ncurses                   6.4                  h93d8f39_2    conda-forge
nitro                     2.7.dev8             he965462_0    conda-forge
nose2                     0.9.2                      py_0    conda-forge
nspr                      4.35                 hea0b92c_0    conda-forge
nss                       3.98                 ha05da47_0    conda-forge
numpy                     1.26.4          py312he3a82b2_0    conda-forge
openjpeg                  2.5.0                ha4da562_3    conda-forge
openssl                   3.2.1                hd75f5a5_0    conda-forge
owslib                    0.29.3             pyhd8ed1ab_0    conda-forge
packaging                 23.2               pyhd8ed1ab_0    conda-forge
pcre2                     10.42                h0ad2156_0    conda-forge
pdal                      2.6.3                h82f9e37_0    conda-forge
pip                       24.0               pyhd8ed1ab_0    conda-forge
pixman                    0.43.2               h73e2aa4_0    conda-forge
plotly                    5.19.0             pyhd8ed1ab_0    conda-forge
ply                       3.11                       py_1    conda-forge
poppler                   24.02.0              h0c752f9_0    conda-forge
poppler-data              0.4.12               hd8ed1ab_0    conda-forge
postgresql                16.2                 hbd19fd8_0    conda-forge
proj                      9.3.1                h81faed2_0    conda-forge
psycopg2                  2.9.9           py312hca9e88b_0    conda-forge
pygments                  2.17.2             pyhd8ed1ab_0    conda-forge
pyparsing                 3.1.1              pyhd8ed1ab_0    conda-forge
pyproj                    3.6.1           py312h14d93e9_5    conda-forge
pyqt                      5.15.9          py312hd74d816_5    conda-forge
pyqt5-sip                 12.12.2         py312he36337a_5    conda-forge
pyqtwebkit                5.15.9          py312h5ae8335_2    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.12.2          h9f0c242_0_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python_abi                3.12                    4_cp312    conda-forge
pytz                      2024.1             pyhd8ed1ab_0    conda-forge
pyyaml                    6.0.1           py312h104f124_1    conda-forge
qca                       2.3.8                h3036dd7_0    conda-forge
qgis                      3.34.3          py312h5fa82b5_2    conda-forge
qjson                     0.9.0             hed3eaa1_1009    conda-forge
qscintilla2               2.14.1          py312h12cbc42_0    conda-forge
qt-main                   5.15.8              h4385fff_19    conda-forge
qtkeychain                0.14.2               had6348c_0    conda-forge
qtwebkit                  5.212               h3b777d0_16    conda-forge
qwt                       6.2.0                hed3eaa1_6    conda-forge
re2                       2023.06.02           hd34609a_0    conda-forge
readline                  8.2                  h9e318b2_1    conda-forge
requests                  2.31.0             pyhd8ed1ab_0    conda-forge
scipy                     1.12.0          py312h8adb940_2    conda-forge
setuptools                69.1.0             pyhd8ed1ab_1    conda-forge
sip                       6.7.12          py312h444b7ae_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
snappy                    1.1.10               h225ccf5_0    conda-forge
sqlite                    3.45.1               h7461747_0    conda-forge
suitesparse               5.10.1               h4bf45ed_3    conda-forge
tbb                       2021.11.0            h7728843_1    conda-forge
tenacity                  8.2.3              pyhd8ed1ab_0    conda-forge
tiledb                    2.19.1               h8fd0293_0    conda-forge
tk                        8.6.13               h1abcd95_1    conda-forge
toml                      0.10.2             pyhd8ed1ab_0    conda-forge
tomli                     2.0.1              pyhd8ed1ab_0    conda-forge
tzcode                    2024a                h10d778d_0    conda-forge
tzdata                    2024a                h0c530f3_0    conda-forge
uriparser                 0.9.7                hf0c8a7f_1    conda-forge
urllib3                   2.2.1              pyhd8ed1ab_0    conda-forge
wheel                     0.42.0             pyhd8ed1ab_0    conda-forge
xerces-c                  3.2.5                hbbe9ea5_0    conda-forge
xz                        5.2.6                h775f41a_0    conda-forge
yaml                      0.2.5                h0d85af4_2    conda-forge
zlib                      1.2.13               h8a1eda9_5    conda-forge
zstd                      1.5.5                h829000d_0    conda-forge

Environment info

active environment : example
    active env location : /Users/jakimowb/miniforge3/envs/example
            shell level : 1
       user config file : /Users/jakimowb/.condarc
 populated config files : /Users/jakimowb/.condarc
          conda version : 23.11.0
    conda-build version : not installed
         python version : 3.10.13.final.0
                 solver : libmamba (default)
       virtual packages : __archspec=1=skylake
                          __conda=23.11.0=0
                          __osx=14.3.1=0
                          __unix=0=0
       base environment : /Users/jakimowb/miniforge3  (writable)
      conda av data dir : /Users/jakimowb/miniforge3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/jakimowb/miniforge3/pkgs
                          /Users/jakimowb/.conda/pkgs
       envs directories : /Users/jakimowb/miniforge3/envs
                          /Users/jakimowb/.conda/envs
               platform : osx-64
             user-agent : conda/23.11.0 requests/2.31.0 CPython/3.10.13 Darwin/23.3.0 OSX/14.3.1 solver/libmamba conda-libmamba-solver/23.12.0 libmambapy/1.5.5
                UID:GID : 501:20
             netrc file : None
           offline mode : False
@gillins
Copy link
Contributor

gillins commented Feb 23, 2024

Weird. Fine under Linux, unfortunately I don't have OSX to test. Any ideas?

@jakimowb
Copy link
Contributor Author

It might be caused by changes that were introduced with scipy 1.12.

As a workaround I use conda install "scipy<1.12"

@gillins
Copy link
Contributor

gillins commented Feb 26, 2024

Might be worth raising an issue with scipy-feedstock...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants