Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

still elevation problems with pipping packages... #207

Open
quintijn opened this issue Aug 22, 2024 · 5 comments
Open

still elevation problems with pipping packages... #207

quintijn opened this issue Aug 22, 2024 · 5 comments
Assignees

Comments

@quintijn
Copy link
Contributor

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 quintijn self-assigned this Aug 22, 2024
@quintijn
Copy link
Contributor Author

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
Copy link
Member

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

@LexiconCode
Copy link
Member

LexiconCode commented Sep 3, 2024

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.

@dougransom
Copy link
Member

dougransom commented Dec 2, 2024

These are the two valid install scenarios I think we should support.

Install for all users:

  • natlink installed for all users.
  • must install python for all users

Install for current user (note this can't be done for more than one user):

  • natlink installed for current user
  • install Python for current user.

For all user installs:

  • we should install natlinkcore in a non-elevated pip. In a multi-user scenario, each user will have to install natlinkcore. Q. Will multi-user installs actually work if we do this?
  • the installer only installs natlink.pyd in elevated mode.
  • it installs natlinkcore for the current user.
  • any other users must (or this be automated, perhaps running the installer as a 'client', maybe we install a batch file that each user can run):
    -- set up the path to python
    -- install natlinkcore with pip on the command line
    -- run natlinkconfig_gui

For current user:

  • install python for current user.
  • we should register natlink for current user in the registry. This involves adding a DllInstall dll entry point in the dll.
  • a Python virtual environment should have no effect.

We could say for all user installs:

  • you are frozen with dtactions, natlinkcore, and anything else that natlincore installs. The user can create problems for themselves possibly if they install these in their user area, which could happen by mistake upgrading something like unimacro.

  • unimacro and vocola and dragonfly etc. can be upgraded by each user.

or we could say if you install natlink for all users, you must run pip elevated to install or upgrade all packages. Unimacro, vocola, any third party python packages. If you don't you are going to have problems.

@dougransom
Copy link
Member

some experiements on registering natlink per user

I was able to register _natlink_core.pyd for a per user basis, and it was able to create a natlink object using a test program. Unfortunately, natlink crashes in this situation.

I will have to wait till I have a little more time and energy to put into this before I investigate further.

All i did was register with this after replacing %MODULE% by editing the file.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\CLSID\{dd990001-bb89-11d2-b031-0060088dc929}]
@="Python Subsystem for NatSpeak"
"InprocServer32"="%MODULE%"
{
    "ThreadingModel"="Apartment"
    "AppID"="{dd990001-bb89-11d2-b031-0060088dc929}"
}

[HKEY_CURRENT_USER\Software\Classes\AppID\{dd990001-bb89-11d2-b031-0060088dc929}]
@="Python Subsystem for NatSpeak"
"DllSurrogate"=""
'''

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants