Osx Install Conda

  • Conda install linux-ppc64le v3.3.2; osx-arm64 v3.3.2; linux-64 v3.3.2; linux-aarch64 v3.3.2; osx-64 v3.3.2; win-64 v3.3.2; To install this package with conda run one.
  • To install a.tar file containing many conda packages, run the following command: conda install / packages - path / packages - filename. Tar If conda cannot find the file, try using an absolute path name instead of a relative path name.
  • Install some application shortcuts (start menu in win32 and app bundle linking to the conda install in OSX) cheers, Jon - Jonathan.
  1. Mac Conda Install Opencv
  2. Osx Conda Install Opencv
  3. Osx Install Anaconda
  4. Mac Conda Install Keras
  5. Osx Conda Install Tensorflow
  6. Osx Install Conda

Now I'm wondering how to install properly second Anaconda (for work) with Python 2? I need both versions to work with iPython and Spyder IDE. Ideal way is to have totally separate Python environments. For example, I wish I could write like conda install scikit-learn for Python 3 environment and something like conda2 install scikit-learn for.

With conda, you can create, export, list, remove, and updateenvironments that have different versions of Python and/orpackages installed in them. Switching or moving betweenenvironments is called activating the environment. You can alsoshare an environment file.

Note

There are many options available for the commands describedon this page. For details, see Command reference.

Note

condaactivate and condadeactivate only work on conda 4.6 and later versions.For conda versions prior to 4.6, run:

  • Windows: activate or deactivate

  • Linux and macOS: sourceactivate or sourcedeactivate

Tip

By default, environments are installed into the envsdirectory in your conda directory. See Specifying a location for an environmentor run condacreate--help for information on specifyinga different path.

Use the terminal or an Anaconda Prompt for the following steps:

  1. To create an environment:

    Note

    Replace myenv with the environment name.

  2. When conda asks you to proceed, type y:

This creates the myenv environment in /envs/. Nopackages will be installed in this environment.

  1. To create an environment with a specific version of Python:

  2. To create an environment with a specific package:

    OR:

  3. To create an environment with a specific version of a package:

    OR:

  4. To create an environment with a specific version of Python andmultiple packages:

Tip

Install all the programs that you want in this environmentat the same time. Installing 1 program at a time can lead todependency conflicts.

To automatically install pip or another program every time a newenvironment is created, add the default programs to thecreate_default_packages sectionof your .condarc configuration file. The default packages areinstalled every time you create a new environment. If you do notwant the default packages installed in a particular environment,use the --no-default-packages flag:

Tip

You can add much more to the condacreate command.For details, run condacreate--help.

Use the terminal or an Anaconda Prompt for the following steps:

  1. Create the environment from the environment.yml file:

    The first line of the yml file sets the new environment'sname. For details see Creating an environment file manually.

  2. Activate the new environment: condaactivatemyenv

  3. Verify that the new environment was installed correctly:

You can also use condainfo--envs.

You can control where a conda environment lives by providing a pathto a target directory when creating the environment. For example,the following command will create a new environment in a subdirectoryof the current working directory called envs:

You then activate an environment created with a prefix using the samecommand used to activate environments created by name:

Specifying a path to a subdirectory of your project directory whencreating an environment has the following benefits:

  • It makes it easy to tell if your project uses an isolated environmentby including the environment as a subdirectory.

  • It makes your project more self-contained as everything, includingthe required software, is contained in a single project directory.

An additional benefit of creating your project’s environment inside asubdirectory is that you can then use the same name for all yourenvironments. If you keep all of your environments in your envsfolder, you’ll have to give each environment a different name.

There are a few things to be aware of when placing conda environmentsoutside of the default envs folder.

  1. Conda can no longer find your environment with the --name flag.You’ll generally need to pass the --prefix flag along with theenvironment’s full path to find the environment.

  2. Specifying an install path when creating your conda environmentsmakes it so that your command prompt is now prefixed with the activeenvironment’s absolute path rather than the environment’s name.

After activating an environment using its prefix, your prompt willlook similar to the following:

This can result in long prefixes:

To remove this long prefix in your shell prompt, modify the env_promptsetting in your .condarc file:

This will edit your .condarc file if you already have oneor create a .condarc file if you do not.

Now your command prompt will display the active environment’sgeneric name, which is the name of the environment's root folder:

