Tensorflow pip install on mac with python3 - python

I know this has been asked many times, I saw them tried to solve my problem but I can't, nothing works for me.
I have a mac m1, My os version is BigSur 11.5.1
My python3 version is 3.8.10
I have a project folder, which I created my env in there as atai_env
I ran pip upgrade, my pip version is current which is 21.3.1
I activated my env and ran pip install tensorflow which gives this error;
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow
I saw some command as pip install tensorflow-macos so I tried it, it seems to install but at the end it gives this Failed to build h5py which I tried to install but failed again
Then I tried to ran pip command given here for python 3.8 -> https://www.tensorflow.org/install/pip and it gives below error;
tensorflow-2.7.0-cp38-cp38-macosx_10_11_x86_64.whl is not a supported wheel on this platform.
I am so sick of this :/ I tried to install other versions of python but it always fails. Can someone explain what should I do, I can't believe I spent more than 2 hours on this.
On the tensorflow install page, it seems I should only be running pip install tensorflow but that doesn't work

Ok, Nothing that I found on google helped. I started over, and decided to try python versions starting from 3.9 with decreasing versions. Finally this command just worked -> pip install tensorflow with python 3.7.9 It is so frustrating, cost me a few hours. I wasn't expecting it would be unstable like this. Anyway, if you happen to face it just try to use one of the version 7 even tho tensorflow says it works for 3.7 - 3.9
PS: I am sorry but this is really stupid, it is almost 2022 and we are working on AI with this framework comon :/

I have MacOS BigSur 11.6.1 running and just created a virtualenv with Python 3.8.12. Installing tensorflow works without any problems:
pip install tensorflow
pip install tensorflow 1 err | 8s | voice_assistant py
Collecting tensorflow
Downloading tensorflow-2.7.0-cp38-cp38-macosx_10_11_x86_64.whl (207.1 MB)

I could successfully install and run TensorFlow from my M1 MacBook Pro. Monterey 12.4. Here's what I did:
1. Install Homebrew first
How typical.
2. Install Anaconda via Homebrew
brew install anaconda
Installing Python is a mess and I know most tutorials will suggest to use pyenv as the version management tools. I tried that, but didn't work. What worked for me is Anaconda.
3. Download PyCharm
It's a GUI-friendly way to switch between Python versions and environments.
4. Set the Python interpreter inside PyCharm
Note that I use Conda Environment. Note also that the conda executable is inside /opt/homebrew/anaconda3/bin/conda.
5. Install tensorflow-macos from the PyCharm terminal
After doing this, you can import tensorflow as tf inside your .py files.

You can try upgrading the version of pip.

Related

Error installing tensorflow on python 3.11

I need to import tensorflow but I'm not capable to install it since when I run
pip install tensorflow
it shows
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow
I think the problem is that tensorflow runs in python < 3.11 versions. But I'm not sure. I've been looking for a solution using a virtual enviroment with python 3.10, but it seems pretty complicated for a noob like me. Thanks in advance
You can try alternative methods
pip install https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.8.0-py3-none-any.whl
If you want to build TensorFlow from source check this.
I ran into the same problem but I got tensorflow to install by installing on python 3.10.9
Python.org
Then adding those directories to my PATH and moving them to top priority.
image of my PATH environment variables
Confirm Python version number in Command Prompt
python --version
Python 3.10.9
Install tensorflow
python.exe -m pip install tensorflow
Hope that helps!

Can't install tensorflow on pycharm?

I recently installed pycharm. I also use a different libraries when I code. I was able to install Numpy, Pandas, etc. But when I tried to install tensor flow, I got an error saying,
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow
I have the latest pip(20.1.1) and latest pycharm version. I use python 3.8.1 which is not the latest. I don't know if it's the problem or not because it fits the requirements.
I had the same issue , it's because the latest version of Python matches with Tensorflow 2.x , and these versions are not supported by pip installation ( venv ) , you better install Anaconda and create a portable environnement that you can use on multiple projects , it'll be easier to install Tensorflow
conda install tensorflow
Or you can use the Anaconda Navigator for a gui interface packages installation
Try first using pip command. You will have more details of the fails.
pip install pandas
also check which python version are you using inside pycharm. I suggest you to configure a virtualenv.
Try this,
MacOS:
python -m pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.2.0-cp38-cp38-macosx_10_14_x86_64.whl
Windows:
python -m pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow_cpu-2.2.0-cp38-cp38-win_amd64.whl

Can't install tensorflow with pip or anaconda

