I am using Anaconda 4.3.1 64 Bit on Windows 10 64 Bit. I have successfully installed Tensorflow (CPU) according tothis. The test program runs in thecommand line, but not inPyCharm. The problem is that it works only withactivate tensorflow.
I followed the steps fromPycharm anaconda import tensor flow library issue ("You need to do these following steps:"). It seems now that tensorflow is loaded, but I get a new error:
ImportError: Importing the multiarray numpy extension module failed. Most likely you are trying to import a failed build of numpy. If you're working with a numpy git repo, try
git clean -xdf(removes all files not under version control). Otherwise reinstall numpy.
How can I use TensorFlow in PyCharm? (BTW: Tensorflow works with PyCharm on my Fedora VM.)
Edit:
Can I use TensorFlow with Jupyter? When running "Jupyter (tensorflow)" from the Anaconda menu, a console window opens and immediately closes.
4 Answers4
When PyCharm is open: if you navigate to preferences: Project: Project Interpreter. You can there either create your own virtualenv (and then manually install the required packages) or make sure you have selected the anaconda python interpreter for your project.
5 Comments
If followingofficial instructions, you have created a virtual environment calledtensorflow. The environment is located inAnaconda3\envs\tensorflow directory, whereAnaconda3 is the Anaconda installation directory. You just need to point PyCharm to thepython.exe which is located there.
The settings path in PyCharm is something like this:
Settings->Project Interpreter->Add Local->Virtualenv Environment->Existing environment
Point the interpreter to thepython.exe in theAnaconda3\envs\tensorflow directory.
Comments
I recommend installingbabun and creating avirtualenv withvirtualenvwrapper there and install on that environment.
After doing this, just choose thepython binary in the relevant directory of the virtualenv you created, i.e.~/.virtualenvs/myenv/bin/python or~/.virtaulenvs/myenv/usr/bin/python
2 Comments
virtualenv withvirtualenvwrapper? What shall I install on this environment?Before importing anything else, do this
import sysprint(sys.path)import osprint(os.environ)print(os.environ['CUDA_VISIBLE_DEVICES'])from the command line (when TF works) and from PyCharm (when it doesn't). If you see any relevant differences, adjust accordingly (define the environment variables in PyCharm, etc.)
Comments
Explore related questions
See similar questions with these tags.