mbari-org / vars-gridview

VARS GridView is a tool for reviewing and correcting VARS localizations in bulk.
MIT License
1 stars 0 forks source link

`pip install vars-gridview` fails with python 3.12 #77

Open hohonuuli opened 2 weeks ago

hohonuuli commented 2 weeks ago

The pip install fails with Python 3.12 due to the removal of the long-deprecated pkgutil.ImpImporter class. Note that this is a pip issue and is not specific to vars-gridview. I found some notes here but the proposed workarounds did not fix the issue. Downgrading to 3.11 worked fine.

Steps to reproduce:

conda create -n vars-gridview python=3.12
conda activate vars-gridview
pip install vars-gridview

Output

Collecting vars-gridview
  Downloading vars_gridview-0.12.1-py3-none-any.whl.metadata (2.5 kB)
Collecting beholder-client<0.2.0,>=0.1.0 (from vars-gridview)
  Downloading beholder_client-0.1.0-py3-none-any.whl.metadata (1.5 kB)
Collecting dreamsim<0.2.0,>=0.1.3 (from vars-gridview)
  Downloading dreamsim-0.1.3-py3-none-any.whl.metadata (7.5 kB)
Collecting opencv-python<5.0.0.0,>=4.5.5.62 (from vars-gridview)
  Downloading opencv-python-4.10.0.82.tar.gz (95.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 95.1/95.1 MB 35.9 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... 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 "/opt/miniconda3/envs/vars-gridview/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/opt/miniconda3/envs/vars-gridview/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 "/opt/miniconda3/envs/vars-gridview/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 "/opt/miniconda3/envs/vars-gridview/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 "/opt/miniconda3/envs/vars-gridview/lib/python3.12/importlib/__init__.py", line 90, in import_module
          return _bootstrap._gcd_import(name[level:], package, level)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
        File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
        File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
        File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
        File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
        File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
        File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
        File "<frozen importlib._bootstrap_external>", line 995, in exec_module
        File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
        File "/private/var/folders/zn/j87g9m_s1jz2gnm_g0r_s53h0000gn/T/pip-build-env-nl1z61jp/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 16, in <module>
          import setuptools.version
        File "/private/var/folders/zn/j87g9m_s1jz2gnm_g0r_s53h0000gn/T/pip-build-env-nl1z61jp/overlay/lib/python3.12/site-packages/setuptools/version.py", line 1, in <module>
          import pkg_resources
        File "/private/var/folders/zn/j87g9m_s1jz2gnm_g0r_s53h0000gn/T/pip-build-env-nl1z61jp/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.

note: This error originates from a subprocess, and is likely not a problem with pip.
kevinsbarnard commented 2 weeks ago

This seems to be an issue with the build of opencv-python on Apple Silicon. I followed the steps you provided on my machine (Linux 6.5.0-35-generic with conda 24.5.0) without issue.

Is there a possibility to use the bundled application? I haven't built one for the latest version (v0.12.1) but I can get on that... but it may be worth trying an earlier version (e.g. v0.11.0) to test as the VL has had success with this approach.

hohonuuli commented 2 weeks ago

I was able to get it to build on python 3.11, but I can try the v0.11.0 on OSU's hardware too. The catch is that they are running on postgres.