7

Here's my requirements.txt

gensim
tensorflow
...
py-dom-xpath-six

I would like all dependencies to be installed with a single command. However:

conda install -c conda-forge --file requirements.txt

fails with

PackagesNotFoundError: The following packages are not available from current channels:

  - py-dom-xpath-six

It can be installed with pip, though. I don't want to combine conda with pip because of the problems this combination can cause. Using only pip is not an option for libraries like tensorflow.

dzieciou
  • 4,049
  • 8
  • 41
  • 85
  • 1
    One alternative you might find useful is to use conda and/or poetry. Poetry tries to create an environment that satisfies all the requirements of your packages without clobbering accidentally. – PirateNinjas Sep 22 '19 at 13:05
  • 1
    I think this is a poorly-framed question. The cited document includes best practice recommendations for cases when mixing PyPI and Conda are unavoidable. Why can't one of those be followed? The simplest is to use a YAML definition to create the environment, and if one ever needs to alter the env, then edit the YAML and recreate. To only use Conda, then one can convert the PyPI package to a Conda and either upload to Conda Forge or an Anaconda Cloud user channel. Again, that is a suggestion included in the cited article. – merv Sep 22 '19 at 15:04
  • 1
    @merv You're right. I should've probably try out all suggestions from the linked article before posting a question. My initial understanding was that I need to create `conda-requirements.txt` and `pip-requirements.txt`, but from your YAML suggestion I can see it can combine both in a single file: https://stackoverflow.com/questions/35245401/combining-conda-environment-yml-with-pip-requirements-txt. Thanks! – dzieciou Sep 22 '19 at 16:11
  • @merv Regarding another suggestion. I could upload missing packages to conda, but then I would need to do that every time the original author uploads new version to PyPI. That's not something I would like to take care of. – dzieciou Sep 22 '19 at 16:12
  • 1
    @dzieciou yes it is some commitment. Although, I think there is some automation for packages for which conda skeleton works. E.g., I've seen feedstocks on Conda Forge that have auto-PRs from when new versions of the package get pushed to PyPI. Then its just matter of testing and approving the PR. – merv Sep 22 '19 at 16:21

0 Answers0