2

I am working on a setup.py file for a Python package. I want to include the package "rdkit" among the "install_requires" dependencies of my package. However, that does not work, as rdkit cannot be directly pip-installed. My preferred method in this case is to use conda (https://anaconda.org/rdkit/rdkit).

Is there a way to automate the installation (or upgrade) if required of a package using conda in a setup.py file, similarly to what install_requires does for pip-installable dependencies?

Thank you very much for your help

setup(
...
  install_requires=[
      'numpy >= 1.8.0',
      'scipy >= 1.6.1',
      ],
)
Vincent
  • 105
  • 7

1 Answers1

2

Is there a way to automate the installation (or upgrade) if required of a package using conda in a setup.py file…?

Nop, no way. setup.py is intended for python setup.py install or pip install and it doesn't know anything about conda.

Perhaps it should be solved the other way — starting from conda that then calls pip install to install pip-installable packages.

phd
  • 82,685
  • 13
  • 120
  • 165
  • Thank you for the info phd. Perhaps as a workaround: is there a way to specify some lines of code that should be run only once when a package is pip installed? Perhaps adding the code lines in setup.py before the call to the setup function or something of that sort? – Vincent Jul 15 '21 at 13:04
  • 1
    @Vincent Not with wheels, possible with sdist. See https://stackoverflow.com/a/36902139/7976758 Found in https://stackoverflow.com/search?q=%5Bpip%5D+post-install+script – phd Jul 15 '21 at 13:33