Installing tensorflow on Pycharm (Mac) - python-2.7

I was trying to use tensorflow in Pycharm IDE.
It seems that in Pycharm, it is one-click to install a package. It was very easy with bumpy. Now error occurs when I was trying to install tensorflow.
Tensorflow was installed through terminal on Mac, as screenshot shows, using the command
sudo pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.8.0-py2-none-any.whl
(Refer to https://www.tensorflow.org/versions/r0.8/get_started/os_setup.html#pip-installation)
Any suggestions ? Thanks.

If you install tensorflow with the virtualenv option and want to use it from Pycharm for a project, you need to set up a corresponding virtualenv interpreter. There are a few solutions on the forum, for example How to get VirtualEnv TensorFlow to work in PyCharm?, however, that one didn't work for me with a "python packaging tools not found pycharm" error.
This is a working solution for me, first create a virtualenv from Pycharm and then install tensorflow there:
In Pycharm, Preferences -> Project interpreter -> Create VirtualEnv -> give the virtualenv a name and location of your choice, and select "inherit global site-packages" option -> OK.
In command line, install tensorflow in the virtualenv location you created in Step 1. For the above case, the location is ~/tensorflow_pycharm, therefore, run command virtualenv --system-site-packages ~/tensorflow_pycharm
In Pycharm, select the created project interpreter, and select the tensorflow package, double click to install the package.
If Step 3 is successful, set run configuration, and try run a sample program.

Update - Nov. 1, 2017:
Tried successfully with Latest Jetbrain PyCharm Community Edition (2017.2.4) and Python 2.7.14, with Installing with virtualenv of https://www.tensorflow.org/install/install_mac.
Install tensorflow with virtualenv
Add Local to Project Interpreter.
Run the script
Generate graph
Run tensorboard --logdir=/tmp/tensorflow_logs in Terminal of PyCharm

Go Preferences and search for the interpreter. You may see several interpreters. Select any interpreter which has the tensorflow package installed.
Check out the installed packages and double check the versions of tensorflow as shown in this picture.

To summarize (on Mac) :
Step 1, get latest Python (2.7.11 today) on Pycharm:
Pycharm, can not find Python version 2.7.11
Step 2, follow "Pip Installation" of https://www.tensorflow.org/versions/r0.8/get_started/os_setup.html#download-and-setup
Step 3, Pycharm-- preference -- project interpreter, install the latest versions of numpy, protobuf, six.
Tensorflow import error on Pycharm (Mac)
Note, maybe have to click the "specify version" when installing.
Step 4, Pycharm-- preference -- project interpreter, install the latest version of tensorflow (v 0.8.0 today).
Note, if not find v0.8.0, then maybe have to manually click "Manage Repositories" and then add the link of Step 2 (https://storage.googleapis.com/tensorflow/mac/tensorflow-0.8.0-py2-none-any.whl)
These steps worked well on both Mac computers of mine. Thanks for all helps during the procedure from contributors.

Steps I followed
1. Use the virtualenv option in tensor flow's official guide for installation and follow the steps exactly to install and set up tensor flow. Although we've already created a virtual environment here, I created a separate one for Pycharm projects.
This is how you do it.
1. Create a new project. Go to Preferences. Go to interpreter and create a new virtualEnv. Give it a name and check on the box "inherit global site-packages". Press "OK".
creating a virtualenv
Below are a list of Packages. Here's where I couldn't find tensor flow initially. If this is the case, there's a + symbol on the bottom left. Click on it and manually search for "tensorflow". Click on "install package" on the bottom left.
installing tensorflow package
After the installation is done press OK.Close this screen. Tensorflow will now appear on the installed packages list.
Press ok. Now test your installation with a program.
import tensorflow as tf
hello = tf.constant("hello TF")
sess = tf.Session()
print(sess.run(hello))
Hope this helps.

Related

Error in installing Flask_mysqldb in PyCharm

Hi everyone I am installing Flask_mysqldb in Pycharm and I am experiencing problem.
Is seems to be the only library that I am not able to install.
can you please check the details on the installation panel down there.
Another way to install package is to open terminal tap down on left of package tap and run this command
pip install flask-mysqldb

how to run a django project (made on linux) on windows?

I am new to programming and started working on Linux, now I want to switch to windows and open my project there, look at the tutorials, it is written to activate the virtual environment in the Settings / activate.bat folder. but in my project there is no such folder and such file with the extension .bat. what should I do?
Please download & Install interpreter from https://www.python.org/downloads/
(make sure you are using windows 10, because previous
version create problems)
Download pycharm professional addition (if you have university account) other wise go for community https://www.jetbrains.com/pycharm/download/
Click for Django project
Set the interpreter
Go to. manage.py task
Run command migrate
Enjoy
First thing get all the requirements like the library you installed through pip inside
a txt file by writing this command pip freeze > requirements.txt.
Get only the source folder where you made the project and app.
Create a folder.
Create an environment inside the folder. (virtualenv name_of_the_env)
Go inside the env you created and activate the Script. (.\Scripts\activate)
Copy the source folder inside the env and either you can install all the library
manually using pip or you can use requirement.txt that you have created to install the
library by writing this command pip install -r requirement.txt.
You need python and pip installed to work

Unable to Launch RIDE from command prompt

I want to start using the RIDE tool for automation but I am currently unable to launch it from the command prompt. The following are what I have installed.
Python 2.7.11 (32bit)
Wx Python 2.8.12.1(unicode) for Python 2.7
robotframework 3.0.2 (pip installed)
robotframework-ride 1.5.2.1 (pip installed)
When I launch ride.py from cmd, it opens up a word file which has the same ride.py which is installed in the C:\Python27\Scripts folder.
The same setup works on a different machine. I don't understand why in this machine, it opens up a word document instead of launching RIDE
Do a right click on ride.py and choose python as default program.
in my machine python 2.7.15 is auto updated from 2.7.14. When to try to launch Ride.py it throws an error
wxPython not found.
You need to install wxPython 2.8.12.1 or 3.0.2 or newer with unicode support to run RIDE. wxPython can be downloaded from http://sourceforge.net/projects/wxpython/files/wxPython/
Although is wxpython 2.8.12.1 installed its doesn't recognize it. can anyone help out how can i over come this issue.
I have Ride 2.0a1. should I downgrade ride or how can i fix this issue.

PyCharm doesn't use selected virtualenv

PyCharm seems to ignore the configured virtualenv,
and use the base interpreter instead.
In my project at /Users/janos/dev/git/github/bashoneliners I have a virtualenv subdirectory, strictly with my project's dependencies installed in it:
$ . virtualenv/bin/activate
(virtualenv)janos at kronos in ~/dev/git/github/bashoneliners on master
$ pip -V
pip 1.5.6 from /Users/janos/dev/git/github/bashoneliners/virtualenv/lib/python3.4/site-packages (python 3.4)
(virtualenv)janos at kronos in ~/dev/git/github/bashoneliners on master
$ pip freeze
Django==1.9
Markdown==2.6.5
PyJWT==1.4.0
defusedxml==0.4.1
oauthlib==1.0.3
pep8==1.6.2
pyflakes==1.0.0
python-social-auth==0.2.13
python3-openid==3.0.9
requests==2.9.1
requests-oauthlib==0.6.0
six==1.10.0
tweepy==3.5.0
But if I add this virtualenv as Project Interpreter in PyCharm,
it shows completely different packages:
These packages are the same as in my system's base interpreter /opt/local/bin/python. This drives me nuts, I really need to use the packages from the virtualenv, not from my system.
This is with PyCharm Community Edition 5.0.3.
I didn't have this problem before with older versions of PyCharm.
I tried creating a completely new virtualenv,
both on the command line and using PyCharm,
and invalidating caches and restarting, but nothing seems to work.
PyCharm always shows the same list of packages,
and the packages of the virtualenv.
Even if I create an empty virtualenv within PyCharm,
it doesn't start empty, but filled with the same list of packages.
My project works perfectly when I run things on the command line,
such as running Django management commands, unit tests, everything.
I only have problems in PyCharm.
If I try to install packages, for example Django,
using PyCharm,
I get this error:
Of course permission denied on /opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages, that's the system interpreter.
It should be trying to install the package there,
but in /Users/janos/dev/git/github/bashoneliners/virtualenv.
Clearly it's not using pip from the virtualenv, but from the system.
I need to make to use the one from the virtualenv.
This is logged as a bug in the issue tracking system of JetBrains,
so hopefully it will get sorted out soon.
https://youtrack.jetbrains.com/issue/PY-18074
A possible workaround is to fall back to a previous version of PyCharm:
https://confluence.jetbrains.com/display/PYH/Previous+PyCharm+Releases
As of 2016 Jan 6, virtualenv works fine for me in PyCharm 4.5.4.
Some of the virtualenv previously registered using PyCharm 5.0.3 appear invalid, but that's fine. I actually deleted all registered interpreters and re-added only the virtualenv I needed.
An odd thing with this older version is that sometimes PyCharm shows the incorrect Python version (2.7 instead of 3.5), but it shows the correct list of modules as per the virtualenv, and the editor doesn't show build errors, so the Python version mixup doesn't seem to cause problems (just a bit scary).

Fail to install Python 2.7.9 on a Windows google compute engine instance

I fired up a new Windows google compute engine instance. It's running Windows 2008 R2, service pack 1.
I download and try running the Python .msi installer for version 2.7.9, and it fails with this error:
There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor.
I see this error for both the 64-bit and the 32-bit installer.
Has anyone else seen it or know of a work-around?
I reproduced your issue and I found two workarounds:
You can install python 2.7.6 successfully without further action.
If you need python 2.7.9 you can install it deselecting pip from the install menu.
This seems to be related to this answer in another thread although in that case the issue is with version 3.4.
Install python EXCEPT "pip"
Run the python install msi again and select "change"
Select "pip" and install the pip
It would be works...
I think it is a priority problem into the msi package...the package seems to try to install the pip before installing python.exe. So, pip can not be installed...
I'm using Windows 8.1 64-bit. I had 2.7.11 installed and then I tried to install PIP as well via Chocolatey PIP package.
I think my installation had got messed up because I had tried to install Python 3.4 as well as Python 2.
Then I had deleted all the Python 2 and Python 3 files in an attempt to get rid of this.
What worked for me was:
Editing the Environment Variables both, System and User to remove any PYTHONHOME or PYTHONPATH variables
I also deleted the path I had to python2 in the PATH environment variable
Now (as mentioned in Python Issue 22329) after deleting the Environment variables you can go into 'Programs and Features', click on the Python 2.7.11 (64-bit) program and then click 'Repair' - this then worked as I would expect without error.
Now finally I was able to go into 'Programs and Features', click on the Python 2.7.11 (64-bit) program and then click 'Uninstall'.
Edit: I assume this is connected with this PYTHON_HOME answer to a problem with Python 3.4
It seems to be a dependency issue, please try to install "Microsoft Visual C++ 2008 SP1 Redistributable Package (x64)"