Which Python package manager should you use?
Many who touch the code have different preferences when it comes to their programming environment. Vim vs Emacs. Places against tabs. Virtualenv vs Anaconda. Today I want to work with you and share my environment data for machine learning.
You definitely don't have to copy my setup, but a few bits of it can serve as a useful inspiration for your development environment.
Pip
First, we have to talk about pipes. Pip is Python's package manager. It's been built on Python for a while now, so if you have Python, you've probably installed the pipe.
Pip installs packages such as TensorFlow and Nampi, Ponds and Jupiter, and more, with their dependencies.
Pipe installation <your_Liveite_library>
Many Python resources are distributed as pipe packages. Sometimes you need a file in a Python script folder. txt. Typically, that file outlines all the pipe packages that the project uses, and you can install everything in that file using.
Pipe installation -r requirements. txt.
As part of this ecosystem, the version is full of numbers and dependencies. Sometimes I need to use different versions of the library I'm working on, so I need a way to organize groups of packages into different, isolated environments.
Web development and data signing on the same machine can leave your Python packages in disarray.
There are currently two popular options for managing your various pipe packages: VirtualEnV and Anaconda.
Virtualenv
Virtualenv is a package that allows you to create the name "Virtual Environment", where you can install pipe packages differently.
This tool is perfect if you want to take detailed control of what packages you install for each environment you create. For example, you can create a different environment for web development, and data science, with a set of libraries.
This way you don't have to have unrelated libraries interact with each other, and this allows you to create a dedicated environment for specific purposes.
Anaconda
Now, if you are primarily working in data science, the anaconda is also a great option. Anaconda is created by Continuum Analytics, and it is a Python distribution that is preloaded with many useful Python libraries for data science.
Anaconda is popular because it brings many tools used in data science and machine learning with just one installation, so it's perfect for short and simple setups.
Like Virtualenv, Anaconda also uses the concept of environment creation to keep various libraries and editions away. Anaconda introduces its own package manager, called Conda, from which you can set up the library.
Additionally, Anaconda still has a user interaction with Pip that allows you to install any additional libraries that are not available in the Anaconda Package Manager.
How to choose
So ... which one do I use, VirtueLev, or Anaconda? Well, I'm mostly testing newer versions of Tangerflow and other libraries, both Python 2 and Python Across.
Ideally, I would also be able to use libraries in both Virtuelev and Anaconda, but sometimes these two package managers don't play well.
Meet Pyenv
So I chose to use both, and manage the whole thing using a library called pyenv. As a concept, pyenv is on top of both virtualenv and anaconda, and it can only be used to control whether a virtual environment or anaconda environment is used, but it easily controls whether I am running Python 2 or Python running.
One last aspect of Pyenv that I enjoy is the ability to set the default environment for a given directory. This is due to the automatically enabled environment when I enter a directory entry. I found it much easier than trying to remember what environment I wanted to use each time I worked on the project.
Which Python package manager should you use? It really comes down to your workflow and priorities.
If you usually only use core data science tools and aren't worried about having a few more libraries installed that you don't use, Anaconda might be a great option, as it brings you a simple workflow for your needs and preferences.
But, if you are someone who loves to customize your environment and make it exactly what you like, then something like a virtual or piano might be more to your liking.
Wrap
There is no one-size-fits-all way to manage Python libraries, and there are definitely more than just the options I just presented.
As different tools come and go, it is important to remember that everyone has their own needs and preferences and cases, so you will have to choose for yourself what tools are there to serve you.
What does your Python environment look like, and how can you keep it out of control? Share your setup in the comments below!
Comments
Post a Comment
If you have any doubts. Please let me know.