0

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?

rajah9
  • 11,645
  • 5
  • 44
  • 57

4 Answers4

2

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.

Mohsen Hrt
  • 263
  • 2
  • 9
0

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.

Yevhen Kuzmovych
  • 10,940
  • 7
  • 28
  • 48
0

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 -

  1. download exe file for Anaconda website
  2. install it.
  3. open cmd
  4. create new env using this command conda create -n yourenvname python=3.6
  5. install tensorflow 1.15 by conda install tensorflow-gpu==1.15
  6. 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

Mukul
  • 860
  • 8
  • 19
  • I have installed anaconda. When I run 4 in anaconda, besides saying I need to update anaconda. When running 5, it says: PackagesNotFoundError: The following packages are not available from current channels: - tensorflow-gpu==1.5. Lastly, how do I select conda environment in pycharm? – Frederique Voskeuil Jan 20 '20 at 14:07
  • Try conda install -c default tensorflow-gpu==1.15.0 also conda update conda to update anconda packages – Mukul Jan 20 '20 at 14:21
  • I have mentioned how to choose anaconda on pycharm in point - 6 – Mukul Jan 20 '20 at 14:22
  • I am sorry but I don't understand point 6. I have successfully installed tensorflow 1.15 now. Should I import the env package in my interpreter? – Frederique Voskeuil Jan 20 '20 at 14:37
  • Yes there is a + button in add env option there you can choose the path of the env ( select add existing environment ) – Mukul Jan 20 '20 at 14:51
  • Yess it worked! However I can't install packages anymore. I use numpy, matplotlib, PIL, tensorflow, cv2 and utils. When I try to download any of them I get an error:CondaHTTPError: HTTP 000 CONNECTION FAILED for url – Frederique Voskeuil Jan 20 '20 at 15:05
0

File ->Setting enter image description here

enter image description here

enter image description here

enter image description here

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

Welcome_back
  • 1,245
  • 12
  • 18
  • Thanks for your comment! I did this, but when I print my tensorflow version, I still have 2.1.0 – Frederique Voskeuil Jan 20 '20 at 14:43
  • I am making a program that can detect objects. I have an attribute error: tensorflow has no attribute 'graphdef'. Someone else helped me and told me I have the wrong version of tensorflow. According to him I need tensorflow 1.15. When I print: print(tf.__version__), in my program it says: 2.1.0, so the program says I have tensorflow 2.1.0 – Frederique Voskeuil Jan 20 '20 at 14:48
  • I also face this problem Do not try to switch to tensorflow==2.0 you should update your code that's what i did – Welcome_back Jan 20 '20 at 14:53
  • https://stackoverflow.com/questions/59822617/python-tensorflow-has-no-attribute-graphdef-and-cudart64-101-dll-not-found/59823086#59823086 visit this may be help you – Welcome_back Jan 20 '20 at 14:54