matplotlib / basemap

Plot on map projections (with coastlines and political boundaries) using matplotlib
MIT License
772 stars 390 forks source link

Basemap install fails after python upgrade #590

Closed goku-son closed 6 months ago

goku-son commented 9 months ago

Running Python 3.12.0 on linux container.

After a upgrade of the container, basemap fails to install with the following errors:

`Collecting basemap Using cached basemap-1.3.8.zip (156 kB) Installing build dependencies ... error error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully. │ exit code: 1 ╰─> [66 lines of output] Ignoring numpy: markers 'python_version == "3.10"' don't match your environment Ignoring numpy: markers 'sys_platform == "darwin" and (python_version >= "3.7" and python_version <= "3.9")' don't match your environment Ignoring numpy: markers 'sys_platform != "darwin" and (python_version >= "3.7" and python_version <= "3.9")' don't match your environment Ignoring numpy: markers 'python_version == "2.7" or (python_version >= "3.4" and python_version <= "3.6")' don't match your environment Ignoring numpy: markers 'python_version == "2.6" or (python_version >= "3.2" and python_version <= "3.3")' don't match your environment Ignoring cython: markers 'python_version == "3.2"' don't match your environment Collecting setuptools Obtaining dependency information for setuptools from https://files.pythonhosted.org/packages/bb/26/7945080113158354380a12ce26873dd6c1ebd88d47f5bc24e2c5bb38c16a/setuptools-68.2.2-py3-none-any.whl.metadata Using cached setuptools-68.2.2-py3-none-any.whl.metadata (6.3 kB) Collecting wheel Obtaining dependency information for wheel from https://files.pythonhosted.org/packages/b8/8b/31273bf66016be6ad22bb7345c37ff350276cfd46e389a0c2ac5da9d9073/wheel-0.41.2-py3-none-any.whl.metadata Using cached wheel-0.41.2-py3-none-any.whl.metadata (2.2 kB) Collecting numpy==1.23.3 Using cached numpy-1.23.3.tar.gz (10.7 MB) Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'error' error: subprocess-exited-with-error

    × Getting requirements to build wheel did not run successfully.
    │ exit code: 1
    ╰─> [33 lines of output]
        Traceback (most recent call last):
          File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
            main()
          File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
            json_out['return_val'] = hook(**hook_input['kwargs'])
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 112, in get_requires_for_build_wheel
            backend = _build_backend()
                      ^^^^^^^^^^^^^^^^
          File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 77, in _build_backend
            obj = import_module(mod_path)
                  ^^^^^^^^^^^^^^^^^^^^^^^
          File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
            return _bootstrap._gcd_import(name[level:], package, level)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
          File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
          File "<frozen importlib._bootstrap>", line 1304, in _find_and_load_unlocked
          File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
          File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
          File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
          File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
          File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
          File "<frozen importlib._bootstrap_external>", line 994, in exec_module
          File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
          File "/tmp/pip-build-env-x6sxumhk/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 16, in <module>
            import setuptools.version
          File "/tmp/pip-build-env-x6sxumhk/overlay/lib/python3.12/site-packages/setuptools/version.py", line 1, in <module>
            import pkg_resources
          File "/tmp/pip-build-env-x6sxumhk/overlay/lib/python3.12/site-packages/pkg_resources/__init__.py", line 2172, in <module>
            register_finder(pkgutil.ImpImporter, find_on_path)
                            ^^^^^^^^^^^^^^^^^^^
        AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
        [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> See above for output. `

The strange thing is that numpy is already installed and at version 1.26.0. Any suggestions on what the issue is would be appreciated.

molinav commented 9 months ago

Hi @goku-son! Python 3.12 is still not supported, normally I go a couple of weeks behind the official Python release until I get some time to update everything. Especially, basemap was still using distutils in some places, but distutils is not available anymore in Python 3.12, so even if you manage to build from source, it will fail at runtime.

Sorry! When I get some free time, I will prepare everything for Python 3.12.

goku-son commented 9 months ago

That is more than fair. Thanks for the response and the insight @molinav!

molinav commented 6 months ago

The support for Python 3.12 is now part of the develop branch, and it will be available with the basemap release 1.4.0, which should take place in one or two days at maximum.

molinav commented 6 months ago

The basemap 1.4.0 wheels for Python 3.12 on Windows and GNU/Linux are already available in PyPI. Wheels for MacOS and the conda-forge packages will come in the following hours.