I have two packages that install different packages with the same name. They are both "packages" in that they have top-level setup.py
files which specify package=['foo']
in the setup
command.
If I install using distutils.core
, the last to be installed overwrites the previous one (but I think wouldn't overwrite unless the .py files all had the same names?). If I install using setuptools
, the two packages get installed into different eggs.
One option would be to explicitly set sys.path
before importing the package name; this seems "un-pythonic" and rather dirty.
Assuming I have these two identically named packages installed in different eggs
from setuptools, how do I specify which is imported?
Setuptools guide mentions --multi-version (-m) switch that removes package from sys.path completely. You have to use pkg_resources.require('package==version') in your code as early as possible to let it fix sys.path. This advice is what easy_install always prints when one uses -m.
But you can't have both imported at once (unless they're designed to do so using namespace packages).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With