You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
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.
@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?
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.
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.
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.
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.
@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?
@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...
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 :]
Hi, so I am not a technical programmer. I did install Microsoft
C++2015-2019 and Visual studio installer. Not sure what I need to do. I
have with Andres through teams in which we shared the workstation screen to
help me set it up. I wonder if this could be a way to help me set up the
system. The only thing is that I don't have a camera and a mike on the
workstation, so I talked to Andres via the laptop.
Alternatively, if you don't mind let me know what should I install in
preparation or to be able to work with Andres to solve this
thanks Ron
@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.
@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
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:
Maybe makes sense to increase the version number
By removing Python 2, are we breaking someone's setup? I am sure no one is using Python2 now, but just in case.
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!
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 :]
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.
@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.
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.
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
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.
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..
Activity
[-]Windows build required to install[/-][+]VS Build tools required to install[/+]diazandr3s commentedon Feb 1, 2022
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.
masadcv commentedon Feb 1, 2022
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 simplecrfcompiles 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
andreped commentedon Feb 1, 2022
@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?
andreped commentedon Feb 1, 2022
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.
SachidanandAlle commentedon Feb 1, 2022
We don't want to go back.. we don't want to worry about python 2.x
andreped commentedon Feb 1, 2022
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.
andreped commentedon Feb 1, 2022
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.
SachidanandAlle commentedon Feb 1, 2022
@masadcv can we try and test the precompiled version of crf.. this will bring more convenience for MONAILabel users while installing the package
andreped commentedon Feb 1, 2022
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?masadcv commentedon Feb 1, 2022
@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/SimpleCRFwork 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...
andreped commentedon Feb 1, 2022
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 :]
ralkalay commentedon Feb 1, 2022
andreped commentedon Feb 1, 2022
@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 SimpleCRFandpip install monailabelAre 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.
ralkalay commentedon Feb 1, 2022
19 remaining items
andreped commentedon Feb 5, 2022
@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
diazandr3s commentedon Feb 9, 2022
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!!
masadcv commentedon Feb 9, 2022
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:
@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!
andreped commentedon Feb 9, 2022
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 :]
andreped commentedon Apr 5, 2022
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-binariesThis 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.
masadcv commentedon Apr 5, 2022
@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
andreped commentedon Apr 5, 2022
@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.
masadcv commentedon Apr 5, 2022
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.
andreped commentedon Apr 5, 2022
@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.
SachidanandAlle commentedon Apr 5, 2022
maxflowmissing in the pip package forSimpleCRF-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
jamesobutler commentedon Apr 5, 2022
For clarity here as well, I made a comment about the SimpleCRF-binaries at #8 (comment).
andreped commentedon Apr 5, 2022
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.
SachidanandAlle commentedon Apr 5, 2022
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 ^^
andreped commentedon Apr 5, 2022
@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.
andreped commentedon Oct 24, 2022
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: