Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install on M1 Mac #109

Open
jackson-sandland opened this issue Apr 4, 2022 · 5 comments
Open

Unable to install on M1 Mac #109

jackson-sandland opened this issue Apr 4, 2022 · 5 comments

Comments

@jackson-sandland
Copy link

jackson-sandland commented Apr 4, 2022

Getting the following output when attempting to install mitdeeplearning via pip on an M1 mac:

% pip install mitdeeplearning
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Collecting mitdeeplearning
  Using cached mitdeeplearning-0.2.0.tar.gz (2.1 MB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: numpy in /opt/homebrew/lib/python3.9/site-packages (from mitdeeplearning) (1.22.3)
Collecting regex
  Downloading regex-2022.3.15-cp39-cp39-macosx_11_0_arm64.whl (281 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 281.8/281.8 KB 5.1 MB/s eta 0:00:00
Collecting tqdm
  Using cached tqdm-4.64.0-py2.py3-none-any.whl (78 kB)
Collecting gym
  Downloading gym-0.23.1.tar.gz (626 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 626.2/626.2 KB 17.9 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting mitdeeplearning
  Downloading mitdeeplearning-0.1.2.tar.gz (2.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 45.2 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
  Downloading mitdeeplearning-0.1.1.tar.gz (2.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 37.5 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
  Downloading mitdeeplearning-0.1.0.tar.gz (2.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 36.1 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
ERROR: Cannot install mitdeeplearning==0.1.0, mitdeeplearning==0.1.1, mitdeeplearning==0.1.2 and mitdeeplearning==0.2.0 because these package versions have conflicting dependencies.

The conflict is caused by:
    mitdeeplearning 0.2.0 depends on tensorflow>=2.0.0a
    mitdeeplearning 0.1.2 depends on tensorflow>=2.0.0a
    mitdeeplearning 0.1.1 depends on tensorflow>=2.0.0a
    mitdeeplearning 0.1.0 depends on tensorflow>=2.0.0a

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

ERROR: Could not find a version that satisfies the requirement tensorflow>=2.0.0a 

Looking for a solution that allows the installation of this package.
I'm using python3.9 and I have tensorflow-macos installed.

@jackson-sandland
Copy link
Author

jackson-sandland commented Apr 5, 2022

Was able to avoid local development issues by using an online google collab Jupyter notebook here: https://colab.research.google.com and I was able to install the dependency no problem.

@datasith
Copy link

Assuming you have tensorflow-macos installed, a solution is to change lines 19 and 20 in setup.py:

if get_dist('tensorflow>='+tf_ver) is None and get_dist('tensorflow_gpu>='+tf_ver) is None:
    install_deps.append('tensorflow>='+tf_ver)

to:

if get_dist('tensorflow-macos>='+tf_ver) is None and get_dist('tensorflow_gpu>='+tf_ver) is None:
    install_deps.append('tensorflow-macos>='+tf_ver)

And then ensuring that you install it from the local directory, for example using pip install setup.py.

@Nour-Aldein2
Copy link

You should start by instaling xcode-select and homebrew in order for you to install miniforge. Follow this link to install Homebrew, then in your terminal type xcode-select --install, after that brew install miniforge. I advise you to create a new environment before trying to install tensorflow.

To install tensorflow in your environment, type the following lines in your terminal:
pip install tensorflow-macos
and to use the GPU advantage:
pip install tensorflow-metal

@SteveGan
Copy link

SteveGan commented Nov 15, 2022

I have already got my TensorFlow metal environment set up and running. And I still got the same error trying to install mitdeeplearning described in this issue. My current tensorflow version is 2.10.0.

@marcinbunsch
Copy link

I think I figured it out - in Part 1, in 0.1 Install Tensorflow, I changed the first cell to be:

# This is a mac-specific install

# Install all dependencies and dependencies of mitdeeplearning
%pip install tensorflow-macos
%pip install matplotlib
%pip install regex
%pip install opencv-python
%pip install gym

# add the root directory to the path - that will allow us to load the mitdeeplearning package
import sys
sys.path.insert(1, './..')

# %tensorflow_version 2.x
import tensorflow as tf

# Download and import the MIT Introduction to Deep Learning package
# %pip install mitdeeplearning - comment this out, we use the local version
import mitdeeplearning as mdl

import numpy as np
import matplotlib.pyplot as plt

That allowed me to not install mitdeeplearning, but use the local version instead. On MacOS, you need to install tensorflow-macos, but mitdeeplearning depends on tensorflow - a dependency that will never be satisfied on MacOS.

But we have the local version in the repo, so I'm just switching to using that. So far Part 1 has worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants