Pytorch installation issue under Anaconda - 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.

Related

SyntaxError when pip install pip ( def read(rel_path: str))

when using pip I get the following warning:
$ pip install pip
Requirement already satisfied (use --upgrade to upgrade): pip in /usr/lib/python2.7/site-packages
You are using pip version 8.1.2, however version 22.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
So I follow the suggestion, but I get a SyntaxError:
$ pip install --upgrade pip
Collecting pip
Using cached https://files.pythonhosted.org/packages/99/bb/696e256f4f445809f25efd4e4ce42ff99664dc089cafa1e097d5fec7fc33/pip-22.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-k03IN1/pip/setup.py", line 7
def read(rel_path: str) -> str:
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-k03IN1/pip/
You are using pip version 8.1.2, however version 22.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
My default pip is not the one I want to be:
$ ~/anaconda3/bin/pip --version
pip 22.1 from /home/mdi0316/.local/lib/python3.8/site-packages/pip (python 3.8)
$ ~/anaconda3/bin/pip3 --version
pip 22.1 from /home/mdi0316/.local/lib/python3.8/site-packages/pip (python 3.8)
$ which pip
/usr/bin/pip
$ pip --version
pip 8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)
$ echo $PATH
/home/mdi0316/bin:/home/mdi0316/anaconda3/envs/nagare_env/bin:/home/mdi0316/anaconda3/condabin:/home/mdi0316/anaconda3/envs/nagare_env/bin:/cm/shared/apps/TURBOMOLE/bin/em64t-unknown-linux-gnu_smp:/cm/shared/apps/TURBOMOLE/scripts:/cm/local/apps/cuda/libs/current/bin:/cm/shared/apps/cuda11.1/sdk/11.1.1/bin/x86_64/linux/release:/cm/shared/apps/cuda11.1/toolkit/11.1.1/bin:/cm/shared/apps/python3.8.7/bin:/cm/shared/apps/openmpi/gcc/64/4.0.5/bin:/cm/local/apps/gcc/8.2.0/bin:/cm/shared/apps/slurm/18.08.9/sbin:/cm/shared/apps/slurm/18.08.9/bin:/cm/local/apps/environment-modules/4.2.1/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/ibutils/bin:/sbin:/usr/sbin:/cm/local/apps/environment-modules/4.2.1/bin
I am within a personally created anaconda environment (nagare_env).
Yet, the default pip in in ~/usr
I also tried to install pip through pip3, but I could solve this neither way.
$ pip3 install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in ./.local/lib/python3.8/site-packages (22.1)
$ pip3 install --upgrade --trusted-host pypi.org --trusted-host files.pythonhosted.org pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in ./.local/lib/python3.8/site-packages (22.1)
any hint?
Thanks
Marco
I faced the same issue on my centos. Guess my pip file was corrupted. I installed it again and was working fine.
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
python get-pip.py
pip install --upgrade setuptools
"pip 21.0, in January 2021, removed Python 2 support, per pip’s Python 2 support policy.
you should change your pip version
from: https://pypi.org/project/pip/

'scipy' seems to be installed but can not be imported

Here is the error I am receiving when running python 3.10.1 in my terminal.
import scipy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'scipy'
I used
pip3 install scipy
and everything seemed to work. If I run it again I receive this
pip3 install scipy
Requirement already satisfied: scipy in /usr/local/lib/python3.9/site-packages (1.8.0)
Requirement already satisfied: numpy<1.25.0,>=1.17.3 in /usr/local/lib/python3.9/site-packages (from scipy) (1.22.3)
I also tried
brew install scipy
and that too seemed to work and if I run it again I get this message
brew install scipy
Warning: scipy 1.8.0 is already installed and up-to-date.
To reinstall 1.8.0, run:
brew reinstall scipy
Why wont python3 import scipy?
I ran this in terminal and now everything works
python3 -m pip install scipy
I am still unsure what the original issue was however it may be related to this post here.

