3

I try to install tensorflow via virtualenv in mac, the reference is here:

  • for I have python already, so I install virtualenv by: sudo pip install --upgrade virtualenv

  • build a new virtualenv environment in ~/development project/tensorflow, not in ~/tensorflow as is said in the reference:

    virtualenv --system-site-packages ~/development project/tensorflow

    cd ~/development project/tensorflow

  • active virtualenv by:

    source bin/activate # if use bash,and I choose this line to run

  • when I am in virtualenv and run this:

    (tensorflow)$ pip install --upgrade <$url_to_binary.whl>

    it comes out an error:

    zsh: parse error near '\n'

  • then I check here to help solve it it says that <$url_to_binary.whl> should be replaced by https://storage.googleapis.com/tensorflow/mac/tensorflow-0.5.0-py2-none-any.whl, and I do so. And problem gone.

  • but, when I try to test tensorflow by cd some dir in tensorflow like:

    (tensorflow)$ cd tensorflow/models/image/mnist

    the dir is not exist.

    so I guess the url I modified cause it, and I try to reinstall virtualenv and tensorflow, to make my install clean.

  • tensorflow is successfully uninstalled, but when I remove virtualenv, it booms:

Exception: Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args) File "/usr/local/lib/python2.7/site-packages/pip/commands/uninstall.py", line 76, in run requirement_set.uninstall(auto_confirm=options.yes) File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 346, in uninstall req.uninstall(auto_confirm=auto_confirm) File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 754, in uninstall paths_to_remove.remove(auto_confirm) File "/usr/local/lib/python2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove renames(path, new_path) File "/usr/local/lib/python2.7/site-packages/pip/utils/init.py", line 267, in renames shutil.move(old, new) File "/usr/local/Cellar/python/2.7.12_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 303, in move os.unlink(src) OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/site-packages/virtualenv-15.1.0.dist-info/DESCRIPTION.rst'

  • I delete dir tensorflow
  • for now I could not uninstall virtualenv neither install it, but it still exist....that's really wired.

  • If I run sudo pip install --upgrade virtualenv again, it says:

The directory '/Users/Calvino/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/Users/Calvino/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Requirement already up-to-date: virtualenv in /usr/local/lib/python2.7/site-packages

My question is that how could I remove virtualenv and tensorflow thoroughly and reinstall them.

I would be very appreciate if anyone could help.

Community
  • 1
  • 1
Calvino Shaw
  • 481
  • 1
  • 7
  • 10

2 Answers2

0

have been two years but anyways yo need to uninstall with > //Reinstal python 2 or 3 with new SO update

brew update
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
brew reinstall python@3

Reference

then reinstall tensorflow with> https://www.tensorflow.org/install/pip

-1

Now, you just need to run:

 (tensorflow)$ pip install --upgrade tensorflow      # for Python 2.7
 (tensorflow)$ pip3 install --upgrade tensorflow     # for Python 3.n

And remove by: (this is for virtualenv, you change the path, following path also should be changed to ~/development/project/tensorflow)

 $ rm -r ~/tensorflow 

If you install tensorflow with native pip:

$ pip uninstall tensorflow
$ pip3 uninstall tensorflow 

More information: https://www.tensorflow.org/install/install_mac

AurevoirXavier
  • 2,543
  • 2
  • 17
  • 25