3

I have the following problem. I have tried to install the pydicom package in python 2.7 using the following command (windows, anaconda setup):

conda install -c conda-forge pydicom

everything seems to work fine, the package seems to be installed. I type

conda list

and in the list I see

pydicom                   0.9.8                     <pip>

I open spyder, or pycharm, type

import pydicom

and I get

ImportError: No module named pydicom

I have no idea what am I doing wrong. I went through http://conda.pydata.org/docs/using/pkgs.html and everything seems to be fine.

Please assist.

Suever
  • 64,497
  • 14
  • 82
  • 101
Eli
  • 81
  • 1
  • 6
  • Use a virtualenv. In PyCharm add the reference to this virtualenv. – Laurent LAPORTE Oct 16 '16 at 21:30
  • Does it work with `python -c "import pydicom"`? – ostrokach Oct 16 '16 at 22:02
  • Also, it's weird that it says `` if you installed from conda-forge. Maybe try: `conda uninstall pydicom`, `pip uninstall pydicom` (repeat until no package found), and then `conda install -c conda-forge pydicom`? – ostrokach Oct 16 '16 at 22:05
  • After you do @ostrokach's suggestion, and confirm that `pydicom` is working when using the python in your command prompt, then you probably need to adjust the python that your pycharm/spyder is using. – Paul Oct 18 '16 at 12:42

2 Answers2

3

Since you are using 0.9.8, you actually need import dicom rather than import pydicom.

Due to this confusion, it will be import pydicom in version 1.0.0 and later.

Suever
  • 64,497
  • 14
  • 82
  • 101
0

I suggest you either update Python Version > 3.0, so that the output for conda list shows something like this:

(pip install pydicom)

pydicom                   1.0.2                     <pip>
python                    3.6.4                h6538335_1

Now import using:

import pydicom #Preferable 

==========================================================

Or install dicom instead of pydicom using:

(pip install pydicom-0.9.8)

pydicom                   0.9.8                    <pip>
python                    2.7.0                h6538335_1

And then, import using:

import dicom

However, I strongly suggest that you install pydicom instead of dicom, since it is the upgraded version.

Vartika Sharma
  • 269
  • 1
  • 3
  • 10