• Skip to main content
  • Skip to secondary menu
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • Crypto Currency
  • Technology
  • Contact
NEO Share

NEO Share

Sharing The Latest Tech News

  • Home
  • Artificial Intelligence
  • Machine Learning
  • Computers
  • Mobile
  • Crypto Currency

How to Setup Python For Machine Learning

December 21, 2020 by systems

Anaconda allows us to create different instances of Python called environments. After installing Anaconda, we have a single core environment called base.

We see this environment name whenever we open Anaconda prompt.

Nothing is stopping us from installing new Python packages (such as Pandas/TensorFlow) within the base environment. However, it is recommended to instead use different virtual environments either for different projects or use-cases.

conda create

Our use case is machine learning, and so we will create a new environment for this using the command conda create -n <env-name> python=<python-version> anaconda, like so:

conda create -n mlenv python=3.8 anaconda

A list of packages will be displayed, and conda will ask if we want to proceed — we type y + [ENTER] to continue.

We accept the proposed list of packages installations with y + [ENTER]

conda activate

After everything has been installed, we will be able to switch to our new environment by typing conda activate <env-name>:

We activate our environment with conda activate mlenv

We should see that (base) has been replaced with (mlenv) — this means we are now working from inside our new virtual environment. So we can get started with installing all of the packages we need for ML.

conda/pip install

For most packages, it makes sense to attempt a conda install <package-name> — if this doesn’t work, try pip install <package-name>.

A few essentials that we almost always need are Numpy, Pandas, and Matplotlib. We can install them all using conda install:

conda install pandas matplotlib — Numpy is included as a Pandas dependency, so there is no need to include it explicitly. It will be installed with Pandas.

Depending on what you are working on/with, you will probably need some of the most popular packages for ML too. We will install TensorFlow, Transformers, and PyTorch.

We can install TensorFlow easily with conda install tensorflow:

conda install tensorflow

Conda does not recognize the most recent versions of the Transformers library, so we instead install that with pip install transformers:

pip install transformers

And finally, we have PyTorch. PyTorch is a slightly more complex installation — but made easy by accessing the PyTorch installation guide here.

The PyTorch install locally guide will give us the commands we need to run to install everything we need for PyTorch.

We will need to specify our OS, package manager (Conda), language (Python), and whether we have CUDA or not.

Filed Under: Machine Learning

Primary Sidebar

Stay Ahead: The Latest Tech News and Innovations

Cryptocurrency Market Updates: What’s Happening Now

Emerging Trends in Artificial Intelligence: What to Watch For

Top Cloud Computing Services to Secure Your Data

The Future of Mobile Technology: Recent Advancements and Predictions

Footer

  • Privacy Policy
  • Terms and Conditions

Copyright © 2025 NEO Share

Terms and Conditions - Privacy Policy