Does anyone know how to properly install tensorflow on Windows?
I'm currently using Python 3.7 (also tried with 3.6) and every time I get the same "Could not find a version that satisfies the requirement tensorflow-gpu (from versions: )
No matching distribution found for tensorflow-gpu" error
I tried installing using pip and anaconda, both don't work for me.
Found a solution, seems like Tensorflow doesn't support versions of python after 3.6.4. This is the version I'm currently using and it works.
Tensorflow or Tensorflow-gpu is supported only for 3.5.X versions of Python. Try installing with any Python 3.5.X version. This should fix your problem.
Here is what i did to get tensorflow working with windows.
Download python 3.7.0 (64 bit from Python Releases for Windows) Install it and check python version by running below command in cmd:
python --version
Python 3.7.0
Then run below command to upgrade pip to latest
python -m pip install --upgrade pip
Now install tensorflow using pip
pip install tensorflow
That's it you have installed tensorflow on windows. Below image shows what happens when you type above commands
link for tensorflow for python 3x
https://pypi.org/project/tensorflow/#files
tensorflow-1.14.0-cp37-cp37m-win_amd64.whl (68.3 MB)
Unfortunately, tensorflow can't installed correctly on python 3.7 and last version of anaconda: so, the best and effective way to do this is to downgrade your python to python 3.6.7 use the next steps:
1- download the latest version of Anaconda
use Anaconda prompt with administrator privilege
2- conda install python=3.6.7 (need a long time)
3-conda install tensorflow
4- conda install keras
5- conda install numpy
Check whether you have a CPU or GPU, if your system doesn't have GPU, then it will generate error.
If you are going to install tensorflow using Windows command prompt (assuming python is already installed), then just run the following command. Go to the root directory, preferably 'C:' drive then run
For GPU- pip3 install --upgrade tensorflow-gpu
For CPU- pip3 install --upgrade tensorflow
If you are using Anaconda, then open Anaconda Navigator->Environments->Select 'All' from the drop down menu and then search TensorFlow. If you are using CPU, then select 'tensorflow', else for GPU select 'tensorflow-gpu'. Then click Apply.
Screenshot of Anaconda Navigator-In case you are not familiar where to look.
Download the latest version of anaconda from here
I'm using Anaconda 2019.03 for Windows Installer, Python 3.7, 64-bit
Upgrade pip as:
python -m pip install --upgrade pip
(a). Install tensorflow using pip3 as:
pip3 install --user --upgrade tensorflow
(b). If you installed anaconda with all users mode. The above
command will become:
pip3 install --upgrade tensorflow
Check installation success as:
python -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
As of Feb 2020, Tensorflow is not supported for Python 3.8+
To make it work install a virtualenv w/ Python 3.7 from here: https://www.python.org/downloads/windows/
Tensorflow pip installation for python version 3.5-3.8 requires pip 19.0 or later, as mentioned in the official tensorflow documentation.
Here is a part of this documentation:
System requirements
Python 3.5–3.8
Python 3.8 support requires TensorFlow 2.2 or later.
pip 19.0 or later (requires manylinux2010 support)
Try running pip install --upgrade pip inside your python3 virtualenv.
You mentioned Anaconda. Do you run your python through there?
If so check in Anaconda Navigator --> Environments, if your current environment have got tensorflow installed.
If not, install tensorflow and run from that environment.
Should work.
I had the same problem that yours, happened that I had python at version 3.7. So for installing the Tensorflow with the GPU support I used:
py -3.6 -m pip install tensorflow-gpu
at a Virtualenv ambient. You can see the documentation behind on this website:
https://docs.python.org/3/installing/index.html
I think that this solution is better than downgrade the Python version.
Actually the easiest way to install tensorflow is:
install python 3.5 (not 3.6 or 3.7) you can check wich version you have by typing "python" in the cmd.
When you install it check in the options that you install pip with it and you add it to variables environnement.
When its done just go into the cmd and tipe "pip install tensorflow"
It will download tensorflow automatically.
If you want to check that it's been installed type "python" in the cmd then some that ">>>" will appear, then you write "import tensorflow" and if there's no error, you've done it!
As of November 2018, Tensorflow is not supported for Python 3.6.4+
What to do:
Downgrade Anaconda's Python from 3.7 or 3.6.5+ to 3.6.4
a. Open Command Prompt, find your Anaconda environment, and change your directory
where anaconda or where python
Example path and cd:
cd C:\ProgramData\Anaconda3\bin
b. While in anaconda3/bin in your Command Prompt, source activate your base Anaconda environment
source activate
c. In your Command Prompt, downgrade your base Anaconda environment
conda install python=3.6.4
d. Install Tensorflow
pip install tensorflow
Further reading:
http://docs.anaconda.com/anaconda/user-guide/faq/#how-do-i-get-the-latest-anaconda-with-python-3-5
As of July 2019, I have installed it on python 3.7.3 using py -3 -m pip install tensorflow-gpu
py -3 in my installation selects the version 3.7.3.
The installation can also fail if the python installation is not 64 bit. Install a 64 bit version first.
This is Manas working as a intern in COE-AI lab(CET,BBSR) under tech machindra.
We faced same error. After a little research, we found that there is a glitch in anaconda python 3.7. It does not install tensorflow through pip or conda install command, even if it does..produces same error..
Here is the solution, install conda environment for python=3.6:
go to the directory where conda is installed
cd anaconda3
conda create -n tensorflow python=3.6
conda activate tensorflow
conda install tensorflow python=3.6
python
Import tensorflow.
steps
Do it twice:
enter image description here
enter image description here
-> Not able to install tensorflow , Here I have a solution that worked for me
Step 1 :
- Check version of python(3.7.3)
- Python must be 64 bit Otherwise tensorflow never ever going to be installed it defiitely gives Error.
Step 2 :
pip install tensorflow==2.0.0
Step 3 :
pip install sklearn==0.0
pip install Pillow==8.0.1
pip install h5py==2.10.0
Step 4 :
pip install keras==2.3.1
Now its ready to use.
In Windows 10 with Python 3.8.5, first i tried directly then it was giving following error:
ERROR: Could not find a version that satisfies the requirement tensorflow==1.15 (from versions: none)
Then i installed successfully in virtual environment shown below:
PS E:\udemy\full_stack_web_ai\deeplearning> .\myenv\Scripts\activate
(myenv) PS E:\udemy\full_stack_web_ai\deeplearning> pip install tensorflow
Collecting tensorflow ###
Downloading tensorflow-2.4.1-cp38-cp38-win_amd64.whl (370.7 MB)
Use virtual environment using:
python -m venv myenv
.\myenv\Scripts\activate
Not Enabling the Long Paths can be the potential problem.To solve that,
Steps include:
Go to Registry Editor on the Windows Laptop
Find the key "HKEY_LOCAL_MACHINE"->"SYSTEM"->"CurrentControlSet"->
"File System"->"LongPathsEnabled" then double click on that option and change the value from 0 to 1.
3.Now try to install the tensorflow it will work.

