Topics

pyaudio error.


CYBER मावळा
 

Hello

I am trying to build plugin using template and scons as mentioned in the documentation.

My folder structure is as follows:

addon

  globalPlugins

               modules

                   pyaudio

                       pyaudio.py

                       __portaudio.pyd

   plugin.py

 

plugin.py is the main file where I am writing nvda scripts

I am importing the pyaudio in my plugin.py but it is not working

log is:

   from pyaudio import pyaudio

  File "C:\Users\sharangk\AppData\Roaming\nvda\addons\demo\globalPlugins\modules\pyaudio\pyaudio.py", line 116, in <module>

    import _portaudio as pa

ModuleNotFoundError: No module named '_portaudio'

 

 

My buildVars.py is as follows

 

 

def _(arg):

               return arg

 

 

addon_info = {

               "addon_summary": _("demo"),

               "addon_description": _("""demo"""),

               "addon_version": "1.5",

               # Author(s)

               "addon_author": "name <name@...>",

               # URL for the add-on documentation support

               "addon_url": None,

               # Documentation file name

               "addon_docFileName": "readme.html",

               # Minimum NVDA version supported (e.g. "2018.3.0", minor version is optional)

               "addon_minimumNVDAVersion": '2019.3',

               # Last NVDA version supported/tested (e.g. "2018.4.0", ideally more recent than minimum version)

               "addon_lastTestedNVDAVersion": '2019.3',

               # Add-on update channel (default is None, denoting stable releases,

               # and for development releases, use "dev".)

               # Do not change unless you know what you are doing!

               "addon_updateChannel": None,

}

 

pythonSources = ["addon/globalPlugins/*.py","addon/globalPlugins/modules/package/*.py","addon/globalPlugins/modules/pyaudio/*.py","addon/globalPlugins/modules/*.py","addon/globalPlugins/modules/pyaudio/*.pyd"]

 

# Files that contain strings for translation. Usually your python sources

i18nSources = pythonSources + ["buildVars.py"]

 

excludedFiles = ['']

 

 

I know I am putting .pyd  file in python sources, is it right?

Please suggest me how to build this to work all correctly.

Also scons giving warning

scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly

is it affecting the build?

 

Please help me.

Thanks and regards.

 

 

 

 

 

 

    

 


Marlon Brandão de Sousa
 

Hi,


NVDA installations are not aware of modules installed on your computer as a developer.


