I got error message when I am trying to setup tensorflow.
I examine a lot of discussion from github issues. I tried different versions but output doesn't change.
I saw this previous question in stackoverflow too but there is no answer avaliable.
I am trying to be more specific about error and platforms I am currently using and I hope someone help me or show me different approaches.
First of all I had python 3.6.x
but I deleted this version cause I want to make this setup clearly.
I downloaded Anaconda (Anaconda Python 3.7 version)
After that I checked my python version and its changed like 3.7 as I expected.
After that I follow the guide for setup tensorflow
conda create -n tf-gpu tensorflow-gpu
Because I want to use my gpu which is much faster comparing with CPU
(I already checked my gpu compability for tensorflow,I am currently using rtx 2060)
Summary:
-Anaconda Python 3.7 version
-Python 3.7.4
I solved my problem about insalling tensorflow maybe it will help other people.
Firstly, I just cleared my PATH under the Environment Variable which are related with Anaconda or you can delete Anaconda and reinstall.
After that open Anaconda command line and write:
pip install tensorflow-gpu
Related
I have just downloaded PyTorch with CUDA via Anaconda and when I type into the Anaconda terminal:
import torch
if torch.cuda.is_available():
print('it works')
then he outputs that; that means that it worked and it works with PyTorch.
But when I go to my IDE (PyCharm and IntelliJ) and write the same code, it doesn't output anything.
Could someone please explain to me how I can somehow get this to work in the IDE?
It was driving me mad as well... What finally helped me was the first link that says to use PyCharm "Terminal" to run the pip install command (from the PyTorch website). That fixed all my problems. (I had installed pytorch 3 times by that time and tried different interpreters...)
https://www.datasciencelearner.com/how-to-install-pytorch-in-pycharm/
pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio===0.8.0 -f https://download.pytorch.org/whl/torch_stable.html
I hope this helps save someone hours of headache. :)
I also spent over 10 hours trying to figure out what was wrong. I ended up checking if there is something wrong with interpreter.
What was the problem is version of python (I had v. 3.8). After upgrading to newest version, problem was solved.
Check your version using command:
python --version
If your version is old (current is 3.9.2), install newest one from official python site:
https://www.python.org/downloads/release/python-392/
After installation make sure you using newer version (use command above)
I had a similar issue.
Inspired by #the-lay answer, calling import os; os.system('') resolved my issue.
Another possible root of the problem is running a Flatpak version of Pycharm. Took me some time to figure out, but Flatpak does not load user specific environment variables files (i.e. ~/.profile, ~/.bash_profile and conda environment). I have deleted Flatpak version and installed a snap version (sudo snap install [pycharm-professional|pycharm-community] --classic) and it loads the proper PATH which allows loading CUDA correctly.
so I've been trying to use Keras with Miniconda on my machine for a few weeks now (in Rstudio) and I've still been unable to make significant progress.
Most recently, here are the steps I followed:
create an environment in Miniconda, using Python 3.6
Download R and RStudio (an older version, Version 3.6.0) into said environment and run them
Install Keras into the environment (after Rcpp, Devtools etc)
Attempt to install Tensorflow
But then I get the error message that my Python installation isn't found and the bindings aren't loaded.
I've put the environment on the PATH, as well as the location where Python is and some folders within the environment.
I followed the advice given in a comment in my last post, which helped me to create the environment, but now Python isn't loading in Miniconda and I'm so so frustrated that I haven't been able to make this work. Please help.
When I look for the Python version I get this:
C:\Users\NK>python --version [1] Python 3.8.4rc1
Here is the beginning of the code I'm running:
library(keras)
library(tensorflow)
library(reticulate)
use_python("C:\\Users\\NK\\AppData\\Local\\Microsoft\\WindowsApps", required=T)
Sys.setenv(RETICULATE_MINICONDA_PATH = "C:/mini/envs/r_3.6.0.1")
mnist <- dataset_mnist()
and I get this error:
Error: Installation of Python not found, Python bindings not loaded. Use reticulate::install_miniconda() if you'd like to install a Miniconda Python environment. even though I'm doing this entirely in a Miniconda environment. I'm even opening RStudio straight from the Miniconda command prompt.
Some basic info: Dell XPS 15 running Windows 10, using RStudio
Side question: Is there an easier way to do all this? It's been fatiguing.
I finally got it to work! Here were my steps for anyone who stumbles across this:
Reinstall Anaconda
Create Anaconda Environment with Python 2.7 and R
Install Keras and Tensorflow packages and dependencies one by one into the environment through Anaconda
Install RStudio in the environment through Anaconda
use use_python("[env]", required=T) and Sys.setenv(RETICULATE_MINICONDA_PATH = "[env]") in any scripts you run using Keras
I can't get tensorflow to work on two different Windows PCs and on both I get "ModuleNotFoundError: No module named 'tensorflow' when try to import them in python.
Numpy for example works on one machine not the other. Checked a dozen of posts on stackoverflow, nothing really helps. Clearly somethings wrong with the paths, can't really figure out what and how to trouble check it. I followed this set-up https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Installation-Windows.md
I need the 1.7.1 version of TF for Unity ML-agents to work
OS: windows 10
conda version : 4.4.11
conda-build version : 3.4.1
python version : 3.6.4.final.0
Even a clean install of Anaconda didn't help.
I finally managed to fix this (not with ML-agents, but that's a different story). I uninstalled Anaconda and Python as well as cleared the registry from all Python information. I had a previous installation of Python 3.7 and I'm guessing this might have caused some issues. Clean install of Anaconda with a 3.6 env and TF is working both with cpu and gpu support.
These problems often happen when you are on the wrong environment, or when you do not activate your environment. Please try the following steps and see if the problem persists:
Open Anaconda prompt
Activate the environment in which you installed tensorflow by using conda activate YOUR_ENV_NAME
Type python to launch python
try to import tensorflow
And see if the error persists.
This is my first question on stackoverflow, please bear with me as I will do my best to provide as much info as possible.
I have a windows 10, 6-bit processor. My end goal is to use keras within spyder. The first thing I did was update python to 3.6 and install tensorflow, which seemed to work. When I attempted to get keras, however, it wasn't working, and I read that keras worked on python 3.5. I successfully installed keras on python 3.5, which automatically installed theano as the backend.
But now I have two spyder environments, one running off of python 3.5, one off of 3.6. The 3.5 reads keras but doesn't go through with any modules because it cannot find tensorflow. The 3.6 can read tensorflow, but cannot find keras.
Please let me know what you would recommend. Thank you!
Create a virtualenv with python 3.5 installed.
I dealt with this same issue, using Jupyter Notebook. Didn't understand why you would even need a virtualenv until I learned from this roadblock.
Full details on installing and setting up a virtualenv can be found here:
http://pymote.readthedocs.io/en/latest/install/windows_virtualenv.html
Odd, the installation instructions say that TF only supports Python 3.5 on Windows. I would uninstall TF with pip uninstall tensorflow (if you installed it with pip to begin with) using pip from your Python 3.6 path, then re-install (pip install --upgrade tensorflow) making sure that you are running pip from your Python 3.5 path.
I had some issues with my tensorflow's installation too.
I personnaly used anaconda to solve the problem.
After installing anaconda (Maybe uninstall the old one if you already have one), launch an anaconda prompt and input conda create -n tensorflow python=3.5, afther that, you must activate it with activate tensorflow.
Once it's done, you have to install tensorflow on your python 3.5.
For that, use:
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.2.0rc1-cp35-cp35m-win_amd64.whl
for cpu version
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.2.0rc1-cp35-cp35m-win_amd64.whl for gpu version
You now have the r1.2 version of tensorflow.
Then, just use pip install keras and keras will be installed.
Now, all you have to do is launch anaconda navigator, select tensorflow on the scrolling menu and launch spyder/jupyter.
You can now use Keras with a tensorflow backend in Python 3.5
Hope it helped someone ! (It take me so much time to find it by myself)
I'm currently running Matplotlib 0.99.1.1 on Ubuntu 10.04 LTS (Lucid Lynx).
I would like to upgrade Matplotlib to version 1.1.0. I have tried following the
instructions at SourceForge, which didn't seem to do anything (IPython still thinks I have version 0.99.1.1).
I have tried searching for how to do this another way but, being relatively new to Linux, am a little confused what I need to do now. I have tried a few suggestions on the forums but still I cannot seem to install Matplotlib-1.1.0
This thread for example doesn't seem to work for me (pip complains of an "Unknown or unsupported command 'install'").
Any help is much appreciated!
Unless my memory fails me completely, I followed the build from source instructions you link to on two Lucid systems of mine. These instructions, to be precise:
http://matplotlib.sourceforge.net/users/installing.html#installing-from-source
Worked like a charm, after I remembered to do python setup.py install. And, yes,prior to the install, I removed the 0.99 matplotlib via synaptic. Did you try removing the older version first?
https://launchpad.net/ubuntu/oneiric/+source/matplotlib
There is a section for binary builds, just grab the appropriate package for your system architecture and dpkg -i the_package_name.deb
I'm not sure what went wrong with my system, but the issue resolved itself. Either one of the procedures I followed while searching for an answer worked, or the build from source instruction worked.
Perhaps my computer just took a while to realise I did in fact have the newest version installed.
For future reference, I would follow the install from source instructions on the matplotlib site at SourceForge, noting the answer by Zhenya.