pip installation error command 'python setup.py egg_info' failed with error code 1

I am trying to install monkeytype on Ubuntu terminal using the command:
pip install monkeytype
but I'm getting an error saying:
Command "python setup.py egg_info" failed with error code 1
Here is the full log:
bash-4.3$ pip install monkeytype
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting monkeytype
Using cached https://files.pythonhosted.org/packages/5f/59/43bc6e44d69bd268e545fdfacdd6866362aca57ac894bbc3177b5455c06a/MonkeyType-18.2.0.tar.gz
Collecting retype (from monkeytype)
Using cached https://files.pythonhosted.org/packages/6e/da/ca9f5560f051d2ed79a52de1170903e3ff8ad011cff56c65abfcff38d372/retype-17.12.0.tar.gz
ERROR: Complete output from command python setup.py egg_info:
ERROR: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-mCIobj/retype/setup.py", line 14, in <module>
assert sys.version_info >= (3, 6, 0), "retype requires Python 3.6+"
AssertionError: retype requires Python 3.6+
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-mCIobj/retype/
With pip install, the real error is always hidden a little further up the log because pip runs the install routine of your packages.
In your case check for ERROR: Traceback, which says 'retype requires Python 3.6+'.
So, the installed package requires Python 3.6 but from an earlier error message we can deduce your pip runs python 2.7 (look for DEPRECATION: Python 2.7 )
So, fix the error by running the command with pip3 or python3 pip.
To verify which version of python is used, call pip -V.
sudo pip3 install --upgrade setuptools
copy it and paste it in terminal.
Check the error list searching a line like 'WARNING: The wheel package is not available.' or something similar.
Installing separately each missing package resolve the problems.

Installing Tensorflow with Python 3.5 and Anaconda

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.

Assertion error from 'pip list' in virtualenv.

Pip list is throwing an Assertion error and I'm not sure how to resolve. This has just happened after building 2 packages (PyUblas-2013.1 and boost_1_54_0) from source. I am using virtualenv.
Error below;
(virtenv)[user#xyz ~]$ pip list
beautifulsoup4 (4.2.1)
biopython (1.61)
distribute (0.6.35)
methylpy (0.1.0)
MySQL-python (1.2.4)
numpy (1.7.1)
pip (1.4)
py (1.4.15)
pytest (2.3.5)
PyUblas (2013.1)
Exception:
Traceback (most recent call last):
File "/home/user/virtenv/lib/python2.7/site-packages/pip/basecommand.py", line 134, in main
status = self.run(options, args)
File "/home/user/virtenv/lib/python2.7/site-packages/pip/commands/list.py", line 80, in run
self.run_listing(options)
File "/home/user/virtenv/lib/python2.7/site-packages/pip/commands/list.py", line 127, in run_listing
self.output_package_listing(installed_packages)
File "/home/user/virtenv/lib/python2.7/site-packages/pip/commands/list.py", line 136, in output_package_listing
if dist_is_editable(dist):
File "/home/user/virtenv/lib/python2.7/site-packages/pip/util.py", line 347, in dist_is_editable
req = FrozenRequirement.from_dist(dist, [])
File "/home/user/virtenv/lib/python2.7/site-packages/pip/__init__.py", line 194, in from_dist
assert len(specs) == 1 and specs[0][0] == '=='
AssertionError
Can anyone help me troubleshoot???
Thanks,
I think it is because the distribute package is out of date. Certainly the following fixed it for me:
pip install --upgrade distribute
Your pip may be outdated. Even in Ubuntu 14.04 LTS, the pip version it installed using apt-get install python-pip was 1.5.4. Try updating pip manually, and possibly the new packages again as well.
pip --version # 1.5.4
curl -O https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
pip --version # 6.0.8
https://pip.pypa.io/en/latest/installing.html
I know it's old but since I had the same problem and the fix didn't helped. Guess does not harm adding my solution.
Just updated pip, from inside of my virtualenv.
pip install --upgrade pip

Resources