Skip to content

VS Build tools required to install #7

Open

Description

@andreped

This is probably more of a feature request than a bug.

Whenever I wish to install this solution on Windows it requires that I have VS build tools installed as it seems like it needs to build maxflow. This becomes a challenge as some of the users of a software I am using find it challenging to install this.

What I was thinking is why this is not just built on the cloud, for instance using GitHub Actions, and then when installing you are just catching the pre-built wheel and using that to install. I guess this would be of interest to the MONAI-Label team (@diazandr3s) as well.

I can assist in setting up the Actions workflow and submit a PR, if that would be of interest.

I could attempt to setup builds for the operating systems: Windows, macOSX, and Ubuntu Linux.

Shall I make a try?

Activity

  1. changed the title [-]Windows build required to install[/-] [+]VS Build tools required to install[/+] on Jan 31, 2022
  2. diazandr3s commented on Feb 1, 2022

    @diazandr3s

    Hi @andreped,

    Thanks for pinging me. I think this will be great.
    Recently, a Windows user (@ralkalay) trying to install MONAI Label on his computer had a VS-related problem. See this issue: Project-MONAI/MONAILabel#363

    I'm sure @masadcv and @SachidanandAlle can provide more information about the use of simpleCRF in MONAI Label.

  3. masadcv commented on Feb 1, 2022

    @masadcv
    Contributor

    Thanks @diazandr3s for tagging me here.
    Currently SimpleCRF is used for scribbles-based methods within MONAI Label.

    As @andreped mentioned, SimpleCRF requires compiling, i.e. pip install simplecrf compiles the code during installation. This is only needed once, and is just like any other pip installation you would do. The problem with Windows is that it requires installation of VS build tools to compile as Windows does not come with these pre-installed, where the error message points to the link for downloading and installing the tools (see Project-MONAI/MONAILabel#363 (comment)).

    It would be good to have pre-compiled binaries for this if possible, however I am unsure how much work this would be as compilation is required for all systems and for each python version. Some functions depend on numpy for compilation – I am unsure how this can be handled to make pre-compiled binaries that work across platforms but also with different versions of numpy.

    Lets wait for someone from HiLab to comment on this.

    cc: @taigw

  4. andreped commented on Feb 1, 2022

    @andreped
    ContributorAuthor

    @masadcv I will make an attempt and we will see how easy it is :P Will let you know when the workflow from making pre-compiled binaries is running and I can make a PR and we can co-develop from there?

    I can setup builds for various Python versions. However, from the setup.py, I see that there is no limitations on Python version used. Is that so? Have you tested installing SimpleCRF on different versions?

  5. andreped commented on Feb 1, 2022

    @andreped
    ContributorAuthor

    I have gotten quite far. What remains is setting up such that python limited api is used and creating a wheel for each operating system. However, I see that classifiers and python_requires in setup.py are contradicting.

    Do you only support Python 3.6 and above, or do you want to support Python 2 as well? See here. If only Python >=3.6, then it is easy.

    See my fork for my proposed workflow:
    https://github.com/andreped/SimpleCRF/tree/workflow/.github/workflows

    It is still a work in progress, but at least the wheels are produced. As the software include C++ code, I will have to make a wheel for each operating system. I can set that up now.

  6. SachidanandAlle commented on Feb 1, 2022

    @SachidanandAlle

    We don't want to go back.. we don't want to worry about python 2.x

  7. andreped commented on Feb 1, 2022

    @andreped
    ContributorAuthor

    We don't want to go back.. we don't want to worry about python 2.x

    Understandable. Will let you know when I have the wheels ready for you to test.

    Also, I played a lot around with getting the demos to run on the cloud, but it failed on Windows and macOS. On the latter it failed due to some graphics-related issue, which makes sense as I believe it runs headless? Also OpenGL is not supported on macOS any longer, so it complained about that as well. For Windows it froze on plt.show(). Perhaps having a simple way to neglect that if not possible would be better. I tested the maxflow demo.

  8. andreped commented on Feb 1, 2022

    @andreped
    ContributorAuthor

    Forward-compatible python wheels with abi3 for windows, ubuntu, and macos are now being created:
    https://github.com/andreped/SimpleCRF/actions

    These wheels are compatible with Python >=3.6 as discussed.

    It is also possible to push these directly to PyPI in the workflow. However, AFAIK this would require permissions to your PyPI repo which I doubt I have nor need. A separate workflow to release could be a good idea, for instance to only make the release when a new tag is made.

    Feel free to test the workflow and produced binaries on different operating systems, different python versions, and different setups. Or even better, make unit tests which can be deployed as workflows instead.

    The final part has to be done by the developing team, and then I guess the MONAI-Label team and @diazandr3s could test if the new pre-compiled binaries can be used directly when installing through pip. Especially relevant for windows which previously required VS and Visual C++ build tools to be able to install SimpleCRF.

  9. SachidanandAlle commented on Feb 1, 2022

    @SachidanandAlle

    @masadcv can we try and test the precompiled version of crf.. this will bring more convenience for MONAILabel users while installing the package

  10. andreped commented on Feb 1, 2022

    @andreped
    ContributorAuthor

    @masadcv can we try and test the precompiled version of crf.. this will bring more convenience for MONAILabel users while installing the package

    Definitely. With GitHub Actions these are compiled on the fly and made available as artifacts. For instance for ubuntu, see here, under Artifacts there should be a file called "Python wheel". Download and extract and you should have the python wheel. Similar wheels are produced for all operating systems - see here to access wheels for different builds.


    EDIT: Might seem like there is a minor DLL issue. When testing on my personal, local windows desktop, I got ImportError: DLL load filed while importing denseCRF. Might be that there is something missing in the setup.py? Any ideas?

  11. masadcv commented on Feb 1, 2022

    @masadcv
    Contributor

    @SachidanandAlle sure, I will do some tests locally. I only have access to Ubuntu machine at the moment. Can someone help verify Windows and Mac OS MONAI Label setups for this? In the meantime I will try to find a Windows machine to verify this.

    Nice work @andreped !! What's the best way to access the compiled wheels? Would something like pip install git+https://github.com/andreped/SimpleCRF work for this? Or do I need to manually download them?
    In the long- term, it would be good to release these as PyPI packages so we won't need changes on MONAI Label side...

  12. andreped commented on Feb 1, 2022

    @andreped
    ContributorAuthor

    You cannot do the proposed "pip install" solution as this will not download the binaries, but rather run the setup.py install as you previously did for SimpleCRF, and then we are back to square one.

    I can publish the binaries as releases on my fork and you can access them there if you'd like. Otherwise, the binaries are found as Artifacts for each build. Currently, there seems to be a bug, so no point publishing as a release just yet.

    When the solution is working as it should, the ideal solution would be to put these in the releases on PyPI, but as of now, we should verify that this actually works first :]

  13. ralkalay commented on Feb 1, 2022

    @ralkalay
  14. andreped commented on Feb 1, 2022

    @andreped
    ContributorAuthor

    @ralkalay the whole idea with this solution is that you should not need VS and C++ build tools to use SimpleCRF and AFAIK MONAI-Label for that manner. Simply pip install SimpleCRF and pip install monailabel

    Are there any other reasons why VS and C++ build tools would be needed for just using the binary of MONAI-Label, @diazandr3s ? I am not talking about building anything just using the plugin with slicer.

  15. ralkalay commented on Feb 1, 2022

    @ralkalay
  16. 19 remaining items

  17. andreped commented on Feb 5, 2022

    @andreped
    ContributorAuthor

    @taigw do you have time to do some tests and perhaps add these binaries to the official release? Would simplify installing SimpleCRF on all operating systems by a lot. See pull request #8

  18. diazandr3s commented on Feb 9, 2022

    @diazandr3s

    Hi @andreped,

    Thanks for driving this.
    Just wanted to let you know I've tried the binary on a Windows machine and it works great!

    Thanks again!!

  19. masadcv commented on Feb 9, 2022

    @masadcv
    Contributor

    Hi @andreped ,
    I have now tested and verified the following on Ubuntu 20 using MONAI Label==0.3.1 with Scribbles:

    I dont have access to Windows setup, but we have multiple confirmations for this above.
    Looks good and great work, Andre! (y)

    I have a couple of comments on the PR:

    1. Maybe makes sense to increase the version number
    2. By removing Python 2, are we breaking someone's setup? I am sure no one is using Python2 now, but just in case.
    3. What setup (if any) would be required to release these binaries on PyPI?

    @taigw please have a look at the PR #8 which provides workflow for pre-compiled binaries for SimeplCRF for a range of different machines. We may additional be required to release this on PyPi. This improves the reach of this library to machines which may have problems in compiling it (we have seen a number of user report this on Windows machines, see: Project-MONAI/MONAILabel#363 for example). Many thanks!

  20. andreped commented on Feb 9, 2022

    @andreped
    ContributorAuthor

    Luckily, adding support for more Python versions is simple. However, it is likely not worth the effort to add support for too old Python versions (what insane man still uses python 2.7? python 2 is even no longer maintained!), especially not Python 2. But if that is of interest, I can modify the setup.py and workflow scripts to produce more wheels.

    Currently, I have only made wheels for Python >= 3.6, but I can add more, if you'd like. Just come with requirements, @taigw :]

  21. andreped commented on Apr 5, 2022

    @andreped
    ContributorAuthor

    Until this fix has been added to the main PyPI project (SimpleCRF), after discussion with @SachidanandAlle in the PR #8, I have created a separate temporary PyPI project which includes these binaries at:
    https://pypi.org/project/SimpleCRF-binaries/

    Therefore to use my fix, simply install SimpleCRF by:
    pip install SimpleCRF-binaries

    This should solve your issue relevant for MONAI Label, @diazandr3s and @masadcv.
    Let me know if you are experiencing any issues, and I can fix this straight away.

  22. masadcv commented on Apr 5, 2022

    @masadcv
    Contributor

    @andreped many thanks! I will give it a try in coming days...

    If all looks good, maybe we can have a PR for MONAI Label to switch to using these.
    At the top of my head, I see two places that need changing (maybe there are more):
    https://github.com/Project-MONAI/MONAILabel/blob/f89e4a295c3e77e8ae49830368e34c364815ad96/setup.cfg#L46
    https://github.com/Project-MONAI/MONAILabel/blob/f89e4a295c3e77e8ae49830368e34c364815ad96/requirements.txt#L20

  23. andreped commented on Apr 5, 2022

    @andreped
    ContributorAuthor

    @masadcv Yes, definitely. I could make that PR, if you'd like. About time I started contributing more :P

    Note that I also bumped version to v0.2.1.2 from v0.1.2.1 to avoid the issue of people assuming these wheels are identical. The README of this project also contains a disclaimer.

  24. masadcv commented on Apr 5, 2022

    @masadcv
    Contributor

    Yes, please go for it and let's take this and any other MONAI label discussion there :)
    Good idea to bump version, as this really is a temporary solution - it should be fine to avoid any confusions.

  25. andreped commented on Apr 5, 2022

    @andreped
    ContributorAuthor

    @masadcv a PR has now been made (see Project-MONAI/MONAILabel#725).

    I can mention that a PR has been made in this issue Project-MONAI/MONAILabel#719.

  26. SachidanandAlle commented on Apr 5, 2022

    @SachidanandAlle

    maxflow missing in the pip package for SimpleCRF-binaries ?
    i can't import the same.. after I uninstall previous SimpleCRF and install SimpleCRF-binaries

    I see only so files.. python modules for maxflow and denseCRF are missing

  27. jamesobutler commented on Apr 5, 2022

    @jamesobutler

    For clarity here as well, I made a comment about the SimpleCRF-binaries at #8 (comment).

  28. andreped commented on Apr 5, 2022

    @andreped
    ContributorAuthor

    maxflow missing in the pip package for SimpleCRF-binaries ?

    Strange... Was this working before with the previous wheels? Also, which operating system were you testing on? I could setup some unit tests using these wheels to test this further.

  29. SachidanandAlle commented on Apr 5, 2022

    @SachidanandAlle

    now we have new problem.. license.. it's not compatible for monai+
    we have to drop this dependency temporarily.. and find other solutions for scribbles..

    Project-MONAI/MONAILabel#726

    @andreped ^^

  30. andreped commented on Apr 5, 2022

    @andreped
    ContributorAuthor

    @SachidanandAlle does this mean that the wheels work as they should, given that the correct numpy version is installed? Issue seemed to be resolved in this thread:
    Project-MONAI/MONAILabel#725 (comment)

    I could update the SimpleCRF installation to use a newer version of numpy.

  31. andreped commented on Oct 24, 2022

    @andreped
    ContributorAuthor

    The corresponding PR has now been merged with master: f75618b

    which means that precompiled wheels will be generated for each commit. For instance, see here:
    https://github.com/HiLab-git/SimpleCRF/actions/runs/3305458323

    However, a new release should be made which uses the precompiled wheels instead.

    Until that is done, you can install SimpleCRF by:

    pip install SimpleCRF-binaries
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions