When a small group of developers works on a same project, there is a need to share programs, command datasets, and working environments, and Anaconda Cloud could be used for this. Usually, we can save our data on other people’s servers. For Anaconda Cloud, users can use the platform to save and share packages, notebooks, projects, and environments. The public projects and notebooks are free. At the moment, private plans start at $7 per month. Anaconda Cloud allows users to create or distribute software packages.
In this article, we will learn about Anaconda cloud and how to share projects and environment on Anaconda.
This article is an excerpt from a book ‘Hands-On Data Science with Anaconda’ written by Dr. Yuxing Yan, James Yan.
So, let’s get started!
Firstly, for a Windows version of Anaconda, click All Programs | Anaconda, and then choose Anaconda Cloud.
After double-clicking on Cloud, the welcome screen will appear.
Based on the information presented by the welcome screen, we know that we need an account with Anaconda before we can use it. After login, we will see the following screen:
For example, if you double-click on Installing your first package, you will get more information on Anaconda Cloud. We do not need to be logged in, or even need a cloud account, to search for public packages, download, and install them. We need an account only to access private packages without a token or to share your packages with others.
For Anaconda Cloud, users can use the platform to save and share projects and environments.
Sharing projects in Anaconda
First, let’s look at the definition of a project. A project is a folder that contains an anaconda-project.yml configuration file together with scripts (code), notebooks, datasets, and other files. We can add a folder into a project by adding a configuration file named anaconda-project.yml to the folder. The configuration file can include the following sections: commands, variables, services, downloads, packages, channels, and environment specifications. Data scientists can use projects to encapsulate data science projects and make them easily portable. A project is usually compressed into a .tar.bz2 file for sharing and storing.
Anaconda Project automates setup steps so that people with whom you share projects can run your projects with the following single command:
To install Anaconda Project, type the following:
conda install anaconda-project
Anaconda Project encapsulates data science projects and makes them easily portable. It automates setup steps such as installing the right packages, downloading files, setting environment variables, and running commands. Project makes it easy to reproduce your work, share projects with others, and run them on different platforms. It also simplifies deployment to servers. Anaconda projects run the same way on your machine, on another user’s machine, or when deployed to a server.
Traditional build scripts such as setup.py automate the building of the project – going from source code to something runnable – while Project automates running the project, taking build artifacts, and doing any necessary setup before executing them.
We can use Project on Windows, macOS, and Linux. Project is supported and offered by Anaconda Inc® and contributors under a three-clause BSD license. Project sharing will save us a great deal of time since other developers will not spend too much time on the work done already. Here is the procedure:
- Build up your project
- Log in to Anaconda
- From the project’s directory on your computer, type the following command:
Alternatively, from Anaconda Navigator, in the Projects tab, upload via the bottom-right Upload to Anaconda Cloud.
Projects can be any directory of code and assets. Often, projects will contain notebooks or Bokeh applications, for example. Here, we show how to generate a project called project01. First, we want to move to the correct location. Assume that we choose c:/temp/. The key command is given here:
anaconda-project init --directory project01
Next, both commands are shown side by side as well:
$ cd c:/temp/ $ anaconda-project init --directory project01 Create directory 'c:tempproject01'? y Project configuration is in c:tempproject01iris/anaconda-project.yml
The corresponding output is shown here:
We can also turn any existing directory into a project by switching to the directory and then running anaconda-project init without options or arguments. We can use MS Word to open anaconda-project.yml (see the first couple of lines shown here):
# This is an Anaconda project file. # # Here you can describe your project and how to run it. # Use `anaconda-project run` to run the project. # The file is in YAML format, please see http://www.yaml.org/start.html for more. # # Set the 'name' key to name your project # name: project01 # # Set the 'icon' key to give your project an icon # icon: # # Set a one-sentence-or-so 'description' key with project details # description: # # In the commands section, list your runnable scripts, notebooks, and other code. # Use `anaconda-project add-command` to add commands. #
There are two ways to share our projects with others. First, we archive the project by issuing the following command:
anaconda-project archive project01.zip
Then, we email the ZIP file to our colleague or others. The second way of sharing a project is to use Anaconda Cloud. Log in to Anaconda Cloud first. From the project’s directory on our computer, type anaconda-project upload, or, from Anaconda Navigator, in the Projects tab, upload via the bottom-right Upload to Anaconda Cloud.
Now that we’re done looking at how you can share projects. Let’s find out how you can share environments with your partner.
Sharing of environments
In terms of computer software, an operating environment or integrated applications environment is the environment in which users can execute software. Usually, such an environment consists of a user interface and an API. To a certain degree, the term platform could be viewed as its synonym. There are many reasons why we want to share our environment with someone else.
For example, they can re-create a test that we have done. To allow them to quickly reproduce our environment with all of its packages and versions, give them a copy of your environment.yml file. Depending on the operating system, we have the following methods to export our environment file. Note that if we already have an environment.yml file in our current directory, it will be overwritten during this task.
There are different ways to activate the myenv environment file depending on the systems used. For Windows users, in our Anaconda prompt, type the following command:
On macOS and Linux, in our Terminal window, issue the following command:
source activate myenv
Note that we replace myenv with the name of the environment. To export our active environment to a new file, type the following:
conda env export > environment.yml
To share, we can simply email or copy the exported environment.yml file to the other person. On the other hand, in order to remove an environment, run the following code in our Terminal window or at an Anaconda prompt:
conda remove --name myenv --all
Alternatively, we can specify the name, as shown here:
conda env remove --name myenv
To verify that the environment was removed, run the following command line:
conda info --envs
In this tutorial, we discussed Anaconda Cloud. Some topics included how to share different projects over different platforms and how to share your working environments.
If you found this post useful, be sure to check out the book ‘Hands-On Data Science with Anaconda’ to learn further about replicating others’ environments locally, and downloading a package from Anaconda.