roskakori / cutplace

validate data stored in CSV, PRN, ODS or Excel files
http://cutplace.readthedocs.org/
GNU Lesser General Public License v3.0
18 stars 20 forks source link

ImportError: No module named xlrd #50

Closed murphyke closed 9 years ago

murphyke commented 11 years ago

A coworker complained about this, so I tried it myself. When I try to pip-install cutplace in a fresh virtual environment, I get "ImportError: No module named xlrd". I see xlrd specified as a requirement in cutplace's setup.py, however, so I don't understand what's going on. Apologies if this is some sort of configuration error on my side. Disclaimer: I'm not a Python guru.

Versions: Python 2.7.2, setuptools 0.6c11, pip 1.3.1 (from running python in the activated environment, importing setuptools and pip and printing them). Mac OS X 10.7, BTW.

pip install -r requirements.txt 
Downloading/unpacking cutplace (from -r requirements.txt (line 1))
  Downloading cutplace-0.7.1.zip (580kB): 580kB downloaded
  Running setup.py egg_info for package cutplace
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/Users/Me/Documents/code/python/test-env/build/cutplace/setup.py", line 33, in <module>
        from cutplace import _cutplace
      File "cutplace/_cutplace.py", line 26, in <module>
        import xlrd
    ImportError: No module named xlrd
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/Users/Me/Documents/code/python/test-env/build/cutplace/setup.py", line 33, in <module>

    from cutplace import _cutplace

  File "cutplace/_cutplace.py", line 26, in <module>

    import xlrd

ImportError: No module named xlrd
roskakori commented 11 years ago

xlrd is intended to be required only if you need Excel format, nevertheless cutplace always tries to import it. Apparently this is a bug that should be fixed.

As a workaround, try this:

$ pip install --upgrade xlrd
$ pip install --upgrade cutplace
leipzig commented 11 years ago

to clarify this occurs because setup.py imports cutplace/_cutplace.py which in turns imports xlrd before the install_requires is encountered

if you comment out that import and replace _cutplace.DESCRIPTION variable in setup.py with a hard-coded "validate data stored in CSV, PRN, ODS or Excel files", the installation works fine

roskakori commented 11 years ago

Fixed in repository, scheduled for release sometime next week.

murphyke commented 10 years ago

Just wondering if 0.7.2 is going to be released with that import fix.

roskakori commented 9 years ago

0.7.2 is cancelled, the code was just was too screwed up in too many ways.

The fix has been rescheduled to 0.8.0, which brings to the code base back to a solid state. As part of #74 the dependency handling has already moved to a clean setup.py provided by pyscaffold and validated by Travis CI, see https://travis-ci.org/roskakori/cutplace.

roskakori commented 9 years ago

0.8.x is live, so this is finally fixed for good.