Install TensorFlow With Python 3.7
- MadThink

- May 8, 2019
- 3 min read
If you're like me, you just recently became interested in learning Machine Language or programming with Artificial Intelligence. You just downloaded pycharm or sublime text or visual studio code (or maybe you had it already) and you start researching the best ways to get started with your grand ideas. After a short amount of research and on the back of hundreds of glowing recommendations, you download Tensor Flow for Python.
Except there's just one thing. It doesn't work.
Welcome to T e n s o r F l o w .

I literally spent hours trying to figure out this setup. I consulted forums, read the TensorFlow documentation, scoured Stack Overflow, and nearly split my computer in HALF trying to finalize my initial installation. I am NO stranger to troubleshooting problems. Heck, my entire life on the web has been wrought with error codes and failed download statuses. I have a personal running joke with the 404 NOT FOUND screen that seems to follow me wherever I go.
That said, this one was a doozy. In retrospect, I may have been too eager to try some of the "solutions" suggested online. I have several projects already using Python on my system, and of course being absolutely devoid of patience or wisdom, I just went ahead and modified or deleted Python half the time without even knowing what I was doing to it.
I don't want you to go through the same situation. Let me break down what I learned and what you should avoid when going through the process of installing TensorFlow through Python 3.7.
The TensorFlow Docs

I will take the time to update this blog post at a later date, but currently I'm assuming that you will not be installing the new version 2.0 alpha.
I'm making a formal request to whoever manages the TensorFlow documentation... It was fine and dandy, but please mention this issue on your page. This is such a common issue for anyone attempting to install TensorFlow and it's such a pain to troubleshoot. Just do us all a favor and add a solution. Heck, link this blog post. I certainly don't mind.
The docs start off by listing the available versions and packages of TensorFlow. Assuming you have a computer made on planet Earth, you'll probably be using Windows or Ubuntu. If you're using a mac, go ask Tim Cook.
(In all honesty mac users, these steps should work for you as well. Please leave a comment if you have any questions.)
Regardless, you'll be going with:
tensorflow —Latest stable release for CPU-only (Ubuntu and Windows)
--Ignore the GPU version for now. I'd rather go beat Sekiro: Shadows Die Twice blindfolded before trying to get that mess to work.
Before we continue with TensorFlow let's install Python.
Python Installation (version 3.7.3)
Here's a mediafire link where I've hosted the installation file:
http://www.mediafire.com/file/3xz0hciyrzusarg/python-3.7.3-amd64.exe/file
you'll find the same one on their website, but it's very important which one you choose. This package comes with a suite of additional downloads. Once that's installed you're pretty much all set.
--upon installation, open your terminal as an administrator and type "python" to make sure it shows up. If python doesn't function, then you may need to add it to your environment variables. You can do so by opening the installation wizard again and selecting modify. Hit Next and there you'll find several options to check off.

Virtual Environment
Another mistake I made on my initial setup was not adhering to a virtual environment. The TensorFlow page details pretty well how to create. I figure I'll just take this opportunity to explain a bit more about it.
A virtual environment is almost like another machine that houses all the packages and dependencies you'll be using. By using venv you'll be able to install whatever version of you'll need of anything without disrupting your main system.
virtualenv --system-site-packages -p python3 ./venvThis step is rather painless, as it simply installs whatever site packages you may have on your system already onto the virtual machine that's created. You'll then be able to use a suite of commands to control your virtual machine once you activate it.
If you're using windows, in order to activate your venv, use the command:
.\venv\Scripts\activateThis simply runs the script that installs when you instantiate your virtual environment folder. This will turn your terminal into a venv terminal, with which you can perform many commands to manage your venv.
Conclusion
Yep, that's pretty much it. From there you can easily follow the TensorFlow guidelines to install the latest stable version of TensorFlow and it should show up just fine. If you followed this guide then your installation was probably a lot easier than mine.
This was a triumph. But the cake was a lie.




Comments