AIM-Harvard / pyradiomics

Open-source python package for the extraction of Radiomics features from 2D and 3D images and binary masks. Support: https://discourse.slicer.org/c/community/radiomics
http://pyradiomics.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.14k stars 493 forks source link

Installed successfully yesterday but cannot run it today #529

Closed divinediu closed 2 years ago

divinediu commented 5 years ago

Hi, I tried installed both via pip and by git clone. All the commands run successfully, no error. But I can't seem to run it!

If I run via command line, I get this:

MAHEUNIX@WGSHA-LAB-005:~$ pyradiomics -h
Traceback (most recent call last):
  File "/usr/local/bin/pyradiomics", line 11, in <module>
    load_entry_point('pyradiomics==2.2.0.post27+g9e6d486', 'console_scripts', 'pyradiomics')()
  File "/home/MAHEUNIX/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/MAHEUNIX/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
    return ep.load()
  File "/home/MAHEUNIX/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2443, in load
    return self.resolve()
  File "/home/MAHEUNIX/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ModuleNotFoundError: No module named 'radiomics.scripts'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "/usr/local/bin/pyradiomics", line 11, in <module>
    load_entry_point('pyradiomics==2.2.0.post27+g9e6d486', 'console_scripts', 'pyradiomics')()
  File "/home/MAHEUNIX/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/MAHEUNIX/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
    return ep.load()
  File "/home/MAHEUNIX/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2443, in load
    return self.resolve()
  File "/home/MAHEUNIX/.local/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
ModuleNotFoundError: No module named 'radiomics.scripts'
MAHEUNIX@WGSHA-LAB-005:~$

When I run via jupyter, I get this


ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-c68babeddd90> in <module>
      1 # Radiomics package
----> 2 from radiomics import featureextractor
      3 
      4 import six, numpy as np

ModuleNotFoundError: No module named 'radiomics'

However, yesterday, I was able to run pyradiomicsbatch


MAHEUNIX@WGSHA-LAB-005:~/pyradiomics$ pyradiomicsbatch /mnt/d/Radio/test.csv /mnt/d/Radio/radioutput.xlsx
This entry point is deprecated. It's enhanced functionality for batch extraction is now available in the "pyradiomics" entry point. See "http://pyradiomics.readthedocs.io/en/latest/usage.html" for more details.
GLCM is symmetrical, therefore Sum Average = 2 * Joint Average, only 1 needs to be calculated

My python version:

MAHEUNIX@WGSHA-LAB-005:~$ python -V
Python 3.6.8

I am using Ubuntu WSL in windows OS.

JoostJM commented 5 years ago

If you check this /home/MAHEUNIX/.local/lib/python3.6/site-packages folder, can you find the radiomics package? If so, does it contain the PyRadiomics files (i.e. a base.py, imageoperations.py, etc).

If it does not contain the folder radiomics, then please try to reinstall using pip (ensure you are using the correct pip/python, maybe you installed using pip install pyradiomics, which may have installed PyRadiomics for Python2 instead of Python3. If so, try pip3 install pyradiomics.

If it does contain the folder radiomics, but appears to have different files in it; this is possible, there is another radiomics package out there that also installs itself as module radiomics, but is off course different from PyRadiomics. uninstall the other radiomics (pip uninstall radiomics) and re-install pyradiomics.

JoostJM commented 4 years ago

@divinediu, Did you solve this issue?

psarthak36 commented 3 years ago

I tried solving the same issue on Jupyter, and I am running on Windows 10. I checked the site-packages folder and reinstalled pyradiomics via pip3. I am running python3.9 and the pyradiomics installation was complete via command prompt and execution of single image feature extraction was successful, but it is not working on Jupyter when importing. The same import issue crops up, that there is no such module. Please help.

JoostJM commented 2 years ago

@psarthak36, that is probably because your jupyter kernel runs a different version of Python than the one you installed PyRadiomics in. Check and compare executables to be sure. The fact that you were able to run the CLI just fine means there is no issue with the installation of PyRadiomics.