PyCharm (1.5.4) and Panadas 0.6.0 - ImportError: No module named data

1,121 views
Skip to first unread message

s

unread,
Nov 26, 2011, 10:43:37 PM11/26/11
to pystat...@googlegroups.com
I am using PyCharm (1.5.4) as my python IDE on MacOS 10.6.4. I recently
installed pandas 0.6.0 on a EPD 7.1 distribution of python.

I wrote some code to import the DataReader function in pandas.io.data

from pandas.io.data import DataReader

Unfortunately, PyCharm is unable to resolve 'data'. I get the following
error:

Traceback (most recent call last):
File "/Users/MyName/PycharmProjects/test/mytest", line 3, in <module>
from pandas.io.data import DataReader
ImportError: No module named data

What is puzzling is that PyCharm can resolve pandas.stats.moments but
can't resolve pandas.io.data. I checked that both directories have the
__init__.py file (the files are blank).

Based on ThomasK (from stackoverflow) recommendation I checked to see
what version of pandas PyCharm was loading. It appears its still loading
v 0.3.0 despite the fact that I wiped this version out prior to
installing pandas 0.6.0.

I did some digging and realized that the __egginst__.txt file had
references to the old version:

$ cat __egginst__.txt
# egginst metadata
egg_name = 'pandas-0.3.0-3.egg'
prefix = '/Library/Frameworks/EPD64.framework/Versions/7.1'
installed_size = 1454562
rel_files = [
'EGG-INFO/pandas/__egginst__.txt',
'lib/python2.7/site-packages/pandas-0.3.0-3.egg-info',

At this point I'm wondering whether the pandas 0.6.0 install from source
on MacOS would update this file? Is PyCharm using the __egginst__.txt
file? Is the solution as simple as editing this file and making the
appropriate changes or is there something more involved?

Appreciate the feedback.

Kind Regards,
Sp


s

unread,
Nov 26, 2011, 10:50:18 PM11/26/11
to pystat...@googlegroups.com
The 'depend' file in

/Library/Frameworks/EPD64.framework/Versions/7.1/EGG-INFO/pandas/spec

also has reference to the old pandas version.

$ cat depend
metadata_version = '1.1'
name = 'pandas'
version = '0.3.0'
build = 3

arch = 'amd64'
platform = 'darwin'
osdist = None
python = '2.7'
packages = [
'numpy 1.6.1',
'python_dateutil',
'scikits.statsmodels',


Wes McKinney

unread,
Nov 26, 2011, 10:52:09 PM11/26/11
to pystat...@googlegroups.com

A bug in PyCharm perhaps? Are you able to import the new library in
IPython or the regular Python interpreter? (import pandas; print
pandas.__version__). You might also delete the pandas 0.3.0 egg if it
exists? Various people seem to be having trouble occasionally
installing on top of EPD and I wonder if EPD has some tricks under the
hood for enpkg that are screwing things up. Editing "private" files
like that is not something I'd recommend to anyone.

Wes McKinney

unread,
Nov 26, 2011, 10:54:08 PM11/26/11
to pystat...@googlegroups.com

Must be some kind of EPD specific thing (I use EPD 64-bit on OS X too
but I run pandas in "develop" mode).

s

unread,
Nov 26, 2011, 11:18:51 PM11/26/11
to pystat...@googlegroups.com
Using IPython or the regular interpreter imported v 0.6.0. So I deleted
the configuration in PyCharm and reloaded the interpreter in PyCharm. It
now loads v 0.6.0. I have not modified any of EPD's files as per your
suggestion. So far so good.... let the fun begin! Thank you Wes for
all of your help!

Robert Kern

unread,
Nov 27, 2011, 6:49:20 AM11/27/11
to pystat...@googlegroups.com

I don't think so. The pandas/ directory in site-packages is the only
place where the old code would be. If the OP really wiped it out and
installed a new version, then pandas.__version__ would not report the
old version. The metadata is only important to the package manager,
not runtime imports. Perhaps PyCharm was not configured to use EPD,
but rather a different Python that had an old pandas installed, too?

For future reference, the best way to remove an EPD egg cleanly is the
following:

$ enpkg --remove pandas

I recommend doing so before installing newer versions of things that
come packaged with EPD.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco

Reply all
Reply to author
Forward
0 new messages