dictation-toolbox / natlink

Natlink provides the interface between Dragon and python
https://dictation-toolbox.github.io/natlink/
Other
25 stars 17 forks source link

still elevation problems with pipping packages... #207

Open quintijn opened 3 months ago

quintijn commented 3 months ago

I think, we need to do all pip installs elevated, or none (after natlink itself).

part of messages window just now:

`Natlink Version: 5.5.7 Natlink pyd path: C:\Program Files (x86)\Natlink\site-packages\natlink_natlink_core.pyd Python Version: 3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:20:04) [MSC v.1929 32 bit (Intel)] Natlink is loaded...

Starting natlink loader from config file: "C:\Users\Gebruiker.natlink\natlink.ini" loading module: _sample1 loading module: init loading module: _vocola_main VocolaEnabled: True Traceback (most recent call last): File "C:\DT\NatlinkcoreDoug\src\natlinkcore\loader.py", line 332, in load_or_reload_module module = self._import_module_from_path(mod_path) (...) File "C:\Program Files (x86)\Python310-32\lib\site-packages\vocola2_vocola_main.py", line 96, in os.mkdir(VocolaGrammarsDirectory) FileNotFoundError: [WinError 3] The system cannot find the path specified: '' Traceback (most recent call last): File "C:\DT\NatlinkcoreDoug\src\natlinkcore\loader.py", line 332, in load_or_reload_module module = self._import_module_from_path(mod_path) File "C:\DT\NatlinkcoreDoug\src\natlinkcore\loader.py", line 287, in _import_module_from_path loader.exec_module(module) File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "C:\Program Files (x86)\Python310-32\lib\site-packages\vocola2_vocola_main.py", line 96, in os.mkdir(VocolaGrammarsDirectory) FileNotFoundError: [WinError 3] The system cannot find the path specified: '' `

Unimacro is locally pipped, so focus this issue on Vocola.

I have Python 3.10.11 (32 bit) installed on C:\Program Files (x86)\Python310-32\Lib\site-packages, with vocola2 installed there. Also C:\Program Files (x86)\Natlink\site-packages with natlink and other things (no vocola2 or unimacro).

Then, from an unelevated configure session: C:\Users\Gebruiker\AppData\Roaming\Python\Python310-32\site-packages a bunch of modules, but NOT unimacro or vocola2.

Before I had vocola2 just running on this computer...

So I am confused.

I put it here for not forgetting about it, will try a few more things first. Quintijn

quintijn commented 3 months ago

site-packages Python321-32 site-packages appdata roaming etc site-packages Natlink

the 3 places where site-packages are. Probably 2 of them elevated.

drmfinlay commented 2 months ago

Goodness! This is confusing me, too. It was a lot simpler when everything was under C:\Natlink.

LexiconCode commented 2 months ago

And this goes back to a previously documented issue when Pip is invoked as a standard user versus elevated privileges. pip should never be executed as administrator. The end user never installs packages as admin nor should they.

Installer runs as administrator and it has to, for in-process. I'm not sure how to downgrade pip install when the installer executes pip if python is installed as a user.

Why not install as 'pip install --user'? because if you log in a different user, you'll be missing packages.

If python is installed as a user then the pyd will error appear when other users use Dragon without natlink. There's a lot of problems with everything installed globall and Python user install isn't perfect for in-process either.

Additionally PIP randomly decides sometimes to include dependencies in various places.

This is really what started my journey working towards virtual installs. Out of process only seems to be the way to go.