Recommand · December 8, 2021 0

How do you favor one package if both packages share the same module name?

So two packages have the same module name, docopt and docopt-ng both export docopt – when there is a dependency, e.g.

pipenv install pip-upgrader docopt-ng

When you attempt to import

import docopt

You get one of the two, but not the one I want today. Is there a trick to get the importer to import the other module (the one in docopt-ng)?

Things that didn’t work:

$ python -c "from docopt-ng import docopt; print(docopt.__file__)"

  File "<string>", line 1
    from docopt-ng import docopt; print(docopt.__file__)