scrapinghub / mdr

A python library detect and extract listing data from HTML page.
109 stars 29 forks source link

ImportError: cannot import name 'MDR' #3

Closed dportabella closed 7 years ago

dportabella commented 7 years ago
docker run -ti python bash
apt-get update
apt-get install -y python-numpy cython python-scipy
git clone https://github.com/scrapinghub/mdr.git
cd mdr
pip install -r requirements.txt
python setup.py build
python setup.py install
python tests/test_mdr.py

Traceback (most recent call last):
  File "tests/test_mdr.py", line 3, in <module>
    from mdr import MDR, Record
  File "/usr/local/lib/python3.6/site-packages/mdr-0.0.1-py3.6-linux-x86_64.egg/mdr/__init__.py", line 1, in <module>
    from mdr import MDR, Record, RecordFinder, RecordAligner
ImportError: cannot import name 'MDR'
dportabella commented 7 years ago

ok, this error does not appear if using python 2. so, use this instead: docker run -ti python:2.7.13 bash

could you please add in your README.md the dependency to python2?

ghost commented 7 years ago

Hey @dportabella - I'm working on a port from Cython to Rust for this lib, which would enable use of Py2 or Py3 without issue. I'm currently trying to figure out a good packaging solution; probably one of rust-python-ext or setuptools-rust.

I'm curious: would a Rust dependency (instead of Cython) to build the library be a problem for you? I'm mostly doing this for fun, though I think there's room for performance improvements by moving more of the logic into pure rust over time.

dportabella commented 7 years ago

hi @cathalgarvey, a rust dependency would not be a problem for me. thx for sharing this project!

ghost commented 7 years ago

Well the project isn't mine, I'm just hacking on it as an experiment in merging Rust and Python. :) But, I think the union would be nice in this case.

Hopefully I have time to finish it soon, I'm afraid I'm swamped with other work at present.

dportabella commented 7 years ago

@cathalgarvey, are you using this software to extract data? if so, do you know the answer to my question here? https://github.com/scrapinghub/mdr/issues/5