scrapinghub / mdr

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

No module named _tree #2

Open whatsdis opened 10 years ago

whatsdis commented 10 years ago

git clone https://github.com/scrapinghub/mdr.git . 2025 ls 2026 nano requirements.txt 2027 pip install -r requirements.txt 2028 sudo apt-get install python-numpy 2029 sudo apt-get install cython 2030 sudo apt-get install python-scipy 2031 python setup.py build 2032 python setup.py install --user 2033 nano test.py 2034 python test.py 2035 ls 2036 ./update_c.sh 2037 python test.py 2038 python setup.py build 2039 python setup.py install --user 2040 python test 2041 python test.py 2042 ls 2043 nano setup.py 2044 python setup.py install 2045 python test.py 2046 ls 2047 nano CHANGES.txt 2048 ls 2049 python test.py 2050 history

Traceback (most recent call last): File "test.py", line 2, in from mdr import MDR File "/root/mdr/mdr/init.py", line 1, in from mdr import MDR, Record, RecordFinder, RecordAligner File "/root/mdr/mdr/mdr.py", line 13, in from ._tree import tree_size ImportError: No module named _tree

sicklife commented 7 years ago

same error

dportabella commented 7 years ago

finally, this works for me:

docker run -ti python:2.7.13 bash
apt-get update && apt-get install -y python-numpy cython python-scipy
cd
git clone https://github.com/scrapinghub/mdr.git
cd mdr
pip install -r requirements.txt
python setup.py build
python setup.py install

# let's move away from this dir, otherwise it would fail with ImportError: No module named _tree
cd
cp -r mdr/tests .
# -m: use it as a library, so that it reads the get_page def from tests/__init__.py
python -m tests.test_mdr

.....
----------------------------------------------------------------------
Ran 5 tests in 2.689s

OK
chiptus commented 7 years ago

@dportabella method worked for me too

kyky98 commented 5 years ago

C:\Users\emoky\OneDrive\Desktop\test\mdr-master\mdr-master>py -2 -m setup.py install running install running bdist_egg running egg_info writing requirements to mdr.egg-info\requires.txt writing mdr.egg-info\PKG-INFO writing top-level names to mdr.egg-info\top_level.txt writing dependency_links to mdr.egg-info\dependency_links.txt reading manifest file 'mdr.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'mdr.egg-info\SOURCES.txt' installing library code to build\bdist.win-amd64\egg running install_lib running build_py running build_ext creating build\bdist.win-amd64\egg creating build\bdist.win-amd64\egg\mdr copying build\lib.win-amd64-2.7\mdr\mdr.py -> build\bdist.win-amd64\egg\mdr copying build\lib.win-amd64-2.7\mdr\tree.py -> build\bdist.win-amd64\egg\mdr copying build\lib.win-amd64-2.7\mdr\utils.py -> build\bdist.win-amd64\egg\mdr copying build\lib.win-amd64-2.7\mdr_tree.pyd -> build\bdist.win-amd64\egg\mdr copying build\lib.win-amd64-2.7\mdr__init.py -> build\bdist.win-amd64\egg\mdr byte-compiling build\bdist.win-amd64\egg\mdr\mdr.py to mdr.pyc byte-compiling build\bdist.win-amd64\egg\mdr\tree.py to tree.pyc byte-compiling build\bdist.win-amd64\egg\mdr\utils.py to utils.pyc byte-compiling build\bdist.win-amd64\egg\mdr\init.py to init__.pyc creating stub loader for mdr_tree.pyd byte-compiling build\bdist.win-amd64\egg\mdr_tree.py to _tree.pyc creating build\bdist.win-amd64\egg\EGG-INFO copying mdr.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO copying mdr.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO copying mdr.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO copying mdr.egg-info\requires.txt -> build\bdist.win-amd64\egg\EGG-INFO copying mdr.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO writing build\bdist.win-amd64\egg\EGG-INFO\native_libs.txt zip_safe flag not set; analyzing archive contents... creating 'dist\mdr-0.0.1-py2.7-win-amd64.egg' and adding 'build\bdist.win-amd64\egg' to it removing 'build\bdist.win-amd64\egg' (and everything under it) Processing mdr-0.0.1-py2.7-win-amd64.egg Removing c:\python27\lib\site-packages\mdr-0.0.1-py2.7-win-amd64.egg Copying mdr-0.0.1-py2.7-win-amd64.egg to c:\python27\lib\site-packages mdr 0.0.1 is already the active version in easy-install.pth

Installed c:\python27\lib\site-packages\mdr-0.0.1-py2.7-win-amd64.egg Processing dependencies for mdr==0.0.1 Searching for lxml==4.3.3 Best match: lxml 4.3.3 Adding lxml 4.3.3 to easy-install.pth file

Using c:\python27\lib\site-packages Finished processing dependencies for mdr==0.0.1 C:\Python27\python.exe: No module named setup.py

C:\Users\emoky\OneDrive\Desktop\test\mdr-master\mdr-master>py -2 -m tests.test_mdr Traceback (most recent call last): File "C:\Python27\lib\runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "C:\Python27\lib\runpy.py", line 72, in _run_code exec code in run_globals File "C:\Users\emoky\OneDrive\Desktop\test\mdr-master\mdr-master\tests\test_mdr.py", line 3, in from mdr import MDR, Record File "mdr__init__.py", line 1, in from mdr import MDR, Record, RecordFinder, RecordAligner File "mdr\mdr.py", line 13, in from ._tree import tree_size ImportError: No module named _tree