Installing Tensorflow with Python 3.5 and Anaconda - macos

I have Anaconda 3.19.3 with Python 3.5 on a Mac. Now, I would like to install TensorFlow via pip. The installation instructions here also include setup instructions for installing TensorFlow under Python 3.3+.
So, I have executed sudo easy_install --upgrade six, no problem. When I execute sudo pip3 install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.7.0-py3-none-any.whl, after downloading the necessary packages, I get the following:
Installing collected packages: setuptools, protobuf, tensorflow
Found existing installation: setuptools 19.6.2
Uninstalling setuptools-19.6.2:
Successfully uninstalled setuptools-19.6.2
Rolling back uninstall of setuptools
Exception:
...
AttributeError: _ep_map
During handling of the above exception, another exception occurred:
...
FileNotFoundError: [Errno 2] No such file or directory: '/Users/me/anaconda/lib/python3.5/site-packages/setuptools-19.6.2-py3.5.egg'
I have left out some of the error message to save space.
What is this and, more importantly, what can I do about it?

See the answer here:
Error setuptools when installing tensorflow
In particular, you could try adding the --ignore-installed tag to the end of your pip command.

Related

unable to load torchaudio even after installing

I'm trying to use torchaudio but I'm unable to import it. I have installed it and it is also visible through the pip list.
<ipython-input-6-4cf0a64f61c0> in <module>
----> 1 import torchaudio
ModuleNotFoundError: No module named 'torchaudio'
pytorch-lightning 1.2.0
torch 1.10.1
torchaudio 0.10.1
torchvision 0.11.2
WARNING: You are using pip version 21.1.2; however, version 21.3.1 is available.
You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.
Since you are using linux and CPU, you should consider uninstalling every pytorch related packages and re-install them via:
pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cpu
as shown here.
I was stuck with the same error. Tried a lot of ways to install and use torchaudio.
This was worked for me (after uninstalling existing torchaudio):
import os
!git clone https://github.com/pytorch/audio.git
os.chdir("audio")
!git checkout 632ea67
!python setup.py install

Can't install spacy for NLP tasks

I'm trying to install spaCy for NLP tasks but when I follow the first instruction from https://spacy.io/usage (pip install -U pip setuptools wheel) I get the error below. I believe my error may come from me creating two different users for my laptop, my lack of understanding of environment variables, virtual environments, and my path variable. I also do not understand the message about no metadata being found.
Microsoft Windows [Version 10.0.19043.1706]
(c) Microsoft Corporation. All rights reserved.
C:\Python310\Scripts>pip install -U pip setuptools wheel
Requirement already satisfied: pip in c:\users\user\appdata\roaming\python\python310\site-packages (22.0.4)
Collecting pip
Using cached pip-22.1.2-py3-none-any.whl (2.1 MB)
Requirement already satisfied: setuptools in c:\python310\lib\site-packages (62.3.2)
Requirement already satisfied: wheel in c:\python310\lib\site-packages (0.37.1)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 22.0.4
Uninstalling pip-22.0.4:
Successfully uninstalled pip-22.0.4
WARNING: No metadata found in c:\users\user\appdata\roaming\python\python310\site-packages
Rolling back uninstall of pip
Moving to c:\users\user\appdata\roaming\python\python310\scripts\pip.exe
from C:\Users\User\AppData\Local\Temp\pip-uninstall-on_65qs2\pip.exe
Moving to c:\users\user\appdata\roaming\python\python310\scripts\pip3.10.exe
from C:\Users\User\AppData\Local\Temp\pip-uninstall-on_65qs2\pip3.10.exe
Moving to c:\users\user\appdata\roaming\python\python310\scripts\pip3.exe
from C:\Users\User\AppData\Local\Temp\pip-uninstall-on_65qs2\pip3.exe
Moving to c:\users\user\appdata\roaming\python\python310\site-packages\pip-22.0.4.dist-info\
from C:\Users\User\AppData\Roaming\Python\Python310\site-packages\~ip-22.0.4.dist-info
Moving to c:\users\user\appdata\roaming\python\python310\site-packages\pip\
from C:\Users\User\AppData\Roaming\Python\Python310\site-packages\~ip
ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'C:\\Python310\\Lib\\site-packages\\pip\\__init__.py'
Consider using the `--user` option or check the permissions.
WARNING: You are using pip version 22.0.4; however, version 22.1.2 is available.
You should consider upgrading via the 'C:\Python310\python.exe -m pip install --upgrade pip' command.
C:\Python310\Scripts>
Screenshot of error message

