image-match icon indicating copy to clipboard operation
image-match copied to clipboard

SignatureMongo problem with python3

Open einali opened this issue 7 years ago • 3 comments

for import

`from pymongo.mongo_client import MongoClient

from os import listdir from os.path import isfile, join from image_match.goldberg import ImageSignature from image_match.signature_database_base import make_record from image_match.mongodb_driver import SignatureMongo`

there is this error:

Traceback (most recent call last): File "/home/mehdi/ws/temp/image_match/src/sample3.py", line 7, in <module> from image_match.mongodb_driver import SignatureMongo File "/home/mehdi/venvs/image_match/lib/python3.5/site-packages/image_match/mongodb_driver.py", line 1, in <module> from signature_database_base import SignatureDatabaseBase ImportError: No module named 'signature_database_base'

in file image_match/mongodb_driver.py

changing from signature_database_base import SignatureDatabaseBase from signature_database_base import normalized_distance from multiprocessing import cpu_count, Process, Queue from multiprocessing.managers import Queue as managerQueue import numpy as np

to from .signature_database_base import SignatureDatabaseBase from .signature_database_base import normalized_distance from multiprocessing import cpu_count, Process, Queue from multiprocessing.managers import Queue as managerQueue import numpy as np

other error occurs : Traceback (most recent call last): File "/home/mehdi/ws/temp/image_match/src/sample3.py", line 7, in <module> from image_match.mongodb_driver import SignatureMongo File "/home/mehdi/venvs/image_match/lib/python3.5/site-packages/image_match/mongodb_driver.py", line 4, in <module> from multiprocessing.managers import Queue as managerQueue ImportError: cannot import name 'Queue'

einali avatar Jun 01 '17 07:06 einali

Hi @einali

I haven't maintained the MongoDB portion of the code, it's mostly there as an example at this point. Is there some reason you can't use the Elasticsearch backend?

rhsimplex avatar Jun 01 '17 11:06 rhsimplex

Hi everyone.

I've also met the same problem. It's just convenient to have an ability to use mongo backend. We have several mongo clusters in our project and it'd be cool to add a new one instead of using elastic for that single task.

phoenix-mstu avatar Aug 24 '18 12:08 phoenix-mstu

Hi @phoenix-mstu I solved this problem by simply comment "from multiprocessing.managers import Queue as managerQueue" and replace managerQueue.Queue() with Queue().

wingloong avatar Dec 18 '19 03:12 wingloong