uninstall virtualenv in mac - tensorflow

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.

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

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

Related

Cannot uninstall numpy 1.21.2, RECORD file not found

I encountered a problem while installing
pip install pytorch-nlp
The erro is as follow:
ERROR: Could n`ot install packages due to an OSError: [Errno 2] No such file or directory: 'c:\\users\\pcpcpc\\anaconda3\\envs\\pytorch\\lib\\site-packages\\numpy-1.21`.2.dist-info\\METADATA'
SO I tried to reinstall numpy by
pip install --force-reinstall --no-deps numpy==1.21.2
But I get the error:
ERROR: Cannot uninstall numpy 1.21.2, RECORD file not found. You might be able to recover from this via: 'pip install --force-reinstall --no-deps numpy==1.21.2'.
As #Phoenix suggested, you might have an incomplete installation of numpy in your site-packages folder.
Find your site-packages folder.
SITE_PACKAGES_FOLDER=$(python3 -c "import sysconfig; print(sysconfig.get_paths()['purelib'])")
echo $SITE_PACKAGES_FOLDER
Check for extraneous numpy packages from your site-packages folder.
ls $SITE_PACKAGES_FOLDER/numpy*
Trash extraneous packages.
pip install trash-cli
trash $SITE_PACKAGES_FOLDER/numpy*
Reinstall numpy.
pip install --upgrade numpy
Try manually deleting the numpy files/directories and then do
pip install --upgrade --force-reinstall <package>
One way to find the numpy files is to run
python -c "import numpy; print(numpy.__file__)"
For example, this prints out
/home/tink-user/workspace/.conda_envs/tink-payment-categorization/lib/python3.7/site-packages/numpy/__init__.py
for me. So you can go there:
cd /home/tink-user/workspace/.conda_envs/tink-payment-categorization/lib/python3.7/site-packages
then you can check with something like this to see which numpys are there:
ls numpy*
ls | grep numpy
Delete the numpy directories and try force reinstalling (pip install --upgrade --force-reinstall <package>).
Conda
This also happened to me in a conda environment after I ended up with multiple numpy installations and tried to manually delete them by removing the directories in site-packages. I had to force reinstall with conda (I think after manually deleting the directories for numpy): conda install numpy --force-reinstall.
None of the above solutions worked for me
What worked for me:
Delete that particular folder from the site-packages
Only delete the folder with the version number and not the folder that has python modules and files
Delete that folder with metadata files matching the numpy version in the warning and error message in the installation traceback
re-install the package
pip install numpy just as you would do
this work for both cases
global environment
local or project related environment
** else you will have delete that environment and create a new one **

Error intsalling tensorflow via pip install

WARNING: Failed to write executable - trying to use .deleteme logic
ERROR: Could not install packages due to an EnvironmentError: [WinError 2] The system cannot find the file specified: 'c:\python38\Scripts\chardetect.exe' -> 'c:\python38\Scripts\chardetect.exe.deleteme'
I was trying to install Tensorflow via command pip install tensorflow. and after downloading everything at the end found this error..can anyone tell me why this happened?
According to https://www.codegrepper.com/ you can use these two:
In Windows
python -m pip install -U pip --user
In Linux
pip install -U pip --user

No module named tensorflow even after installing with pip

I'm trying to follow this guide to test this new algorithm: https://github.com/lalonderodney/SegCaps
I can't do it in my PC, so i'm using another server with Putty. Now I'm connected with the other server.
First of all I installed TensorFlow as indicates in the guide with :
pip install -r requirements.txt
After I wrote this code: ./main.py segcaps.png
in which segcaps.png is the image that i want to use
Finally I wrote python main.py --data_root_dir data
that is the only required parameter with the directory containing imgs and masks folders.
Now it gives me an error:
ModuleNotFoundError: No module named 'tensorflow.python.framework'
I searched it in the directory tensorflow/python/framework and it exists.
So, i don't know how to solve it. Ideas?
If you have multiple Python versions installed, then you'll (most likely) have multiple pip versions installed too. Make sure that the pip command you use installs the package(s) into the Python version you want it to. It may so happen that the package got installed into python2 but you wanted it in python3.
Since using pip did not install the packages in python3, pip3 is most likely to the PyPI for python3. Try
pip3 install -r requirements.txt
and that should work.
In case you have an EnvironmentError you can try this (bad idea):
pip3 install -r requirements.txt --user
This solves the problem most of the times on standalone machines. I'm not sure about the server; insufficient permissions might block this.
Why is the --user flag a bad idea? Read: What is the purpose “pip install --user …”?
You can use pip show tensorflow to see if it is installed or not.
As for ModuleNotFoundError try uninstalling keras and reinstalling an earlier version by pip install keras==2.1.6

PIP install pandas not working

I am trying to install pandas with .whl file in a work computer but I get " cannot fetch URL" error. I have up to date version of PIP installed.How can I get this to work.I'm using Python 3.5.Any help will be appreciated.
I just used the following which was quite simple. First open a console then cd to where you've downloaded your file like some-package.whl and use
pip install some-package.whl
python -m pip install some-package.whl also works if pip is not found in PATH
Note: if pip.exe is not recognized, you may find it in the "Scripts" directory from where python has been installed. If pip is not installed, this page can help:
How do I install pip on Windows?
Note: for clarification
If you copy the *.whl file to your local drive (ex. C:\some-dir\some-file.whl) use the following command line parameters --
pip install C:/some-dir/some-file.whl
I guess since you are on a work computer
try this
sudo pip --proxy=http://username:password#proxyURL:portNumber install yolk
for example:
sudo pip --proxy=http://202.194.64.89:8000 install elasticsearch
202.194.64.89:8000 is my PROXY,

Getting permission denied error while installing tensorflow and keras

After following the steps from my previously asked question Can I implement deep learning models in my laptop with intel hd graphics
I am getting a permission denied error while installing tensorflow
What can I do to install tensorflow and keras without getting this error?
pip3 is trying to access /usr/bin/ for which you need superuser rights. Try
sudo pip3 install --upgrade ...
It appears that TensorFlow depends on a newer version of the setuptools package than you have installed. As Maximilian points out, pip needs root access to upgrade setuptools and install TensorFlow and Keras in your machine's Python distribution. You can either use sudo as he suggests, or it may be safer to install TensorFlow into a Virtualenv. For example, to create a Virtualenv in the directory ~/tensorflow, execute the following commands:
$ sudo pip install virtualenv
$ virtualenv --system-site-packages ~/tensorflow
$ cd ~/tensorflow
$ source bin/activate
$ pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.0-cp27-none-linux_x86_64.whl