You may need to update your environment for a variety of reasons.For example, it may be the case that:

  • one of your core dependencies just released a new version(dependency version number update).

  • you need an additional package for data analysis(add a new dependency).

  • you have found a better package and no longer need the olderpackage (add new dependency and remove old dependency).

If any of these occur, all you need to do is update the contents ofyour environment.yml file accordingly and then run the followingcommand:

Note

The --prune option causes conda to remove any dependenciesthat are no longer required from the environment.

Use the terminal or an Anaconda Prompt for the following steps:

You can make an exact copy of an environment by creating a cloneof it:

Note

Replace myclone with the name of the new environment.Replace myenv with the name of the existing environment thatyou want to copy.

To verify that the copy was made:

In the environments list that displays, you should see both thesource environment and the new copy.

You can use explicit specification files to build an identicalconda environment on the same operating system platform, eitheron the same machine or on a different machine.

Use the terminal or an Anaconda Prompt for the following steps:

  1. Run condalist--explicit to produce a spec list such as:

  2. To create this spec list as a file in the current workingdirectory, run:

    Note

    You can use spec-file.txt as the filename or replaceit with a filename of your choice.

    An explicit spec file is not usually cross platform, andtherefore has a comment at the top such as #platform:osx-64showing the platform where it was created. This platform is theone where this spec file is known to work. On other platforms,the packages specified might not be available or dependenciesmight be missing for some of the key packages already in thespec.

    To use the spec file to create an identical environment on thesame machine or another machine:

    To use the spec file to install its listed packages into anexisting environment:

    Conda does not check architecture or dependencies when installingfrom a spec file. To ensure that the packages work correctly,make sure that the file was created from a working environment,and use it on the same architecture, operating system, andplatform, such as linux-64 or osx-64.

Activating environments is essential to making the software in the environmentswork well. Activation entails two primary functions: adding entries to PATH forthe environment and running any activation scripts that the environment maycontain. These activation scripts are how packages can set arbitraryenvironment variables that may be necessary for their operation. You can alsouse the config API to set environment variables.

When installing Anaconda,you have the option to “Add Anacondato my PATH environment variable.” This is not recommended because theadd to PATH option appends Anaconda to PATH. When the installer appendsto PATH, it does not call the activation scripts.

On Windows, PATH is composed of two parts, the system PATH and theuser PATH. The system PATH always comes first. When you installAnaconda for Just Me, we add it to the user PATH. When you installfor All Users, we add it to the system PATH. In the former case,you can end up with system PATH values taking precedence overour entries. In the latter case, you do not. We do not recommendmulti-user installs.

Activation prepends to PATH. This only takes effectwhen you have the environment active so it is local to a terminal session,not global.

To activate an environment: condaactivatemyenv

Note

Replace myenv with the environment name or directory path.

Conda prepends the path name myenv onto your system command.

You may receive a warning message if you have not activated your environment:

If you receive this warning, you need to activate your environment. To doso on Windows, run: c:Anaconda3Scriptsactivatebase inAnaconda Prompt.

Windows is extremely sensitive to proper activation. This is becausethe Windows library loader does not support the concept of librariesand executables that know where to search for their dependencies(RPATH). Instead, Windows relies on a dynamic-link library search order.

If environments are not active, libraries won't be found and therewill be lots of errors. HTTP or SSL errors are common errors when thePython in a child environment can't find the necessary OpenSSL library.

Conda itself includes some special workarounds to add its necessary PATHentries. This makes it so that it can be called without activation orwith any child environment active. In general, calling any executable inan environment without first activating that environment will likely not work.For the ability to run executables in activated environments, you may beinterested in the condarun command.

If you experience errors with PATH, review our troubleshooting.

Conda init¶

Earlier versions of conda introduced scripts to make activationbehavior uniform across operating systems. Conda 4.4 allowedcondaactivatemyenv. Conda 4.6 added extensive initializationsupport so that conda works faster and less disruptively ona wide variety of shells (bash, zsh, csh, fish, xonsh, and more).Now these shells can use the condaactivate command.Removing the need to modify PATH makes conda less disruptive toother software on your system. For more information, read theoutput from condainit--help.

One setting may be useful to you when using condainit is:

This setting controls whether or not conda activates your baseenvironment when it first starts up. You'll have the condacommand available either way, but without activating the environment,none of the other programs in the environment will be available untilthe environment is activated with condaactivatebase. Peoplesometimes choose this setting to speed up the time their shell takesto start up or to keep conda-installed software from automaticallyhiding their other software.

Nested activation¶

