dictation-toolbox / natlink

Natlink provides the interface between Dragon and python
Other
25 stars 17 forks source link

Python 3.11 #151

Closed GregoryShields closed 2 months ago

GregoryShields commented 1 year ago

The pre-release version, NATLINK_5_4_4, states: "Added initial Python 3.11 support"

What does this mean? If 3.11 is supported, how then do I make that work?

The reason I ask this question is that the installer automatically installs NatLink Core into my Python version 3.10 installation and I see no option for pointing it to my version 3.11 installation.

LexiconCode commented 1 year ago

@GregoryShields greetings, the reason it says initial support is it's pretty much untested outside of simply loading. There's a distinction between what's released and what supported via compiling. I should have made that clear in the release notes.

As for your issue. When natlink is compiled to a specific python version. Only one that's released is for a python 3.10.x. That's why it only installs on 3.10 not 3.11.

So if there's support for other Python version, why don't we release more compiled in for those versions?

For now, we're sticking with 3.10

As for older versions or 3.11

Eventually we will release a 3.11 installer but some things need to happen at first.

If you would like, it's possible to compile the installer to any supported python version such as 3.11. Vou would use VS code. I can post a few extra details related to this a little later.

GregoryShields commented 1 year ago

Thanks, @LexiconCode.

Ah, so the key word being "initial" support. I just happened to have seen some videos extolling version 3.11 for its tremendous performance improvements. I'm not in a hurry though. More like just trying to get a handle on where you guys are with things.

While I've got your attention here, perhaps I could ask you another simple question or two or twenty, rather than opening another issue. Picking your brain would really help to save me from a lot of fumbling around, and I'll be putting what you tell me into my personal wiki so that I won't have to ever ask these questions again. And who knows? Maybe at some point in time my notes can be used to generate documentation for the benefit of others who may come along in the future.

If I'm recalling correctly, it's best to install NatLink Core first because the NatLink installer looks for the Core installation; is that correct? If I'm totally misremembering, please forgive me.

Also, when I installed NatLink, I noticed that the directory where I installed it had only Python stuff and an uninstaller, no DLLs. I have not dug into the NatLink internals much, but I'm gathering that there must be a DLL somewhere that makes the COM calls into NatSpeak. Is my thinking correct on this?

Further, in that NatLink installation directory under the "dist" directory is a Python wheel. At first I installed it, mistakenly believing it to be NatLink Core, but then when I inspected the "site-packages" directory for 32-bit Python, I noticed that what got installed were two directories named "natlink" and "natlink-5.4.4.dist-info". Whereas, it seems that the NatLink installer actually installs NatLink Core for you now, and the names of the NatLink Core directories under the "site-packages" directory are "natlinkcore" and "natlinkcore-5.3.5.dist-info".

In the end, it seemed to me that the wheel found under the "dist" subdirectory of the NatLink installation directory doesn't really need to be installed, as I never installed anything like that in the past. Am I correct, or should I actually manually install that wheel under the "dist" subdirectory in the NatLink installation directory?

Addendum: Upon further inspection, I've noticed that there is a subdirectory underneath the NatLink installation directory called "site-packages", and the files it contains are exactly the same files that get installed by the wheel under the "dist" subdirectory of the NatLink installation directory. Therefore, I'm assuming that indeed it is not necessary to install the wheel under NatLink\dist because the files under NatLink\site-packages are somehow being referenced, even though they are not physically located under Python's own site-packages directory. Am I beginning to get a clue?

Finally, according to the NatLink Core README, even though NatLink installs NatLink Core, if one is at home working on development of NatLink Core, it then becomes necessary to uninstall the version of NatLink Core installed by the NatLink installer, and reinstall NatLink Core from a wheel with py -m pip install -e . . Does that sound about right?

Thanks in advance!

dougransom commented 1 year ago

"Finally, according to the NatLink Core README, even though NatLink installs NatLink Core, if one is at home working on development of NatLink Core, it then becomes necessary to uninstall the version of NatLink Core installed by the NatLink installer, and reinstall NatLink Core from a wheel with py -m pip install -e . . Does that sound about right?"

Yes, though you just uninstall natlinkcore with pip uninstall natlinkcore then pip install -e .[dev,test] the [dev,test] just brings in flit and pytest i don't think that is in the developer instructions yet. or you can just instlal them seperately pip install flit pip install pytest.

dougransom commented 1 year ago

"In the end, it seemed to me that the wheel found under the "dist" subdirectory of the NatLink installation directory doesn't really need to be installed, as I never installed anything like that in the past. Am I correct, or should I actually manually install that wheel under the "dist" subdirectory in the NatLink installation directory?"

It is there for a reason, because we want natlink installed in that folder, and the installer does so with pip. however because you ran the installer, it will do that for you.

The installer does some further registry shenanigans,, so natlink must be installed in the particular folder it is. natlinkcore etc. should just go whereever python wants to install packages with pip for you.

By having pip install, natlink is treated as a python package. Now other packages (mainly natlinkcore) that depend on natlink can be sure they are installed with a compatible version. Otherwise users could more easily end up with incompatible natlink and natlinkcore, which would be hard to diagnose.

PS C:\Users\doug> pip show natlink Name: natlink Version: 5.4.4 Summary: Natlink is an OpenSource extension module for the speech recognition program Home-page: Author: Joel Gould Author-email: License: Location: c:\program files (x86)\natlink\site-packages Requires: Required-by: natlinkcore

If you look in the root of natlink github there are 3 powershell scripts. You can use local_publish_15.ps1 to update the natlink binaries you installed with the installer if you are building the C++ and want to run it. Someone more clever than me would add a build step the the visual studio code project to do this (manually triggered after a build).

GregoryShields commented 1 year ago

Thank you, Doug. I'll take from your comments what I can.

I realize that I'm asking too many questions and making too many waves, and having too many expectations. I'll try to do less in the areas of complaint and inquiry and more in the areas of analysis and contribution.

quintijn commented 6 months ago

Gregory, is it ok to close this? When you want to run python 3.11 outside Dragon/Natlink, you better install a 64bit version. Multiple python installs safely run in parallel.

quintijn commented 2 months ago

Closing this, please reopen if things are still relevant...