Illegal instruction: 4 when importing tensorflow in python 3.6

I installed Tensorflow on macOS with Virtualenv. Everything went okay ("Successfully installed six-1.11.0 tensorflow-1.6.0" is the last output of the terminal, once i run the command pip3 install --upgrade tensorflow). So, with the virtualenv activated, I typed: python3 and then import tensorflow as tf
but it outputs the error Illegal instruction: 4 and quits python.
I looked around to see if anybody else had encountered the same issue, but I didn't find much, apart from this question, which doesn't provide a solution. I read this answer explaining what Illegal instruction means, the point is that I'm on the latest version of macOS High Sierra:
Am I misunderstanding what the answer is referring to?
Do you know how I could solve this issue? Or hopefully a workaround, so that I can start using tensorflow.
Thank you in advance.
I had the same issue, so what I did was uninstalled tensorflow 1.6. installed
pip install -Iv tensorflow==1.5
pip install -Iv numpy==1.13
seems to be fine now, my guess is there was the latest bug in tensorflow 1.6.
To make sure it's compatible with the pandas, you can do:
pip install -Iv numpy==1.13.3
It could not find 1.15 version for me as for #dfresh22, but that helped:
pip3 uninstall tensorflow
pip3 install -Iv tensorflow==1.5
Similarly, on Apple M1 with BigSur (Python 3.9), the Anaconda interface did complain about incompatible version of tensorflow for Python 3.9, pip did install from the terminal but I got "illegal instruction:4" message. Finally, the following command sorted out the necessary packages to install:
conda install conda-forge::tensorflow
the detail is here. This installation is an older version of tensorflow: tensorflow-2.7.0 .

Pip Install throws error code 1

Recently switched from MacOSX to a ThinkPad with Windows 10.
Installed Python 3.7, Pip 9
Attempted pip install jupyter and received the following error:
Command python setup.py egg_info failed with error code 1 in
C:\Users\BRIANM~1\AppData\Local\Temp\pip-build-greiazb7\pywinpty\
Uninstalled setup tools, upgraded setup tools, upgraded pip, ran as admin, all the traditional fixes are not working.
Anyone have a fix?
Check that you have installed the 64-bit version of python and try again with
pip3 install jupyter notebook
If it still doesn't work than I would prefer you to use Anaconda it offers the easiest way to install, run and update libraries and packages and virtual environments for windows.
It comes with jupyter notebook pre-installed. On the jupyter notebook doumentation page they also recommend installing it using anaconda
I had the same problem and I found a solution that worked for me. Instead of pip I used: py -m easy_install textract
You should downgrade to python 3.6.5 (after trying all ways you can find on the Internet).
Today, I install python 3.7.0b5 on a new computer(windows 10). Then pip install didn't work with this error code 1. I tried all methods I can find on the Internet. And still stuck here. So I downgrade to 3.6.5 which works well on my mbp. Finally, it works!!!

Categories