Open fcjxxl opened 4 years ago
Thanks. I am aware of the binary version of dicompyler not working on macOS Catalina. Currently, the 2 choices are:
to run with source: with the conda environment, one needs to % conda install python.app and also, rather than using "python" one must use "pythonw". % pythonw dicompyler_app.py
it's also possible one might need to install some of the dependencies.
If using conda, I recommend creating a conda environment specifically for dicompyler and one might need to use pip rather than Conda for some dependencies (which may make the conda environment not particularly usable for other purposes at that point).
and be careful about installing the latest from Python.org (3.8 at this moment) because that's not particularly well supported by conda and some packages.
That will get dicompyler 0.4.2 on MacOS 10.15 (Catalina) running from source.
but it won't show CT data, there is an ImportError exception on:
from matplotlib import _cntr as cntr
over at OnkoDICOM (which uses dicompyler-core extensively), there is alternative import from legacycontour (maintained?) on matplotlib at GitHub. I did the following in dicompyler/baseplugins/2dview.py:
import legacycontour._cntr as cntr
(one should be able to try/catch, but that didn't seem to work for me)
getting legacycontour to build requires that the Mac user (e.g. fcjxxl) have XCode installed (which is a substantial download, even with fibre download speeds... perhaps an overnight download) and the way to get legacycontour in to the python environment in the OnkoDICOM project was to add the following to the requirements.txt
git+https://github.com/matplotlib/legacycontour.git
(and use pip or maybe pip3): pip install -r requirements.txt
Although I have to say... refraining from upgrading to Catalina might not be such a bad thing. It also obsoletes any 32 bit apps.
I'd also refrain from upgrading to Python 3.8... I couldn't get dependencies (with conda or pip) to work out, and had to downgrade (remove the change to PATH, let conda environment control my Python version). And there are a lot of dependencies in other python code that break on 3.8 still...
But it is possible to get dicompyler to work on Catalina.
Wow, thanks for the great write up. For source code users that seems like it will work a treat. Not sure how many people use Conda on the Mac, but most non-data science people that I am aware of use Python from Homebrew or the official Python distribution. Might have to tailor the instructions based on those too.
I don't have those environment/tools, and my Python distribution from Python.org is 3.8 (and when I try to just do a pip install with the modified requirements.txt, it breaks on building legacycontour... part of why I recommended against upgrading to 3.8... lots of breakage). But for those who have other environments, I'd modify the requirements file to add legacycontour and try the pip install -r requirements.txt if that works, the rest should be straight forward (modify the dicompyler code, and use pythonw if it exists, or python if pythonw is not there, in which case YMMV).
But if someone is dead set on getting dicompyler to work on Catalina, and they can't get things to go without Anaconda, they can download Anaconda. If they can download XCode, downloading Anaconda should be a walk in the park.
I made it work for me, and I've done my best to carefully document that. FOSS means that a little elbow grease is sometimes required. Sometimes a lot of elbow grease...
For those who can't get it running directly on Catalina, there's always a Virtual Machine environment approach (I use a commercial product, VMWare Fusion, but there are FOSS solutions for that too, and use a Linux VM, e.g. Ubuntu 18.04 LTS), or they could provide support to the dicompyler project sufficient to enable the 64 bit Catalina build/port.
There is a pop-up window indicating that the dicompyler.app needs to be updated. The following link may be helpful. https://support.apple.com/en-us/HT208436