Is IDLE a console? [duplicate] - pip

This question already has answers here:
python3 --version shows "NameError: name 'python3' is not defined"
(2 answers)
Closed 27 days ago.
I want to check whether pip is installed, but I don't know how to do that.
I tried typing pip into IDLE:
ModuleNotFoundError: No module named 'matplotlib'
>>> pip
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
pip
NameError: name 'pip' is not defined
>>>

Don't use IDLE to run pip. Check if you have pip installed by opening up command prompt and typing pip help or pip --version If you get an error it's obviously not installed.
To update pip, enter python -m pip install -U pip.

Related

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.

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.

DLVM - pip install error

Trying to pip install on Azure Deep Learning VM is giving this error-
Complete output from command python setup.py egg_info:
ERROR:root:Error parsing
Traceback (most recent call last):
File "/anaconda/envs/py35/lib/python3.5/site-packages/pbr/core.py", line 111, in pbr
attrs = util.cfg_to_args(path, dist.script_args)
File "/anaconda/envs/py35/lib/python3.5/site-packages/pbr/util.py", line 267, in cfg_to_args
wrap_commands(kwargs)
File "/anaconda/envs/py35/lib/python3.5/site-packages/pbr/util.py", line 569, in wrap_commands
cmdclass = ep.resolve()
File "/anaconda/envs/py35/lib/python3.5/site-packages/setuptools-27.2.0-py3.5.egg/pkg_resources/__init__.py", line 2264, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
ImportError: No module named 'setuptools.command.build_clib'
error in setup command: Error parsing /tmp/pip-build-9ucgxr1d/cliff/setup.cfg: ImportError: No module named 'setuptools.command.build_clib'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-9ucgxr1d/cliff/
Given the paths above it appears this is happenning on the Python 3.5 (py35) conda environment on the Linux edition of the Azure Data Science VM (DSVM) and Deep Learning VM (DLVM).
Based on the error message, the general guidance to resolve this is to update the setuptools and then try to install the library.
The commands to do that on the DSVM/DLVM on the global py35 conda environment is:
sudo /anaconda/envs/py35/bin/pip install --upgrade setuptools
sudo /anaconda/envs/py35/bin/pip install <<package name>>
For the root (Python 2.7) environment on the DSVM the commands are:
sudo /anaconda/bin/pip install --upgrade setuptools
sudo /anaconda/bin/pip install <<package name>>
Hope this resolves the issue.

ImportError: Entry point ('console_scripts', 'pip') not found on Mac

I got the message
You are using pip version 8.0.2, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
When I try to install a package through pip.
I followed the instruction and upgrade pip with pip install --upgrade pip. Now I'm getting an error with pip, even with pip --version to check the version of pip.
Traceback (most recent call last):
File "/usr/local/bin/pip", line 9, in <module>
load_entry_point('pip==8.0.2', 'console_scripts', 'pip')()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 357, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2393, in load_entry_point
raise ImportError("Entry point %r not found" % ((group,name),))
ImportError: Entry point ('console_scripts', 'pip') not found
I've searched online and found some similar issues like, this, this and this. but none of the solutions worked for me.
I think it might be I have multiple version of pip on my Mac, how can I clean it up and get the latest version installed, please?
Thank you.
Manually removed all pip repositories in /usr/local/bin/. (not sure if it's necessary.)
Then reinstall pip following the instructions here.
To install pip, securely download get-pip.py.
Then run the following:
python get-pip.py
FYI, easy-install pip doesn't work.

spyder, distribute & scipy error

I am running python 2.7 under ubuntu 12.04. I'm trying to install spyder using pip but get the error message:
error: invalid command 'egg_info'
Command python setup.py egg_info failed with error code 1
I looked at other posts, which recommended I install distribute. But I get the same error message when installing distribute using pip
When I try to upgrade scipy or install spyder with pip I get the following message:
Command python setup.py egg_info failed with error code 1
Exception information:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 126, in main
self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 223, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 980, in prepare_files
req_to_install.run_egg_info()
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 216, in run_egg_info
command_desc='python setup.py egg_info')
File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 255, in call_subprocess
% (command_desc, proc.returncode))
InstallationError: Command python setup.py egg_info failed with error code 1
I'm new to python, pip and ubuntu, which makes this more difficult. Thanks in advance.
You can install spyder by simply typing following command in terminal
sudo apt-get install spyder
The another way is :
Open "Ubuntu Software Center" search for spyder and click on "Install."
(Spyder dev here) Maybe your problem is because Ubuntu 12.04 has an outdated version of pip. You can update it using sudo easy_install pip, and then try again.
You can also try to use easy_install instead of pip to install Spyder. Just run the command sudo easy_install spyder to see if that works.
Notes:
If these solutions don't work for you but you still want to try the latest Spyder (and other scientific packages like scipy or pandas), you'll have a much better time by installing a Python scientific distribution like Anaconda.
Don't try to install scipy with pip. That's not so easy as installing Spyder.

Resources