In a word, Anaconda comes with a library of scientific calculations in addition to Python itself from the beginning. It has also been devised to simplify package management and deployment and comes with a package management command called conda.
The Python world has long come with its own package management tools, which used to be EasyInstall, and you'll need to use pip later. I had to set it up. It was troublesome one by one. Python nowadays comes with pip by default, which is the best time. With this command, you can install the package published on the site called PyPI via the Internet with the command. It's the best time.
Now, a common story is the discourse that "breaks" when conda and pip are used together. I'm not sure what it claims to break, but it's unusual to put it in the same package with conda or pip in the first place. It's not the package management system that's broken, but rather your head trying to do something incoherent.
Don't get me wrong, Anaconda puts the package in by typing the basic conda command, but you can also use pip. The former conda is entered from the Anaconda repository. The latter pip comes from PyPI. Of course, the latter has more packages. Also, PyPI doesn't have a review, so anyone can be a package author. In the extreme, even if you write strange source code and publish it on PyPI, no one has checked it. If you package source code that you only use for your project and put it on your PyPI, no one will tell you.
On the other hand, Anaconda's repository is managed by the company, so I think I'm checking it as it is, but I'm not a person inside, so I'm not going to guarantee "I'm checking!".
There is also a community-run repository called conda-forge, which you can also enter with conda. But at the time of using it, it seems that it is a product of the community after all.
To put it bluntly, the dependencies between packages depend on the author's convenience, so no one looks around the entire Python world and rigorously examines those relationships. It depends on you who use it.
This kind of discussion has been around for a long time not only in Python but also in Ruby's package management system, for example, and after all, everyone makes packages as they like, so Freedom. Open source is such a thing. I think the atmosphere is such that the user should verify it.
I personally think that it is only Debian stable version that thoroughly verifies the dependencies between packages and maintains the quality.
As the package maintainer and author know, when registering with PyPI, write various meta information in the package distribution file.
So, how to check the dependency information can be displayed with the following command.
pip install pipdeptree #Put in with pip
pipdeptree -p <package name>
For example, here are some examples of packages called pandas for each version.
pandas==0.16.2
- numpy [required: >=1.7.0, installed: 1.11.2]
- python-dateutil [required: >=2, installed: 2.6.0]
- six [required: >=1.5, installed: 1.10.0]
- pytz [required: >=2011k, installed: 2016.7]
pandas==0.22.0
- numpy [required: >=1.9.0, installed: 1.13.3]
- python-dateutil [required: >=2, installed: 2.6.1]
- six [required: >=1.5, installed: 1.11.0]
- pytz [required: >=2011k, installed: 2017.2]
This will give you an idea of which package depends on which version of which package.
A common accident is that you manage it with conda, but you unintentionally put it in with pip. So duplicate packages can be viewed with the one-liner below.
conda list | cut -d ' ' -f 1 | sort | uniq -d
It's a good idea to check occasionally to make sure there are no duplicates.
That's why it became longer, but in summary
-Anaconda's package management comes with the conda and pip commands. -Basically, use conda to refer to the Anaconda repository. ・ If it is not in conda, use pip to enter it. -Occasionally check for duplicates, and if there are duplicates, give priority to conda.
You should build the target environment with reference to these.
I think it looks like this. I admit any objections, so I would appreciate your opinions. It's rough, but that's it.
Recommended Posts