cartertemm / AI-content-describer

NVDA add-on that provides descriptions for controls and images, powered by GPT4
GNU General Public License v2.0
48 stars 24 forks source link

NVDA 2024.1/Python 3.11 compatibility #6

Closed josephsl closed 7 months ago

josephsl commented 12 months ago

Hi Carter,

I'm sure you might be thinking about this, but just in case we want to keep it here:

AI Content Describer is incompatible with NVDA 2024.1/Python 3.11 as Pillow 9.3.0 pyd files are for Python 3.7. Thankfully, Pillow 9.3.0 is available for Python 3.11, so it is a matter of bringing py311 pyd files to the ad-on repo.

Thanks.

cartertemm commented 12 months ago

Am I correct in assuming that we can simply copy the PYD files:

to the PIL folder to make it compatable with NVDA 2024.1 and keep support for older versions? Asking as I'm currently working on a travel computer and don't have the infrastructure to run from source. If so, I'm happy to add those and update the manifest accordingly.

josephsl commented 12 months ago

Hi, yes – given that .py files do not change across Python releases, we can simply drop in py311 pyd files. Once you update the manifest, I advise using a dedicated dev channel to post 2024.1 compatible test version as NVDA API is not frozen yet. Thanks, and keep up the good work.

josephsl commented 12 months ago

Hi, one more thing: be sure to test the add-on with 2024.1 alpha to make sure regressions due to wxPython 4.2.1 are not found. Thanks.

mzanm commented 7 months ago

Hello. I'm running NVDA 2024.1 RC 1, AI Content Describer Main commit 39374a5, latest of the posting of this comment, and at NVDA startup I'm getting this error


"WARNING - stdout (04:47:06.442) - Thread-3 (threaded_imports) (9580):
OpenCV bindings requires "numpy" package.
WARNING - stdout (04:47:06.442) - Thread-3 (threaded_imports) (9580):
Install it via command:
WARNING - stdout (04:47:06.442) - Thread-3 (threaded_imports) (9580):
    pip install numpy
ERROR - logHandler._threadExceptHook (04:47:06.442) - Thread-3 (threaded_imports) (9580):
Exception in thread Thread-3 (threaded_imports):
Traceback (most recent call last):
  File "C:\Users\mazen\AppData\Roaming\nvda\addons\AIContentDescriber\globalPlugins\AIContentDescriber\numpy\core\__init__.py", line 22, in <module>
    from . import multiarray
  File "C:\Users\mazen\AppData\Roaming\nvda\addons\AIContentDescriber\globalPlugins\AIContentDescriber\numpy\core\multiarray.py", line 12, in <module>
    from . import overrides
  File "C:\Users\mazen\AppData\Roaming\nvda\addons\AIContentDescriber\globalPlugins\AIContentDescriber\numpy\core\overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "threading.pyc", line 1045, in _bootstrap_inner
  File "threading.pyc", line 982, in run
  File "C:\Users\mazen\AppData\Roaming\nvda\addons\AIContentDescriber\globalPlugins\AIContentDescriber\__init__.py", line 61, in threaded_imports
    import cv2
  File "C:\Users\mazen\AppData\Roaming\nvda\addons\AIContentDescriber\globalPlugins\AIContentDescriber\cv2\__init__.py", line 11, in <module>
    import numpy
  File "C:\Users\mazen\AppData\Roaming\nvda\addons\AIContentDescriber\globalPlugins\AIContentDescriber\numpy\__init__.py", line 150, in <module>
    from . import core
  File "C:\Users\mazen\AppData\Roaming\nvda\addons\AIContentDescriber\globalPlugins\AIContentDescriber\numpy\core\__init__.py", line 48, in <module>
    raise ImportError(msg)
ImportError: 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.11 from "C:\Program Files (x86)\NVDA\nvda.exe"
  * The NumPy version is: "1.21.6"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: No module named 'numpy.core._multiarray_umath'
"

It used to work before CV2, even on the beta. I think the error is being caused by the included Numpy for 3.11. Describing navigator object etc works without issue however.

cartertemm commented 7 months ago

I think we may need to distribute separate versions of the dependencies based on the version of python in use. Otherwise the addon package will become unnecessarily large (thanks a lot to CV2 and NumPy).

cartertemm commented 7 months ago

Version 2024.04.14 fixes this issue with the dependency downloader. Any issues with the feature can be opened in separate tickets. Closing as complete.