biolab / orange-canvas-core

Orange Canvas core workflow editor
GNU General Public License v3.0
36 stars 66 forks source link

Update Orange from add-on dialog #162

Open thocevar opened 3 years ago

thocevar commented 3 years ago

Updating Orange on Windows via the add-on dialog results in an error and defaults back to pip when updating Orange via the add-on dialog as uncovered by biolab/orange3#5064. Updating while running Orange as Administrator succeeds.

  Attempting uninstall: Orange3
    Found existing installation: Orange3 3.26.0
    Uninstalling Orange3-3.26.0:
      Successfully uninstalled Orange3-3.26.0
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] Access is denied: 'c:\\users\\thocevar\\appdata\\local\\orange\\lib\\site-packages\\~range\\data\\_contingency.cp37-win_amd64.pyd'
Consider using the `--user` option or check the permissions.

Process Explorer shows that pythonw process has *.pyd files loaded. However, it is possible to update Orange (3.26.0 -> 3.27.1) while it's running from the Orange Command Line. Strangely, it requires two runs. In the first run conda reports that "The environment is inconsistent" and upgrades, installs some packages. In the second run it updates Orange without any errors.

The add-on executes the first run of conda install. It probably detects that it didn't upgrade the package and then runs pip install. The displayed error is the result of this second pip run which shouldn't happen.

ales-erjavec commented 3 years ago

The 'The environment is inconsistent' could happen for a variety of reasons one of which is that the metadata of existing packages on anaconda repo are hotfixed: https://github.com/conda/conda/issues/8490#issuecomment-481849564

With the patch in gh-166 the second pip install will not run if conda first succeeds in any endeavor even if the actual requested package is not updated/installed in the process.