1

I am authoring python package A.

Optimally my package would use some tools from the third party package B.

However, I know that package B fails to install on some systems and I have included as a backup into A a less efficient way to do the same things package B does.

Is there a way to write my setup.py such that

1) When package A is installed, an attempt is made to install package B as well

2) If the attempt to install B fails, the installation of A continues as if nothing happened (maybe at most a warning is printed)

Bananach
  • 2,016
  • 26
  • 51
  • https://stackoverflow.com/questions/14750711/catch-python-importerror-if-import-from-source-directory might want to look into something like that – WilomGfx Jul 28 '19 at 15:52
  • @WilomGfx I don't see how that applies to what I need – Bananach Jul 28 '19 at 15:54
  • Well if you can't import said package... it 's not installed, so you import yours as mentioned ? – WilomGfx Jul 28 '19 at 17:41
  • @WilomGfx I'm asking a question about the packaging process. I am the package author. I want my package to work for all my clients, no matter their OS. I want them to be able to `pip install A` and get the best performance automatically. I cannot just check whether `B` is installed at runtime because it won't be unless I add it as a requirement to `setup.py` but I cannot add it as a requirement to `setup.py` because it will break the installation for some of my clients. – Bananach Jul 28 '19 at 17:45

0 Answers0