By default, condaactivate will deactivate the current environmentbefore activating the new environment and reactivate it whendeactivating the new environment. Sometimes you may want to leavethe current environment PATH entries in place so that you can continueto easily access command-line programs from the first environment.This is most commonly encountered when common command-line utilitiesare installed in the base environment. To retain the current environmentin the PATH, you can activate the new environment using:

If you wish to always stack when going from the outermost environment,which is typically the base environment, you can set the auto_stackconfiguration option:

You may specify a larger number for a deeper level of automatic stacking,but this is not recommended since deeper levels of stacking are more likelyto lead to confusion.

Environment variable for DLL loading verification¶

If you don't want to activate your environment and you want Pythonto work for DLL loading verification, then follow thetroubleshooting directions.

Warning

If you choose not to activate your environment, thenloading and setting environment variables to activatescripts will not happen. We only support activation.

To deactivate an environment, type: condadeactivate

Conda removes the path name for the currently active environment fromyour system command.

Note

To simply return to the base environment, it's better to call condaactivate with no environment specified, rather than to try to deactivate. Ifyou run condadeactivate from your base environment, you may lose theability to run conda at all. Don't worry, that's local to this shell - you canstart a new one. However, if the environment was activated using --stack(or was automatically stacked) then it is better to use condadeactivate.

Use the terminal or an Anaconda Prompt for the following steps.

By default, the active environment---the one you are currentlyusing---is shown in parentheses () or brackets [] at thebeginning of your command prompt:

Mac

If you do not see this, run:

In the environments list that displays, your current environmentis highlighted with an asterisk (*).

By default, the command prompt is set to show the name of theactive environment. To disable this option:

Osx conda install tensorflow

To re-enable this option:

To see a list of all of your environments, in your terminal window or anAnaconda Prompt, run:

OR

A list similar to the following is displayed:

If this command is run by an administrator, a list of all environmentsbelonging to all users will be displayed.

To see a list of all packages installed in a specific environment:

  • If the environment is not activated, in your terminal window or anAnaconda Prompt, run:

  • If the environment is activated, in your terminal window or anAnaconda Prompt, run:

  • To see if a specific package is installed in an environment, in yourterminal window or an Anaconda Prompt, run:

To use pip in your environment, in your terminal window or anAnaconda Prompt, run:

Issues may arise when using pip and conda together. When combining conda and pip,it is best to use an isolated conda environment. Only after conda has been used toinstall as many packages as possible should pip be used to install any remainingsoftware. If modifications are needed to the environment, it is best to create anew environment rather than running conda after pip. When appropriate, conda andpip requirements should be stored in text files.

We recommend that you:

Mac Conda Install Opencv

Use pip only after conda
  • Install as many requirements as possible with conda then use pip.

  • Pip should be run with --upgrade-strategyonly-if-needed (the default).

  • Do not use pip with the --user argument, avoid all users installs.

Use conda environments for isolation
  • Create a conda environment to isolate any changes pip makes.

  • Environments take up little space thanks to hard links.

  • Care should be taken to avoid running pip in the root environment.

Recreate the environment if changes are needed
  • Once pip has been used, conda will be unaware of the changes.

  • To install additional conda packages, it is best to recreatethe environment.

Store conda and pip requirements in text files
  • Package requirements can be passed to conda via the --file argument.

  • Pip accepts a list of Python packages with -r or --requirements.

  • Conda env will export or create environments based on a file withconda and pip requirements.

If you want to associate environment variables with an environment,you can use the config API. This is recommended as an alternative tousing activate and deactivate scripts since those are an execution ofarbitrary code that may not be safe.

First, create your environment and activate it:

To list any variables you may have, run condaenvconfigvarslist.

To set environment variables, run condaenvconfigvarssetmy_var=value.

Once you have set an environment variable, you have to reactivate your environment:condaactivatetest-env.

To check if the environment variable has been set, runechomy_var or condaenvconfigvarslist.

When you deactivate your environment, you can use those same commands to see thatthe environment variable goes away.

You can specify the environment you want to affect using the -n and -p flags. The -n flag allows you to name the environment and -p allows you to specify the path to the environment.

To unset the environment variable, run condaenvconfigvarsunsetmy_var-ntest-env.

When you deactivate your environment, you can see that environment variable goes away by rerunningechomy_var or condaenvconfigvarslist to show that the variable nameis no longer present.

Environment variables set using condaenvconfigvars will be retained in the output ofcondaenvexport. Further, you can declare environment variables in the environment.yml fileas shown here:

