Search code examples
macostensorflowcommand-lineminiconda

I am having issues installing libraries to miniconda through the terminal


I am attempting to install Tensorflow on Miniconda with the intention of setting up Keras. Tensorflow is now setup, but I can't install the necessary libraries. For additional context this is on a mac. The current root I'm in is

/Users/myname/miniconda3

and I have my virtual environment running for Tensorflow.

I am attemting to execute the command

conda env update --file tools.yml

Which traces back to a file called tool.yml which I placed in the miniconda3 directory. When this command is ran I reccieve:

Collecting package metadata (repodata.json): done                                                            
Solving environment: failed                                                                                  
                                                                                                             
ResolvePackageNotFound:                                                                                      
  - cudatoolkit=11.2.2                                                                                       
  - cudnn=8.1.0

The contents of the file are:

channels:
    - conda-forge
dependencies:
    - cudatoolkit=11.2.2 
    - cudnn=8.1.0
    - jupyter
    - scikit-learn
    - scipy
    - pandas
    - pandas-datareader
    - matplotlib
    - pillow
    - tqdm
    - requests
    - h5py
    - pyyaml
    - flask
    - boto3
    - pip
    - pip:
        - tensorflow
        - bayesian-optimization
        - gym
        - kaggle

I am new to miniconda and tensorflow, so I'm not sure if I am executing something incorrectly, if my tools.yml needs to be placed somewhere else, or if there is another issue. Any direction is appreciated.


Solution

  • For using TensorFlow on your Mac, you may refer to any one of these 2 options I suggest :

    1. Through Miniconda

    Follow the official documentation for complete info.

    a. Install the latest Python version. (Note: Requires Python 3.8–3.11, and pip >= 20.3 for MacOS.)

    b. Install Miniconda

    c. Create the conda environment.

    d. Install TensorFlow

    2. Through Miniforge (Check step no. 8 for GPU)

    Follow these minimum steps for installing with Miniforge . You can get all the step by step details in this GitHub Repo

    1. Download and install Homebrew from https://brew.sh. Follow the steps it prompts you to go through after installation.

    2. Download Miniforge (Conda installer) for macOS arm64 chips (M1, M1 Pro, M1 Max).

    3. Install Miniforge3 into home directory.

    4. Restart terminal.

    5. Create a directory to setup TensorFlow environment.

    6. Make and activate Conda environment.

    7. Install TensorFlow dependencies from Apple Conda channel.

    8. Install base TensorFlow (Apple's fork of TensorFlow is called tensorflow-macos)

    The Github link provided above should be really helpful for getting all the commands for the steps. Additionally, you can check this YT video as well.