1

I'm trying to connect my database with my code using MongoDB on replit and make a custom prefix command but it gives me a version error when i import motor and saying

import pymongo
from pymongo import MongoClient
import motor

Using version ^2.5.1 for motor

Updating dependencies
Resolving dependencies...

  SolverProblemError

  Because no versions of motor match >2.5.1,<3.0.0
   and motor (2.5.1) depends on pymongo (>=3.12,<4), motor (>=2.5.1,<3.0.0) requires pymongo (>=3.12,<4).
  So, because repl-python3-xynox-py depends on both pymongo (^4.0.1) and motor (^2.5.1), version solving failed.

  at /opt/virtualenvs/python3/lib/python3.8/site-packages/poetry/puzzle/solver.py:241 in _solve
      237│             packages = result.packages
      238│         except OverrideNeeded as e:
      239│             return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
      240│         except SolveFailure as e:
    → 241│             raise SolverProblemError(e)
      242│ 
      243│         results = dict(
      244│             depth_first_search(
      245│                 PackageNode(self._package, packages), aggregate_package_nodes
exit status 1


Replit: Package operation failed.


Is there any solution to this, i really wanna use mongodb as my database...

TalhaIqbal
  • 15
  • 3

1 Answers1

0

Try to uninstall motor and pymongo and then install motor (It will install the correct versión of pymongo

Or you can install the specific versión of each package:

pip install PACKAGE==VERSION

pip install motor==2.5.1
pip install pymongo==3.12.3
zelmario
  • 96
  • 5