Conda environments can include saved environment variables.

Suppose you want an environment 'analytics' to store both asecret key needed to log in to a server and a path to aconfiguration file. The sections below explain how to write ascript named env_vars to do this on Windows and macOS or Linux.

This type of script file can be part of a conda package, inwhich case these environment variables become active when anenvironment containing that package is activated.

You can name these scripts anything you like. However, multiplepackages may create script files, so be sure to use descriptivenames that are not used by other packages. One popular option isto give the script a name in the formpackagename-scriptname.sh, or on Windows,packagename-scriptname.bat.

Windows¶

  1. Locate the directory for the conda environment in yourAnaconda Prompt by running in the command shell %CONDA_PREFIX%.

  2. Enter that directory and create these subdirectories andfiles:

  3. Edit .etccondaactivate.denv_vars.bat as follows:

  4. Edit .etccondadeactivate.denv_vars.bat as follows:

When you run condaactivateanalytics, the environment variablesMY_KEY and MY_FILE are set to the values you wrote into the file.When you run condadeactivate, those variables are erased.

macOS and Linux¶

Osx Conda Install Opencv

  1. Locate the directory for the conda environment in your terminal window by running in the terminal echo$CONDA_PREFIX.

  2. Enter that directory and create these subdirectories andfiles:

  3. Edit ./etc/conda/activate.d/env_vars.sh as follows:

  4. Edit ./etc/conda/deactivate.d/env_vars.sh as follows:

When you run condaactivateanalytics, the environmentvariables MY_KEY and MY_FILE are set to the values you wrote intothe file. When you run condadeactivate, those variables areerased.

You may want to share your environment with someone else---forexample, so they can re-create a test that you have done. Toallow them to quickly reproduce your environment, with all of itspackages and versions, give them a copy of yourenvironment.yml file.

Exporting the environment.yml file¶

Note

If you already have an environment.yml file in yourcurrent directory, it will be overwritten during this task.

  1. Activate the environment to export: condaactivatemyenv

    Note

    Replace myenv with the name of the environment.

  2. Export your active environment to a new file:

    Note

    This file handles both the environment's pip packagesand conda packages.

  3. Email or copy the exported environment.yml file to theother person.

Exporting an environment file across platforms¶

If you want to make your environment file work across platforms,you can use the condaenvexport--from-history flag. Thiswill only include packages that you’ve explicitly asked for,as opposed to including every package in your environment.

For example, if you create an environment and install Python and a package:

This will download and install numerous additional packages to solvefor dependencies. This will introduce packages that may not be compatibleacross platforms.

If you use condaenvexport, it will export all of those packages.However, if you use condaenvexport--from-history, it willonly export those you specifically chose:

Note

If you installed Anaconda 2019.10 on macOS, your prefix may be/Users/username/opt/envs/env-name.

Creating an environment file manually¶

You can create an environment file (environment.yml) manuallyto share with others.

EXAMPLE: A simple environment file:

EXAMPLE: A more complex environment file:

Note

Note the use of the wildcard * when defining the patch versionnumber. Defining the version number by fixing the major and minorversion numbers while allowing the patch version number to varyallows us to use our environment file to update our environmentto get any bug fixes whilst still maintaining consistency ofsoftware environment.

You can exclude the default channels by adding nodefaultsto the channels list.

This is equivalent to passing the --override-channels optionto most conda commands.

Osx Install Anaconda

Adding nodefaults to the channels list in environment.ymlis similar to removing defaults from the channelslist in the .condarc file. However,changing environment.yml affects only one of your condaenvironments while changing .condarc affects them all.

For details on creating an environment from thisenvironment.yml file, see Creating an environment from an environment.yml file.

Conda keeps a history of all the changes made to your environment,so you can easily 'roll back' to a previous version. To list the history of each change to the current environment:condalist--revisions

To restore environment to a previous revision: condainstall--revision=REVNUMor condainstall--revREVNUM.

Note

Mac Conda Install Keras

Replace REVNUM with the revision number.

Example:If you want to restore your environment to revision 8, run condainstall--rev8.

Osx Conda Install Tensorflow

To remove an environment, in your terminal window or anAnaconda Prompt, run:

You may instead use condaenvremove--namemyenv.

To verify that the environment was removed, in your terminal window or anAnaconda Prompt, run:

Osx Install Conda

The environments list that displays should not show the removedenvironment.