ConfigurationError: Server at 127.0.0.1:27017 reports wire version 0, but this version of PyMongo requires at least 2 (MongoDB 2.6)

前端 未结 5 1643
没有蜡笔的小新
没有蜡笔的小新 2021-01-05 00:26

I am trying to build an application with mongoDB and Python Flask. While running the application, I am getting below error:

ConfigurationError: Server

相关标签:
5条回答
  • 2021-01-05 00:46

    It's pretty annoying and weird issue.

    But this problem is solved with just downgrading pymongo library for me.

    pip install pymongo==3.4.0
    

    Found answer in this : http://d-prototype.com/archives/10939

    0 讨论(0)
  • 2021-01-05 00:49

    This works for me:

    1. sudo pip3 uninstall pymongo

    2. sudo apt-get install python3-pymongo

    I hope that works for someone else, regards.

    0 讨论(0)
  • 2021-01-05 00:51

    I am having the same issue using version 2.4.10 on a Raspberry Pi 3. I found interesting information here: https://jira.mongodb.org/browse/SERVER-26715

    According to the above Jira task, it seems that this is a bug of MongoDB that was fixed in version 3.4. However, I found that comment stating that 3.4 is not supported on Raspbian because it is a 32-bits OS. This is confirmed here... we can only install 3.2 on Raspbian now apparently.

    An alternative would be to install 64bits SuSE on the Pi or run MongoDB 3.4 in Docker.

    Let me know if you have found something else...

    0 讨论(0)
  • 2021-01-05 00:56

    loose_srv_version = LooseVersion(client.server_info()['version'])

    loose_driver_version = LooseVersion(PyMongoVersion)

    if loose_srv_version >= LooseVersion('3.2') and loose_driver_version <= LooseVersion('3.2'):
        module.fail_json(msg=' (Note: you must use pymongo 3.2+ with MongoDB >= 3.2)')
    
    elif loose_srv_version >= LooseVersion('3.0') and loose_driver_version <= LooseVersion('2.8'):
        module.fail_json(msg=' (Note: you must use pymongo 2.8+ with MongoDB 3.0)')
    
    elif loose_srv_version >= LooseVersion('2.6') and loose_driver_version <= LooseVersion('2.7'):
        module.fail_json(msg=' (Note: you must use pymongo 2.7+ with MongoDB 2.6)')
    
    elif LooseVersion(PyMongoVersion) <= LooseVersion('2.5'):
        module.fail_json(msg=' (Note: you must be on mongodb 2.4+ and pymongo 2.5+ to use the roles param)') 
    
    0 讨论(0)
  • 2021-01-05 00:57

    First you change the server from ubuntu software center follow step

    1- Search Software & update in ubuntu software center

    2- Select Download from select Other then right side select Select best server it will take some time if it's complete

    try to re install mongodb from this command

    Step 1

    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
    

    Step 2

    sudo apt-get update
    

    step 3

    sudo apt-get install -y mongodb-org
    
    0 讨论(0)
提交回复
热议问题