How to install if I use conda environments? #3
Comments
need to change:
pip install --upgrade pip wheel setuptools cached-property six pip install --upgrade -t "tf_2_4/lib/python3.8/site-packages/" --no-dependencies --force "/Users/grwche/Downloads/tensorflow_macos/x86_64/grpcio-1.33.2-cp38-cp38-macosx_11_0_x86_64.whl" pip install --upgrade -t "tf_2_4/lib/python3.8/site-packages/" --no-dependencies --force "/Users/grwche/Downloads/tensorflow_macos/x86_64/h5py-2.10.0-cp38-cp38-macosx_11_0_x86_64.whl" pip install --upgrade -t "tf_2_4/lib/python3.8/site-packages/" --no-dependencies --force "/Users/grwche/Downloads/tensorflow_macos/x86_64/numpy-1.18.5-cp38-cp38-macosx_11_0_x86_64.whl" pip install --upgrade -t "tf_2_4/lib/python3.8/site-packages/" --no-dependencies --force "/Users/grwche/Downloads/tensorflow_macos/x86_64/scipy-1.5.4-cp38-cp38-macosx_11_0_x86_64.whl" pip install --upgrade -t "tf_2_4/lib/python3.8/site-packages/" --no-dependencies --force "/Users/grwche/Downloads/tensorflow_macos/x86_64/tensorflow_addons-0.11.2+mlcompute-cp38-cp38-macosx_11_0_x86_64.whl" pip install absl-py astunparse flatbuffers gast google_pasta keras_preprocessing opt_einsum protobuf tensorflow_estimator termcolor typing_extensions wrapt wheel tensorboard typeguard pip install --upgrade -t "tf_2_4/lib/python3.8/site-packages/" --no-dependencies --force "/Users/grwche/Downloads/tensorflow_macos/x86_64/tensorflow_macos-0.1a0-cp38-cp38-macosx_11_0_x86_64.whl" |
EDIT: DO NOT USE THIS. Well you can, it didn't work for me after all, but you can try. I posted an updated version of this, in light of some new updates in the world of Miniconda, later in this post. Thanks @grwche! For those installing this on ARM, the libraries are slightly different, so here was my version.
# If you have Tensorflow in your env, you must install it first -- uncomment this line if you're in this boat
# pip uninstall tensorflow tensorboard
# Put a path to where the arm64 libraries are. For example...
libs="/Users/Matthew/Downloads/tensorflow_macos/arm64/"
# Replace this with the name of your Conda environment
env="tensorflow"
# The rest should work
pip install --upgrade pip wheel setuptools cached-property six
pip install --upgrade -t "$env/lib/python3.8/site-packages/" --no-dependencies --force "$libs/grpcio-1.33.2-cp38-cp38-macosx_11_0_arm64.whl"
pip install --upgrade -t "$env/lib/python3.8/site-packages/" --no-dependencies --force "$libs/h5py-2.10.0-cp38-cp38-macosx_11_0_arm64.whl"
pip install --upgrade -t "$env/lib/python3.8/site-packages/" --no-dependencies --force "$libs/numpy-1.18.5-cp38-cp38-macosx_11_0_arm64.whl"
pip install --upgrade -t "$env/lib/python3.8/site-packages/" --no-dependencies --force "$libs/tensorflow_addons-0.11.2+mlcompute-cp38-cp38-macosx_11_0_arm64.whl"
pip install absl-py astunparse flatbuffers gast google_pasta keras_preprocessing opt_einsum protobuf tensorflow_estimator termcolor typing_extensions wrapt wheel tensorboard typeguard
pip install --upgrade -t "$env/lib/python3.8/site-packages/" --no-dependencies --force "$libs/tensorflow_macos-0.1a0-cp38-cp38-macosx_11_0_arm64.whl" |
Thank you for the responses here. We will look into supporting conda more seamlessly in the future. |
@mwidjaja1 were you able to install Conda on M1 ? |
@JacopoMangiavacchi Yes, just a standard Anaconda installation too if I recall. I don't think I did anything fancy (If I did, it would have been just to throw a |
@hoytak, that would be great. I suppose the approach depends whether this is a fork that you're looking to maintain indefinitely or whether you're planning on upstreaming it. Either way, it would be great if the conda solver would use the accelerated version when appropriate so that a single environment file could be both fast and cross platform. That's good practice in general and especially for things like the courses/workshops that I do. |
Thank you @mwidjaja1, I just found how to install native arm miniconda here https://conda-forge.org/blog/posts/2020-10-29-macos-arm64/ |
And I guess on that note, @hoytak, would you consider submitting this version of TensorFlow (as well as any other packages you've made) to conda-forge's new ARM database so anyone can conda install it? To share @JacopoMangiavacchi's link again: https://conda-forge.org/blog/posts/2020-10-29-macos-arm64/ |
@mwidjaja1 I was able to install it on arm miniconda with the script above BUT the env variable has to contain the path to the conda env and not the name of the env. |
Then I was able to add other packages such as pandas and notebook via conda but as soon as I start a notebook on the associated ipkernel the NotebookApp crash miserably. Is anyone able to use notebook on M1 ? |
Thanks for nudging me in the right direction @JacopoMangiavacchi! I forgot you can downgrade to Python 3.8. I finally got things working with these modifications that takes into account,
So what I did to get things finally working,
# Put a path to where the arm64 libraries are. For example...
libs="/Users/Matthew/Downloads/tensorflow_macos/arm64/"
# Replace this with the path of your Conda environment
env="/Users/Matthew/miniforge3/envs/python38"
# The rest should work
conda upgrade -c conda-forge pip setuptools cached-property six
pip install --upgrade -t "$env/lib/python3.8/site-packages/" --no-dependencies --force "$libs/grpcio-1.33.2-cp38-cp38-macosx_11_0_arm64.whl"
pip install --upgrade -t "$env/lib/python3.8/site-packages/" --no-dependencies --force "$libs/h5py-2.10.0-cp38-cp38-macosx_11_0_arm64.whl"
# pip install --upgrade -t "$env/lib/python3.8/site-packages/" --no-dependencies --force "$libs/numpy-1.18.5-cp38-cp38-macosx_11_0_arm64.whl"
pip install --upgrade -t "$env/lib/python3.8/site-packages/" --no-dependencies --force "$libs/tensorflow_addons-0.11.2+mlcompute-cp38-cp38-macosx_11_0_arm64.whl"
conda install -c conda-forge -y absl-py
conda install -c conda-forge -y astunparse
conda install -c conda-forge -y gast
conda install -c conda-forge -y opt_einsum
conda install -c conda-forge -y termcolor
conda install -c conda-forge -y typing_extensions
conda install -c conda-forge -y wheel
conda install -c conda-forge -y typeguard
pip install tensorboard
pip install wrapt flatbuffers tensorflow_estimator google_pasta keras_preprocessing protobuf
pip install --upgrade -t "$env/lib/python3.8/site-packages/" --no-dependencies --force "$libs/tensorflow_macos-0.1a0-cp38-cp38-macosx_11_0_arm64.whl" |
As an additional reference for future visitors, here's how I got this working in Anaconda on x64: #7 (comment) (though instructions above look quite good as well) |
I am able to install on my MacBook Pro 2018 following @nehbit instructions. Basically, rename
|
Why after I did pip install all .whl files from x86_64 folders and went to Jupiter Notebook to try import TensorFlow and mlcompute, it returned "No module named 'mlcompute'"? |
@hoytak, I was the one who ported conda to macos arm64 and we already have packages like scipy running natively on DTK. Let us know at conda-forge/conda-forge.github.io#1126 if you want to collaborate. |
@mwidjaja1 I tried it on intel platform but I got this issue #28 |
@bryanlimy "conda upgrade -c conda-forge pip setuptools cached-property six" might cause a problem. "PackageNotInstalledError: Package is not installed in prefix." I tested a deep learning model following your last comment. It is pretty fast. Thank you for the guidance! |
after installing, when i launch python and the commands |
Hey everyone so I followed the steps and I'm getting this error when running the script. Note: I copied it to a text edit file ( cleared formatting ), copied path to my tensorflow download and conda env and pasted them in. Then I saved it as a .sh file. Ran chmod +x filename.sh, then ./filename to execute. This is what I got as an error:
|
@TheMartian32 that honestly seems like user error because it's saying the path you provided does not exist. Double check to make sure you're following the instructions correctly. |
@mwidjaja1 I tried cd'ing into the path but I left out the file at the end of it. worked fine. The directory definitely exists but I'm not sure why theres an environment error. just to be sure I doubled checked everything and I printed out the path, everything checks out. |
@TheMartian32 Without knowing the line number you got that error, I think you might be confusing the Python Environment vs. the Installer. When you run the script, it's asking for you for the python environment where to install TF too, not the location of the Whl file (the script infers that) |
@mwidjaja1 I'm not sure what I did, but I just moved the script to the same folder as my TensorFlow install, conda activated the venv, ran the script, and somehow it ran great! All of my imports ran great and there were 0 problems. Thank you so much for writing the script! |
@mwidjaja1 I followed your instructions and it worked great ! Importing TensorFlow via the terminal works great. The issue I have is running TensorFlow in a Jupyter notebook, I have the following error message : |
I found a solution to my problem with this link https://medium.com/@nrk25693/how-to-add-your-conda-environment-to-your-jupyter-notebook-in-just-4-steps-abeab8b8d084, it is only needed to follow step 3. After following the instructions, I had to download in the new environment some libraries but in the end everything works just fine. |
Thanks a lot! This solved my Scipy requirement as well!! |
That for the instructions, which I'm trying, and I would like to ask for your help. Which libraries did you download to the new environment and how? This is what I run: $ conda activate python38lc This is the error and it seems related to cython Traceback (most recent call last): |
You can do |
Thanks @isuruf, I'm operating from a Conda environment created as follows: Given you suggestion, should I "conda update" instead of "conda create"? Thanks! |
I suggest creating a new environment with |
Thanks again @isuruf :) I have to followup questions: 1 - Given that I installed tensoflow_macos in the conda env python38-v1, and I want the jupiter notebook to see that environment, I was thinking to run "python -m ipykernel install --user --name=python38-v1" from the conda env python38-v1. If I create a new conda env python38-v2, how would I go with making tensorflow_macos available from jupiter notebook? 2 - You command is also telling conda to look in "isuruf/label/tf", which I assume it's specific to your system. What is that? Thanks! |
|
Thanks @isuruf! To summarize for future readers. After I created the conda env python38-v1 and installed tf_macos following the steps at https://www.ai-buzz.com/18-steps-to-install-tensorflow_macos-on-m1-macbook-2020/, I ran the following: conda install -n python38-v1 tensorflow-addons -c isuruf/label/tf -c conda-forge conda update -n python38-v1 tensorflow -c isuruf/label/tf -c conda-forge conda install -n python38-v1 -c conda-forge notebook conda install -n python38-v1 -c anaconda ipykernel python -m ipykernel install --user --name=python38-v1 Now, the Jupiter notebook sees the runtime python38-v1 with the correct version of tensorflow. |
Btw, you don't need to follow steps from that link. If you are starting new, the steps are
|
This worked so well!!! thanks! |
Change 0.1a0 to 0.1a1 in path |
I successfully did everything, yet while launching Spyder or Jupyter Notebook the following error occurred.
what can I do? |
How did you install |
I didn't install that. I just followed the 18 steps. then run spyder from anaconda under my environment However, I executed the following codes
Now, it seems, Jupyter Notebook can be opened from terminal(not from anaconda) under |
I'm getting an error "ERROR: grpcio-1.33.2-cp38-cp38-macosx_11_0_arm64.whl is not a supported wheel on this platform." |
while trying to extract tar file I get this error "tar: Error opening archive: Failed to open 'tensorlow_macos-0.1alpha2.tar'. kindly assist |
found my mistake....left an 'f' on TensorFlow.. |
now am stuck on step 10. this is the error I get after trying to install pip (python38-demo-v1) luzuko@Luzukos-MacBook-Air arm64 % pip installl --upgrade -t “$env/lib/python3.8/site-packages/” --no-dependencies -–force “$libs/grpcio-1.33.2-cp38-cp38-macosx_11_0_arm64.whl” Usage: no such option: -– |
I do not have virtualenvs installed but I do use conda environments. Is there a way to install in a conda environment? Thanks!
The text was updated successfully, but these errors were encountered: