conda / menuinst

Cross platform menu item installation
https://conda.github.io/menuinst/
BSD 3-Clause "New" or "Revised" License
36 stars 42 forks source link

PythonW.exe not found during installation of "spyder" and other GUI items with conda #64

Closed vx1920 closed 6 years ago

vx1920 commented 6 years ago

I have Win7-X86 and latest Anaconda3-X86, menuinst version 14.x. During installation of "spyder" and other GUI items I got message box "Windows can not find pythonw" along with suspicious log from "menuinst". I use Windows command line: "py -m conda install spyder". My own py.bat uses proper full path to python.exe followed by the above arguments from command line (Windows cmd.exe prompt). I did review sources in "Anaconda\Lib\site-packages\menuinst" and I found suspicious place in:

    Anaconda\Lib\site-packages\menuinst\ __init__.py, function install().

Original fragment presented below:

        runAsAdmin(['pythonw', '-c',
                    "import menuinst; menuinst.install(%r, %r, %r)" % (
                        path, bool(remove), prefix)])

Problem is that somebody is using full path everywhere in the generated menu item, while "pythonw" itself is caled without any path. I did modify call to "runAsAdmin" as below. I did change only the first item in [] argument from 'pythonw' to full path to pythonw (path is available in prefix variable):

  runAsAdmin(["%s\\pythonw.exe" % (prefix),
           '-c',
           "import menuinst; menuinst.install(%r, %r, %r)" % (
              path, bool(remove), prefix)])

After this modification I can see that pythonw.exe is started and request administrative elevation, as it supposed to be (maybe). It looks like that somebody have to fix something.

vx1920 commented 6 years ago

I did update conda/menuinst in May-30-2018. I found that init.py was changed and mentioned fragment looks better ( pay attention to join() ):

                retcode = runAsAdmin([join(sys.prefix, 'python'), '-c',
                                      "import menuinst; menuinst.install(%r, %r, %r, %r)" % (
                                          path, bool(remove), prefix, True)])

I don't know who did fix it and when, but it looks good and this issue can be closed. Thank you any case.

msarahan commented 6 years ago

pythonw should absolutely be there, but if this fixes any problems that anyone had, I'm happy. It's actually an unintentional change left over from trying to debug stuff. I'm happy enough to leave it as is, though - it might show more quickly-disappearing black console windows is all.

dlouhasha commented 4 years ago

I Installed the 2020 07 version of windows 64-bit anaconda. The same problem still occurred. Wonder why Update: I chose "current user" instead of "all users" during the installation process and the error was fixed.

github-actions[bot] commented 2 years ago

Hi there, thank you for your contribution!

This issue has been automatically locked because it has not had recent activity after being closed.

Please open a new issue if needed.

Thanks!