Pytorch installation issue under Anaconda

I followed the link here to install fastai library using pip install git+https://github.com/fastai/fastai.git
It gave me the following error message. These messages keep the same even I installed Pytorch successfully using conda install pytorch-cpu -c pytorch
and pip3 install torchvision. What can be the reason?
Collecting torch<0.4 (from fastai==0.7.0)
Using cached https://files.pythonhosted.org/packages/5f/e9/bac4204fe9cb1a002ec6140b47f51affda1655379fe302a1caef421f9846/torch-0.1.2.post1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\shuxi\AppData\Local\Temp\pip-install-7sjptuad\torch\setup.py", line 11, in <module>
raise RuntimeError(README)
RuntimeError: PyTorch does not currently provide packages for PyPI (see status at https://github.com/pytorch/pytorch/issues/566).
Please follow the instructions at http://pytorch.org/ to install with miniconda instead.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\shuxi\AppData\Local\Temp\pip-install-7sjptuad\torch\
To fix this, do:
$ pip install --upgrade git+https://github.com/fastai/fastai.git
OR
$ pip install --no-cache-dir git+https://github.com/fastai/fastai.git
Your command probably failed because you have installed a old version of torch (0.1.2) some time ago. pip was not supported for torch install for that version and pip instead redirected the user to open pytorch.org in the browser. In your case, pip is reusing this cached package. --upgrade forces pip to choose latest version of all depending packages.

Has virtualenv installed correctly when `pip install virtualenv` outputs `using cached virtualenv`?

Context: Am working on the flaskr web project on Mac OS High Sierra.
Am at stage of installing Flask and I am running into issues with installing virtualenv: http://flask.pocoo.org/docs/0.12/tutorial/packaging/
When running the following line in Terminal:
pip install virtualenv
I get:
pip install virtualenv
Collecting virtualenv
Using cached virtualenv-15.2.0-py2.py3-none-any.whl
matplotlib 1.3.1 requires nose, which is not installed.
matplotlib 1.3.1 requires tornado, which is not installed.
matplotlib 1.3.1 has requirement numpy>=1.5, but you'll have numpy
1.8.0rc1 which is incompatible.
Installing collected packages: virtualenv
I was expecting a response 'successfully installed virtualenv...' as appears in this video: https://youtu.be/-COGZITgHtw?t=1m9s.
Then, when running the following in Terminal:
virtualenv
I get:
-bash: virtualenv: command not found
I note others have had issues with ‘command not found’ (bash: pip: command not found, How to add virtualenv to path) but I cannot seem to find outputs which mirror what I have received.
Is the cached virtualenv holding things up? Or perhaps the matplotlib stuff? Either way, virtualenv doesn't appear to have installed as it ought.
Would it be wise (in any case) to update or install nose, tornado and numpy using pip so that I can progress to activating a virtualenv? Or is something I need to address first before I can get virtuanlenv to start working?
I did the same error, but succeeded with the following procedure.
$ brew install python3
$ pip3 install --upgrade virtualenv
Collecting virtualenv
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Downloading virtualenv-15.2.0-py2.py3-none-any.whl (2.6MB)
100% |████████████████████████████████| 2.6MB 226kB/s
Installing collected packages: virtualenv
Successfully installed virtualenv-15.2.0

Installing pip in virtualenv using easy_install, for TensorFlow

I'm starting to experiment with TensorFlow and am following the TensorFlow guide to installing on Mac OS X, using virtualenv as recommended.
The instructions essentially boil down to the following:
sudo easy_install pip
sudo pip install --upgrade virtualenv
virtualenv --system-site-packages <mydirectory>
source ./<mydirectory>/bin/activate
easy_install -U pip
pip install --upgrade tensorflow
When I get to the easy_install -U pip step, I get the error:
"<mydirectory>/bin/easy_install: <mydirectory>/bin/python: bad interpreter: permission denied".
I can't understand what's going on here. My (usual) user has full permissions to <mydirectory>, where I believe everything should be running.
I assume running an older version of pip is not big deal, but something obviously goes wrong when I try the pip install --upgrade tensor flow step, because when I try running a Python script that uses TensorFlow I get the exception "import tensor flow as tf. Import error: no module named tensorflow".
Some help would be much appreciated please :)

Resources