3 ms·
Most often you won't need to use pip, and `conda install ...` is preferable (for example, pretty much everything on PyPI is mirrored to anaconda.org, and if you
by p4wnc6 11y ago
Most often you won't need to use pip, and `conda install ...` is preferable (for example, pretty much everything on PyPI is mirrored to anaconda.org, and if you ask them to support a well-known package that's not already available, it will be available extremely quickly, and chances are it's already available on some other anaconda.org channel anyway).
You can use pip from within conda as well if you want to, and you can refer to environment-specific pips directly, such as `~/anaconda/envs/my_env_name/bin/pip install ...` to install for the environment my_env_name.
conda can work with pip-styled requirements.txt files as well, and it's easy to either upload your own packages to anaconda.org, or create the conda build metadata (metadata.yaml) with instructions for how to get the package from PyPI if you prefer to only upload to PyPI.
There is an abundance of well-written tutorials and documentation for these things.
- epaulson 11y agoIt'd be really great if conda knew how to fall back to pip, or if the conda skeleton -recursive / conda build / conda install cycle could be collapsed into one command
- p4wnc6 11y agoI'm not sure falling back to pip is a good default. You might rather be alerted to a package's absence on anaconda.org than to have it silently installed elsewhere, for example for use cases when you totally want zero pip installed packages. But I agree there's a lot of opportunity for improvement around the configurability of this sort of thing.
- darkarmani 11y agoIt used to fall back to pip, but it was taken out. It's confusing if you typo the package name and then it tries to find it on PyPI and can't.
- crucialfelix 11y agoThat's good to hear. Why is using conda install preferable ? Is it new infrastructure or something that you think might overtake PyPI ?
- p4wnc6 11y agoWhile conda is newer than virtualenv, pip, and easy_install, it's not really "new." Conda also is orthogonal to the source repository. As I mentioned, you can easily let conda manage the environments of your pip-installed packages. One reason anaconda.org is better is that it's also Python agnostic. There is a main channel for R and R packages, so you can actually manage R environments the same way and R dependencies in a Python project. This could conceivably grow to include many things that pip alone can't help you with. Having built packages both by using the necessary extra setting in a setup.py file, coupled with `python setup.py register` and the PyPI upload commands, and also via the meta.yaml and the anaconda.org upload commands, the latter seems more sensible to me. Putting info into setup.py is a bad thing generally, especially if you do real work in setup.py, like with a complicated Cython package. Placing that info into meta.yaml offers better separation between data and code, and is remarkably easy to use in a cross-platform way with just `conda build`. There's a lot more related to configurability and advanced options, but the above examples have been enough for me to fully use conda and to support other packaging as secondary when necessary.