pydicom module not found by python

14,459

Solution 1

The pydicom package is importable as dicom until version 0.9.9. The documentation on read the docs is for the unreleased master branch version 1.0, in which the package name has changed to pydicom.

Thus, try importing pydicom as:

import dicom

If you need to read a file, you can use the command:

ds = dicom.read_file('filename.dcm')

Once pydicom 1.0 is released, you can follow the wiki page for porting instructions.

Solution 2

You can us pip:

pip install pydicom

Conda works with pip.

Solution 3

If you use pydicom version < 1.0 then you should use import dicom. But if you use pydicom version >= 1.0 then you should install dicom first, then you can import pydicom.

Share:
14,459
Linda Marsh
Author by

Linda Marsh

Updated on June 04, 2022

Comments

  • Linda Marsh
    Linda Marsh almost 2 years

    The error message:

    In [1]:

    import pydicom as dicomio
    ---------------------------------------------------------------------------
    ImportError                               Traceback (most recent call last)
    <ipython-input-1-102814c2908e> in <module>()
    ----> 1 import pydicom as dicomio
    
    ImportError: No module named pydicom
    

    To install pydicom I used

    conda skeleton pypi pydicom
    conda build pydicom
    

    Then uploaded to binstar and used conda install -c to download and install it again. It can now be seen in the anaconda environment.

    Lindas-iMac:~ iMacLinda$ conda list -e | grep pydi
    pydicom=0.9.9=py27_0
    

    Thank you for your help.