I am having problems with uninstalling TensorFlow.
I have a Python script that uses TensorFlow. I want it to use TensorFlow1.15, but it is currently using TensorFlow 2.1.0. I deleted TensorFlow via my cmd: pip uninstall tensorflow and pip uninstall tensorflow-gpu. When I run these commands again it says that TensorFlow is not installed. However, I can see that my script says it is using TensorFlow 2.1.0 (I added the line:print(tf.__version__) in my script). Does anyone know where this TensorFlow 2.1.0 is installed and how I can delete it from my PC?
Also you can downgrade tensorflow by this command in Pycharm terminal :
python -m pip install --user --upgrade tensorflow==1.15
It can also be used for other libraries.
This problem means that you use different pythons in your terminal and your script.
You mentioned PyCharm. By default, it creates a virtual environment for a new project. It also can use your global python. In any case, open a terminal in PyCharm (it should be in the bottom of the window or View -> Tool Windows -> Terminal or Option + F12 on Mac, Alt + F12 on Windows). From there you should run pip uninstall tensorflow. PyCharm automatically activates the correct python environment in the terminal.
From the above-provided information it is difficult to ascertain the scenario in which you are trying to uninstall.
I suggest creating a new python environment for your project using anaconda-
follow these steps -
download exe file for Anaconda website
install it.
open cmd
create new env using this command conda create -n yourenvname python=3.6
install tensorflow 1.15 by conda install tensorflow-gpu==1.15
go to pycharm select your new conda environment.(File -> setting -> project -> project interpreter - > insert path for env)
your env in windows might be in windows installation drive - > users -> anaconda3 -> envs
File ->Setting
Now you '+' button on rightmost tool bar "click" it
finally installed package
if still package is not installed or pycharm showing error then you have to remove tensorflow from base root and reinstall it
Related
i have Conda installed and Python installed separately, when i run .py file it is referencing to python's packages not from Conda so some pkg are missing(pandas), Conda has pandas but not Python. all default installations are go to Conda pkg files. how do i install pandas to Python that is not in Conda?
To run a file from conda, simply go to your anaconda prompt and cd into the drive. Similarly, you can search for your python prompt from the start bar and run code from there.
To install pandas into your python installation type:
pip install pandas
If you are running code from an IDE or code editor, you need to go into your settings and change the default runtime environment to anaconda. Even easier, open your anaconda navigator and then run your editor from there.
Your conda installation can't not have python, although it might be running the wrong version of python for your code. To change the version of python type:
conda install python=$pythonversion$
into your conda prompt.
I'm trying to import tensorflow in PyCharm, however I get an error that the module is not found.
I used pip install to install tensorflow.
Also when I look at the interpreter in PyCharm it says I have pip version 9.0.1 and the latest is 10.0.1. I have upgraded to 10.0.1 using the pip commands, and when I run pip --version it says I got 10.0.1.
I have tried both reinstalling pycharm and making new projects with no luck.
Go to Files -> Settings -> Project:projectname -> Project Interpreter
It's possible, that there is a different interpreter choosen for your project then the one you installed tensorflow in.
If you're running on linux you can check with "which pip" the path to your python distro in which you installed tensorflow.
This video explain it on a very simple way: https://www.youtube.com/watch?v=K9ypGzuP6xQ
Basically, TensorFlow is not by default installed on PyCharm virtual environment. You can do it by downloading in the Project Interpreter menu
try cleaning System Cache
On the main menu, choose File | Invalidate Caches/Restart.
The Invalidate Caches
Cleaning Cache
I just installed PyCharm and Anaconda. I installed PyTorch to Anaconda and i can even use "import torch" in Anaconda. I've created a new Project in PyCharm with the Anaconda Interpreter but i still can't use PyTorch in PyCharm.
I had this problem also. Program that imported torch worked fine at anaconda prompt running in my pytorch env, but when i ran pycharm from the windows shortcut and EVEN set my environment to use pytorch env, it would complain torch could not be imported.
When i ran pycharm from the prompt as shown, it worked.
If you used a bash script and the conda environment to run python codes in your PyCharm IDE.
You also need source activate myenv in your bash script.
Like this:
#!/usr/bin/env bash
source activate myenv
python test.py
source deactivate
I got the same problem and you that how i solved the problem:
1- when you open project choose conda as your project interpreter as shown here
2- in your project go to setting -> project: project name -> Project Interpreter check that you are using Conda Package Manager and your anaconda local settings
I got same problem and solved it:
After you installed anaconda, source activate your own envrionment.
Install pycharm-community and pytorch follow their official instructions.
Start pycharm-community in the same anaconda environment.
Loading your own project, followed instructions as Manuel Lagunas
Finally, you have to install packages of torch in the environment of pycharm: pictures as:
press '+' on the right side to install
you can choose packages of torch by typing 'torch'
Finally solved this in Windows 10 after sinking an entire morning into it.
Create a new Conda environment (via PyCharm or however you fancy)
Navigate to C:\Your\Environment\Path\Scripts in a command terminal
Mine looks like this: C:\ProgramData\Anaconda3\envs\Snek_V2\Scripts
Find what commands you would need for a pip install from the PyTorch website
They'll look something like this:
pip3 install https://download.pytorch.org/whl/cpu/torch-1.0.1-cp37-cp37m-win_amd64.whl
pip3 install torchvision
In the command terminal, you want to enter those commands with one difference; you'll need to replace pip3 with pip.exe. As you've navigated to the exact environment you plan to work in, this will be the pip relevant to you.
e.g. pip.exe install torchvision
Open PyCharm and open the project that's working in the Conda environment we just set up.
If you open up a Python Console, you should now be able to enter import torch and not have any errors pop up in response.
I'm currently using Windows 10, and installed Pycharm and Anaconda on it in order to run Tensorflow. Everything is working well, I can select conda interpreter and then use the following command to install and run tensorflow.
pip.main(['install', 'tensorflow'])
My only problem is, everytime I create a new project in pycharm, I need to do this installation command again. Is there a more permanent method to do the installation in my case?
Thanks.
EDIT:I installed the package inside Pycharm as shown in this video
Install Video
First you need to build a TensorFlow virtual environment in Anaconda Navigator in the anaconda3 directory.As shown in the figure:anaconda navigator,environment about tensorflow.You can create a Tensorflow environment on the command line and install pycharm as a pip in this environment. This will allow you to use Tensorflow in pycharm.The code is as follows:
conda create -n tensorflow python=3.5
activate tensorflow
pip install --ignore-installed --upgrade tensorflow-gpu
This is a Chinese version of the installation instructions for TensorFlow + pycharm.installation instructions
Pip Installed tensor flow (CPU only... https://www.tensorflow.org/install/install_windows) in an anaconda environment, says it successfully installed but when I go to use tensor flow (with environment activated) it displays an error saying "ImportError: No module named 'tensorflow'".
However, After i installed pandas package, and it successfully runs. i ran an update to python=3.5 for the environment (because my anaconda is 2.7 version), and tried using this link https://github.com/tensorflow/tensorflow/issues/6136 for help also. Weird that other packages run but not tensor flow. Using a PC windows 10 with intel CPU and amd graphics. Any suggestions would be helpful.
First check which environment you are using right now.
If it helps open the anaconda navigator and see whether you have TensorFlow installed in the "installed" tab of that particular environment.
Check the following on jupyter noteook and see what python version you're using in that environment because the environment that you are using might have a different python version after all.
from platform import python_version
print(python_version())
If the versions are different, try removing the TensorFlow installation and reinstalling it according to your python version. environment and recreating the same environment pip install --ignore-installed --upgrade tensorflow=='version_for_your_requirement"
If the situation is still there, https://www.youtube.com/watch?v=tPq6NIboLSc see here the steps followed in the video. Though its a slightly different scenario, you will get the gist of it pretty quickly as to how we can make another environment for our work and about installing TensorFlow properly.
Tensorflow supports 64-bit Python version. Make sure you have installed 64-bit Python 3.5/3.6/3.8 version.
Install Tensorflow using following steps
#check current python version
python --version
#Create the virtual environment
conda create -n tf python=PYTHON_VERSION
#Activate the tf environment
conda activate tf
#Install Tensorflow
pip install tensorflow