SMI / dicompixelanon

DICOM Pixel Anonymisation
3 stars 0 forks source link

Unable to install DicomPixelAnon on MacOS (python 3.11.4) #22

Closed darshad-github closed 1 year ago

darshad-github commented 1 year ago

STACK TRACE

dicompixelanon/src/library % python setup.py install

Traceback (most recent call last):
  File "/Users/daniyalarshad/Desktop/pythonProject/dicompixelanon/src/library/setup.py", line 50, in <module>
    setup(
  File "/Users/daniyalarshad/Desktop/pythonProject/venv/lib/python3.11/site-packages/setuptools/__init__.py", line 107, in setup
    _install_setup_requires(attrs)
  File "/Users/daniyalarshad/Desktop/pythonProject/venv/lib/python3.11/site-packages/setuptools/__init__.py", line 75, in _install_setup_requires
    dist = MinimalDistribution(attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/daniyalarshad/Desktop/pythonProject/venv/lib/python3.11/site-packages/setuptools/__init__.py", line 57, in __init__
    super().__init__(filtered)
  File "/Users/daniyalarshad/Desktop/pythonProject/venv/lib/python3.11/site-packages/setuptools/dist.py", line 486, in __init__
    for ep in metadata.entry_points(group='distutils.setup_keywords'):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/metadata/__init__.py", line 1040, in entry_points
    return SelectableGroups.load(eps).select(**params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/metadata/__init__.py", line 476, in load
    ordered = sorted(eps, key=by_group)
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/metadata/__init__.py", line 1037, in <genexpr>
    eps = itertools.chain.from_iterable(
                                       ^
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/metadata/_itertools.py", line 16, in unique_everseen
    k = key(element)
        ^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/metadata/__init__.py", line 954, in _normalized_name
    or super()._normalized_name
       ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/metadata/__init__.py", line 627, in _normalized_name
    return Prepared.normalize(self.name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/metadata/__init__.py", line 882, in normalize
    return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/re/__init__.py", line 185, in sub
    return _compile(pattern, flags).sub(repl, string, count)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'NoneType'
List of all installed Python packages accelerate==0.21.0 aiohttp==3.8.5 aiosignal==1.3.1 annotated-types==0.5.0 async-timeout==4.0.2 attrs==23.1.0 beautifulsoup4==4.12.2 blis==0.7.10 boto3==1.28.22 botocore==1.31.22 bpemb==0.3.4 catalogue==2.0.9 certifi==2023.7.22 charset-normalizer==3.2.0 click==8.1.6 cloudpickle==2.2.1 confection==0.1.1 conllu==4.5.3 contourpy==1.1.0 cycler==0.11.0 cymem==2.0.7 datasets==2.14.4 deepmerge==1.1.0 deid==0.3.22 Deprecated==1.2.14 dill==0.3.7 dnspython==2.4.1 easyocr==1.7.0 emoji==1.2.0 en-core-web-trf @ https://github.com/explosion/spacy-models/releases/download/en_core_web_trf-3.6.1/en_core_web_trf-3.6.1-py3-none-any.whl#sha256=f9a1f0ae83954c49ebf92c0f7043ea02de51db59bf6cd3ed849d46928612c806 filelock==3.12.2 flair==0.12.2 fonttools==4.42.0 frozenlist==1.4.0 fsspec==2023.6.0 ftfy==6.1.1 future==0.18.3 gdown==4.4.0 gensim==4.3.1 huggingface-hub==0.16.4 hyperopt==0.2.7 idna==3.4 imageio==2.31.1 Janome==0.5.0 Jinja2==3.1.2 jmespath==1.0.1 joblib==1.3.2 kiwisolver==1.4.4 langcodes==3.3.0 langdetect==1.0.9 lazy_loader==0.3 lxml==4.9.3 MarkupSafe==2.1.3 matplotlib==2.2.3 more-itertools==10.1.0 mpld3==0.3 mpmath==1.3.0 multidict==6.0.4 multiprocess==0.70.15 murmurhash==1.0.9 mysql-connector-python==8.0.28 networkx==3.1 ninja==1.11.1 numpy==1.25.2 opencv-python-headless==4.8.0.74 packaging==23.1 pandas==2.0.3 pathy==0.10.2 pika==1.3.2 Pillow==10.0.0 pip==23.2.1 pptree==3.1 preshed==3.0.8 protobuf==3.19.6 psutil==5.9.5 py4j==0.10.9.7 pyarrow==12.0.1 pyclipper==1.3.0.post4 pydal==20230521.1 pydantic==2.1.1 pydantic_core==2.4.0 pydicom==2.4.2 pylibjpeg==1.4.0 pylibjpeg-libjpeg==1.3.4 pymongo==4.4.1 pyparsing==3.0.9 PySocks==1.7.1 pytesseract==0.3.8 python-bidi==0.4.2 python-dateutil==2.8.2 pytorch_revgrad==0.2.0 pytz==2023.3 PyWavelets==1.4.1 PyYAML==6.0.1 regex==2023.8.8 requests==2.31.0 s3transfer==0.6.1 safetensors==0.3.2 scikit-image==0.21.0 scikit-learn==1.3.0 scipy==1.11.1 segtok==1.5.11 sentencepiece==0.1.99 setuptools==67.6.1 shapely==2.0.1 six==1.16.0 smart-open==6.3.0 soupsieve==2.4.1 spacy==3.6.1 spacy-alignments==0.9.0 spacy-legacy==3.0.12 spacy-loggers==1.0.4 spacy-transformers==1.2.5 sqlitedict==2.1.0 srsly==2.4.7 stanza==1.5.0 sympy==1.12 tabulate==0.9.0 thinc==8.1.11 threadpoolctl==3.2.0 tifffile==2023.7.18 tokenizers==0.13.3 torch==2.0.1 torchvision==0.15.2 tqdm==4.66.0 transformer-smaller-training-vocab==0.2.4 transformers==4.30.2 typer==0.9.0 typing_extensions==4.7.1 tzdata==2023.3 urllib3==1.26.16 wasabi==1.1.2 wcwidth==0.2.6 Wikipedia-API==0.6.0 wrapt==1.15.0 xxhash==3.3.0 yarl==1.9.2
howff commented 1 year ago

Can you change setup.py from setup( stuff ) to mydict = { stuff } and print(mydict) to see what parameters it's passing to setup() ?

Also possibly a bug in python3.11/pip? https://github.com/pypa/pip/issues/11352

darshad-github commented 1 year ago

Can you change setup.py from setup( stuff ) to mydict = { stuff } and print(mydict) to see what parameters it's passing to setup() ?

{'name': 'DicomPixelAnon', 'version': '1.0.37', 'packages': ['DicomPixelAnon'], 'package_dir': {'': '/Users/daniyalarshad/Desktop/pythonProject/dicompixelanon/src/library'}, 'url': 'https://github.com/SMI/DicomPixelAnon', 'license': 'GPLv3', 'description': 'Python modules for Dicom Pixel Anonymisation', 'long_description': 'DicomPixelAnon common modules provide useful functions for anonymisation of text burned into the pixels of DICOM image files.', 'install_requires': ['pydicom', 'pylibjpeg', 'pylibjpeg_libjpeg', 'deid', 'pydal', 'pymongo', 'Pillow', 'pytesseract==0.3.8', 'numpy', 'opencv_python_headless', 'easyocr', 'spacy', 'flair', 'stanza', 'matplotlib==2.2.3']}

Also possibly a bug in python3.11/pip? pypa/pip#11352

Yes, I believe it is due to a bug in python3.11/pip. I've instead used python3.9.1 using the universal installer (which provides a binary optimized to run on both Intel-based Macs and Apple Silicon-based Macs) to successfully run dicom pixel anon scripts.