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

[ENH] Add-on installation with Conda #2561

Merged
merged 8 commits into from
Oct 24, 2017

Conversation

astaric
Copy link
Member

@astaric astaric commented Sep 5, 2017

Issue

Some add-ons have dependencies that are a pain to install on windows. Conda makes this easier

Description of changes

Add-on installation/upgrading/uninstallation calls conda commands before pip. If conda command succeeds, pip says that everything is up to date/uninstalled and does nothing.

Needs testing on win/linux, with different configurations (orange installed in conda root/conda environment, orange installed beside conda, ...)

Includes
  • Code changes
  • Tests
  • Documentation

if command == Install:
self.setStatusMessage(
"Installing {}".format(pkg.installable.name))
if self.conda:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If self.conda is an instance of CondaInstaller(), shouldn't this check be self.conda.conda?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically yes, but since CondaInstaller reimplements __bool__, this is the same thing

@codecov-io
Copy link

codecov-io commented Sep 6, 2017

Codecov Report

Merging #2561 into master will increase coverage by <.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #2561      +/-   ##
==========================================
+ Coverage   75.83%   75.83%   +<.01%     
==========================================
  Files         338      338              
  Lines       59541    59541              
==========================================
+ Hits        45150    45152       +2     
+ Misses      14391    14389       -2

@ajdapretnar
Copy link
Contributor

ajdapretnar commented Sep 6, 2017

Not sure I tested it right, but I've made a new environment and got the branch from Github. Ran Orange and tried to install the add-ons via the dialog. Got this:

Traceback (most recent call last):
  File "c:\orange\orange3\Orange\canvas\application\addons.py", line 780, in _next
    self.pip.install(pkg.installable)
  File "c:\orange\orange3\Orange\canvas\application\addons.py", line 816, in install
    run_command(cmd)
  File "c:\orange\orange3\Orange\canvas\application\addons.py", line 917, in run_command
    raise CommandFailed(command, process.returncode, output)
  File "c:\orange\orange3\Orange\canvas\application\addons.py", line 742, in __init__
    cmd = " ".join(map(shlex.quote, cmd.cmd))
AttributeError: 'list' object has no attribute 'cmd'

Windows10.

@astaric
Copy link
Member Author

astaric commented Sep 6, 2017

Fixed, can you try again?

@ajdapretnar
Copy link
Contributor

ajdapretnar commented Sep 6, 2017

Um, now I don't get this error, but another issue occurs. Potentially not related to this PR, but I tried to install all the add-ons and some crash normally (Geo, Recommendation, Timeseries), while the rest seem to get installed. However, when I re-run Orange, the entire program crashes. Ran with -l 4, I see that the issue is in Spark and Textable add-ons, most likely.

@markotoplak
Copy link
Member

Work on linux without conda. Works just as well as installing with pip directly (succeeds if pip succeeds, fails with an error of it).

@kernc
Copy link
Contributor

kernc commented Sep 6, 2017

Even if a single addon is selected and the installation fails, the information dialog encouraging a restart still shows.
screenshot_2017-09-06_16-52-02

@astaric astaric changed the title Conda install addons [ENH] Add-on installation with Conda Sep 21, 2017
@astaric
Copy link
Member Author

astaric commented Sep 24, 2017

Blocked by #2616

Until we install conda command and conda-forge channel with our miniconda installer, this will not work

@astaric
Copy link
Member Author

astaric commented Sep 26, 2017

@kernc, @ajdapretnar, @markotoplak

I think I am done. Could you try it out again?

else:
files = [os.path.join(
USER_SITE, 'orangecontrib',
dist.project_name.split('-')[-1].lower()), ]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This assumes all user-installed add-ons are in orangecontrib package, but this is just an internal convention, with the real add-on being anything that provides an orange3.addon entry point.

Copy link
Member Author

@astaric astaric Sep 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I should wrap this in try: except: pass?

This is the same code we are using at the moment, I have just moved it to a separate class.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, and I wrote it, but it's wrong in its assumptions.

No idea how to make it correct.

HTH

@kernc
Copy link
Contributor

kernc commented Sep 26, 2017

Installing e.g. Orange3-Timeseries

Running conda install --yes Orange3-Timeseries
Fetching package metadata ...............
Solving package specifications: .

Package plan for installation in environment /home/jk/Downloads/miniconda3:

The following NEW packages will be INSTALLED:

    anyqt:              0.0.8-py35_1 conda-forge
    bottleneck:         1.2.1-py35_1 conda-forge
    dill:               0.2.6-py35_0 conda-forge
    keyring:            9.0-py35_0   conda-forge
    orange3:            3.4.1-py35_0 anaconda   
    orange3-timeseries: 0.3.1-py35_0 conda-forge

Orange3 (lower version) gets reinstalled.

@astaric
Copy link
Member Author

astaric commented Sep 26, 2017

@kernc what are your conda channel priorities?

@kernc
Copy link
Contributor

kernc commented Sep 26, 2017

The order of channels in .condarc:

channels:
  - conda-forge
  - anaconda
  - anaconda-fusion
  - defaults

@ajdapretnar
Copy link
Contributor

When installing Orange3-Network, installation seems to stall forever. It reaches 'Orange3-Network successfully installed' message, but it never exits the process. I also can't quit the dialog window and have to force quit in the console.

Also, installations prints every increment in the process, e.g. orange3-networks 3%, orange3-networks 4%, orange3-networks 5%... etc. Is there a silent mode we can turn on? :)

@astaric astaric added this to the 3.7 milestone Oct 17, 2017
@astaric
Copy link
Member Author

astaric commented Oct 17, 2017

I have added the -q flag to conda calls. The stalling is not related to conda, since it already happens sometimes with the master version of Orange.

Otherwise, orange tries to downgrade to the (outdated) version from
defaults.
@astaric
Copy link
Member Author

astaric commented Oct 20, 2017

I have disabled the conda installation of add-ons by default (it can be enabled with a checkbox in settings), hidden the download progressbar (--quiet option is passed to conda).

I have updated the order of channels in the environment created by our miniconda installer, as having defaults on top downgrades orange whenever you install an add-on. Pip uninstall now only runs when conda fails to uninstall. And all package names passed to conda are now lowercase (heuristic, but works :)).

If there is anything that needs to be fixed, please let me know. Otherwise I consider this PR complete.

As some commands are case sensitive and other not, always normalize
package names to lowercase. When uninstalling, run pip uninstall only
when that package could not be uninstalled with conda.
@lanzagar lanzagar merged commit 89059d5 into biolab:master Oct 24, 2017
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

Successfully merging this pull request may close these issues.

6 participants