When you run NVDA (but if you are running it from sources, which most part of your users won't), the python used by NVDA is self packaged. The whole packages you install via pip or whatever you make to your python installation will not be available for NVDA to use.


If you think about it, this makes perfect sense, as NVDA users won't be installing python, managing packages or doing all the technical things they shouldn't even know about only to use NVDA.


Thus, it is your responsibility as an addon developer to package all your dependencies in your addon, because remember that no external dependencies will be available for it to use (but the external dependencies that NVDA itself uses and have been thus packaged by itself and that you can use).


What does it mean?


It means that you will have to figure out the files your addon depends on and put them on a folder your addon can access and  import them as if they were written by you as regular addon files.


A good place for you to start with is downloading the sources of the packages you want to use and taking a look at them and also figuring out where pip installs packages and take a look at the installed package, copy stuff from there and past it in a folder inside your addon, but be aware that this might be harder than it can seem at first because there might be dependencies the package you are using also have on other packages that, should them not be used by NVDA itself, will also need to be packaged by you.



This would probably deserve an entry on addon development guide, because it is not often obvious for beginners that developing and packaging are two very different things and that addons do not have access to any sort of packages that they didn't provide.


On 22/10/2020 06:19, CYBER मावळा wrote:

Hello

I am trying to build plugin using template and scons as mentioned in the documentation.

My folder structure is as follows:

addon

  globalPlugins

               modules

                   pyaudio

                       pyaudio.py

                       __portaudio.pyd

   plugin.py

 

plugin.py is the main file where I am writing nvda scripts

I am importing the pyaudio in my plugin.py but it is not working

log is:

   from pyaudio import pyaudio

  File "C:\Users\sharangk\AppData\Roaming\nvda\addons\demo\globalPlugins\modules\pyaudio\pyaudio.py", line 116, in <module>

    import _portaudio as pa

ModuleNotFoundError: No module named '_portaudio'

 

 

My buildVars.py is as follows

 

 

def _(arg):

               return arg

 

 

addon_info = {

               "addon_summary": _("demo"),

               "addon_description": _("""demo"""),

               "addon_version": "1.5",

               # Author(s)

               "addon_author": "name <name@...>",

               # URL for the add-on documentation support

               "addon_url": None,

               # Documentation file name

               "addon_docFileName": "readme.html",

               # Minimum NVDA version supported (e.g. "2018.3.0", minor version is optional)

               "addon_minimumNVDAVersion": '2019.3',

               # Last NVDA version supported/tested (e.g. "2018.4.0", ideally more recent than minimum version)

               "addon_lastTestedNVDAVersion": '2019.3',

               # Add-on update channel (default is None, denoting stable releases,

               # and for development releases, use "dev".)

               # Do not change unless you know what you are doing!

               "addon_updateChannel": None,

}

 

pythonSources = ["addon/globalPlugins/*.py","addon/globalPlugins/modules/package/*.py","addon/globalPlugins/modules/pyaudio/*.py","addon/globalPlugins/modules/*.py","addon/globalPlugins/modules/pyaudio/*.pyd"]

 

# Files that contain strings for translation. Usually your python sources

i18nSources = pythonSources + ["buildVars.py"]

 

excludedFiles = ['']

 

 

I know I am putting .pyd  file in python sources, is it right?

Please suggest me how to build this to work all correctly.

Also scons giving warning

scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly

is it affecting the build?

 

Please help me.

Thanks and regards.

 

 

 

 

 

 

    

 


Marlon Brandão de Sousa
 

On a side note, I see here a good opportunity for addon template if you could, for example, place an external_packages array somewhere on the scons file and have the build system to download and package this files automatically to the addon bundle.


a pre installed filter should be applied to not repackage things that are known to be packaged by NVDA. This would make lives of addon developers who need to use external pip packages easier. Sure, it wouldn't solve all the problems, compiled dependencies being on of them, but it would make things snappier in general.


On 22/10/2020 07:41, Marlon Brandão de Sousa via groups.io wrote:

Hi,


NVDA installations are not aware of modules installed on your computer as a developer.


When you run NVDA (but if you are running it from sources, which most part of your users won't), the python used by NVDA is self packaged. The whole packages you install via pip or whatever you make to your python installation will not be available for NVDA to use.


If you think about it, this makes perfect sense, as NVDA users won't be installing python, managing packages or doing all the technical things they shouldn't even know about only to use NVDA.


Thus, it is your responsibility as an addon developer to package all your dependencies in your addon, because remember that no external dependencies will be available for it to use (but the external dependencies that NVDA itself uses and have been thus packaged by itself and that you can use).


What does it mean?


It means that you will have to figure out the files your addon depends on and put them on a folder your addon can access and  import them as if they were written by you as regular addon files.


A good place for you to start with is downloading the sources of the packages you want to use and taking a look at them and also figuring out where pip installs packages and take a look at the installed package, copy stuff from there and past it in a folder inside your addon, but be aware that this might be harder than it can seem at first because there might be dependencies the package you are using also have on other packages that, should them not be used by NVDA itself, will also need to be packaged by you.



This would probably deserve an entry on addon development guide, because it is not often obvious for beginners that developing and packaging are two very different things and that addons do not have access to any sort of packages that they didn't provide.


On 22/10/2020 06:19, CYBER मावळा wrote:

Hello

I am trying to build plugin using template and scons as mentioned in the documentation.

My folder structure is as follows:

addon

  globalPlugins

               modules

                   pyaudio

                       pyaudio.py

                       __portaudio.pyd

   plugin.py

 

plugin.py is the main file where I am writing nvda scripts

I am importing the pyaudio in my plugin.py but it is not working

log is:

   from pyaudio import pyaudio

  File "C:\Users\sharangk\AppData\Roaming\nvda\addons\demo\globalPlugins\modules\pyaudio\pyaudio.py", line 116, in <module>

    import _portaudio as pa

ModuleNotFoundError: No module named '_portaudio'

 

 

My buildVars.py is as follows

 

 

def _(arg):

               return arg

 

 

addon_info = {

               "addon_summary": _("demo"),

               "addon_description": _("""demo"""),

               "addon_version": "1.5",

               # Author(s)

               "addon_author": "name <name@...>",

               # URL for the add-on documentation support

               "addon_url": None,

               # Documentation file name

               "addon_docFileName": "readme.html",

               # Minimum NVDA version supported (e.g. "2018.3.0", minor version is optional)

               "addon_minimumNVDAVersion": '2019.3',

               # Last NVDA version supported/tested (e.g. "2018.4.0", ideally more recent than minimum version)

               "addon_lastTestedNVDAVersion": '2019.3',

               # Add-on update channel (default is None, denoting stable releases,

               # and for development releases, use "dev".)

               # Do not change unless you know what you are doing!

               "addon_updateChannel": None,

}

 

pythonSources = ["addon/globalPlugins/*.py","addon/globalPlugins/modules/package/*.py","addon/globalPlugins/modules/pyaudio/*.py","addon/globalPlugins/modules/*.py","addon/globalPlugins/modules/pyaudio/*.pyd"]

 

# Files that contain strings for translation. Usually your python sources

i18nSources = pythonSources + ["buildVars.py"]

 

excludedFiles = ['']

 

 

I know I am putting .pyd  file in python sources, is it right?

Please suggest me how to build this to work all correctly.

Also scons giving warning

scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly

is it affecting the build?

 

Please help me.

Thanks and regards.

 

 

 

 

 

 

    

 


 

Hi,

I may need to put an FAQ entry on that for 2020.4 edition.

Cheers,

Joseph

 

From: nvda-devel@groups.io <nvda-devel@groups.io> On Behalf Of Marlon Brandão de Sousa
Sent: Thursday, October 22, 2020 3:42 AM
To: nvda-devel@groups.io
Subject: Re: [nvda-devel] pyaudio error.

 

Hi,

 

NVDA installations are not aware of modules installed on your computer as a developer.

 

When you run NVDA (but if you are running it from sources, which most part of your users won't), the python used by NVDA is self packaged. The whole packages you install via pip or whatever you make to your python installation will not be available for NVDA to use.

 

If you think about it, this makes perfect sense, as NVDA users won't be installing python, managing packages or doing all the technical things they shouldn't even know about only to use NVDA.

 

Thus, it is your responsibility as an addon developer to package all your dependencies in your addon, because remember that no external dependencies will be available for it to use (but the external dependencies that NVDA itself uses and have been thus packaged by itself and that you can use).

 

What does it mean?

 

It means that you will have to figure out the files your addon depends on and put them on a folder your addon can access and  import them as if they were written by you as regular addon files.

 

A good place for you to start with is downloading the sources of the packages you want to use and taking a look at them and also figuring out where pip installs packages and take a look at the installed package, copy stuff from there and past it in a folder inside your addon, but be aware that this might be harder than it can seem at first because there might be dependencies the package you are using also have on other packages that, should them not be used by NVDA itself, will also need to be packaged by you.

 

 

This would probably deserve an entry on addon development guide, because it is not often obvious for beginners that developing and packaging are two very different things and that addons do not have access to any sort of packages that they didn't provide.

 

On 22/10/2020 06:19, CYBER मावळा wrote:

Hello

I am trying to build plugin using template and scons as mentioned in the documentation.

My folder structure is as follows:

addon

  globalPlugins

               modules

                   pyaudio

                       pyaudio.py

                       __portaudio.pyd

   plugin.py

 

plugin.py is the main file where I am writing nvda scripts

I am importing the pyaudio in my plugin.py but it is not working

log is:

   from pyaudio import pyaudio

  File "C:\Users\sharangk\AppData\Roaming\nvda\addons\demo\globalPlugins\modules\pyaudio\pyaudio.py", line 116, in <module>

    import _portaudio as pa

ModuleNotFoundError: No module named '_portaudio'

 

 

My buildVars.py is as follows

 

 

def _(arg):

               return arg

 

 

addon_info = {

               "addon_summary": _("demo"),

               "addon_description": _("""demo"""),

               "addon_version": "1.5",

               # Author(s)

               "addon_author": "name <name@...>",

               # URL for the add-on documentation support

               "addon_url": None,

               # Documentation file name

               "addon_docFileName": "readme.html",

               # Minimum NVDA version supported (e.g. "2018.3.0", minor version is optional)

               "addon_minimumNVDAVersion": '2019.3',

               # Last NVDA version supported/tested (e.g. "2018.4.0", ideally more recent than minimum version)

               "addon_lastTestedNVDAVersion": '2019.3',

               # Add-on update channel (default is None, denoting stable releases,

               # and for development releases, use "dev".)

               # Do not change unless you know what you are doing!

               "addon_updateChannel": None,

}

 

pythonSources = ["addon/globalPlugins/*.py","addon/globalPlugins/modules/package/*.py","addon/globalPlugins/modules/pyaudio/*.py","addon/globalPlugins/modules/*.py","addon/globalPlugins/modules/pyaudio/*.pyd"]

 

# Files that contain strings for translation. Usually your python sources

i18nSources = pythonSources + ["buildVars.py"]

 

excludedFiles = ['']

 

 

I know I am putting .pyd  file in python sources, is it right?

Please suggest me how to build this to work all correctly.

Also scons giving warning

scons: warning: No version of Visual Studio compiler found - C/C++ compilers most likely not set correctly

is it affecting the build?

 

Please help me.

Thanks and regards.