Trying install PIP.
I have python 2.7 installed on Windows 7 (32-bit)
I created a file called get-pip.py as instructed here: https://pip.pypa.io/en/stable/installing/
When I run that file with python, I get the following error. The user account has admin rights.
Does anyone know what is going on?
C:\Python27>python get-pip.py
Traceback (most recent call last):
File "get-pip.py", line 20061, in <module>
main()
File "get-pip.py", line 194, in main
bootstrap(tmpdir=tmpdir)
File "get-pip.py", line 82, in bootstrap
import pip
File "c:\users\sek~1.sek\appdata\local\temp\tmpvkex0l\pip.zip\pip\__init__.py", line 21, in <module>
File "c:\users\sek~1.sek\appdata\local\temp\tmpvkex0l\pip.zip\pip\_vendor\requests\__init__.py", line 62, in <module>
File "c:\users\sek~1.sek\appdata\local\temp\tmpvkex0l\pip.zip\pip\_vendor\requests\packages\__init__.py", line 27, in <module>
File "c:\users\sek~1.sek\appdata\local\temp\tmpvkex0l\pip.zip\pip\_vendor\requests\packages\urllib3\__init__.py", line 8, in <module>
File "c:\users\sek~1.sek\appdata\local\temp\tmpvkex0l\pip.zip\pip\_vendor\requests\packages\urllib3\connectionpool.py", line 41, in <module>
File "c:\users\sek~1.sek\appdata\local\temp\tmpvkex0l\pip.zip\pip\_vendor\requests\packages\urllib3\request.py", line 7, in <module>
File "c:\users\sek~1.sek\appdata\local\temp\tmpvkex0l\pip.zip\pip\_vendor\requests\packages\urllib3\filepost.py", line 9, in <module>
File "c:\users\sek~1.sek\appdata\local\temp\tmpvkex0l\pip.zip\pip\_vendor\requests\packages\urllib3\fields.py", line 2, in <module>
File "C:\Python27\lib\email\utils.py", line 313
fallback charset='us-ascii'):
^
SyntaxError: invalid syntax
C:\Python27>
Do I need to install pip?
pip is already installed if you're using Python 2 >=2.7.9 or Python 3 >=3.4 binaries downloaded from python.org, but you'll need to upgrade pip.
Just add pip to your environment path:
<python install dir>/Scripts/
Which can be easily done using an elevated command-prompt:
setx path "%path%;<python install dir>/Scripts/"
Then, upgrade it:
python -m pip install -U pip
Related
Whenever I try to use pip, using any command I get this:
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qzc5n2dfsdra8p0\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1008.0_x64__qzc5n2dfsd8p0\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_q3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\__main__.py", line 23, in <module>
from pip._internal.cli.main import main as _main # isort:skip # noqa
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\cmdoptions.py", line 24, in <module>
from pip._internal.cli.progress_bars import BAR_TYPES
File "C:\Users\SE\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qzc5n2dfsd8p0\LocalCache\local-packages\Python38\site-packages\pip\_internal\cli\progress_bars.py", line 8, in <module>
from pip._vendor.progress.bar import Bar, FillingCirclesBar, IncrementalBar
ModuleNotFoundError: No module named 'pip._vendor.progress'
PS C:\Users\SE> No module named 'pip._vendor.progress'No module named 'pip._vendor.progress'
I am on Windows 10, 64 bit, Python version 3.7.7.
I cannot use pip, how can I fix it?
If pip is broken after an attempted upgrade to a newer version, try the following:
Download get-pip.py and "Save As" the file using right-click.
Open a command prompt as an administrator
cd to the path where you saved the file, in my case
cd C:\Users\xyz\Downloads> then type python get-pip.py. It will install all required packages, such as wheel and pip.
To check if it installed correctly, type pip --version in the command line.
Hope my answer helps someone. Happy coding. 🙂
Try doing python -m pip install pytest. This should install it, and it will make it usable by your IDE.
Hope this helps!
You could follow the equivalent steps mentioned here and here (Both are closed issues on pip's github page) on your windows machine.
On windows you can do this:
python -m pip uninstall pip setuptools # Sometimes setuptools might be the problem
This will uninstall pip and setuptools.
After which you can reinstall them using
python -m ensurepip
This will install pip and setuptools.
I have tried this on my windows 10 machine running Python 3.7.4!
I used PythonAnywhere to host some Python scripts that required the fbchat module. I installed the module on Python 3.6 (with user scheme) without using virtualenv, and the module installed enum34 as a dependency.
I know enum34 is incompatible with Python versions greater than 3.4. However I can't uninstall it now either because calling pip3.x gives this error:
Traceback (most recent call last):
File "/usr/local/bin/pip3.6", line 4, in <module>
import re
File "/usr/lib/python3.6/re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
and the command $ python3.6 -m pip gives:
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.6/runpy.py", line 142, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib/python3.6/runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "/usr/local/lib/python3.6/dist-packages/pip/__init__.py", line 4, in <module>
import locale
File "/usr/lib/python3.6/locale.py", line 16, in <module>
import re
File "/usr/lib/python3.6/re.py", line 142, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
These are the exact steps to reproduce, and the only commands used to get here:
$ pip3.6 install --user fbchat
Just delete the package from your site-packages folder manually.
Locate it first:
python3.6 -c 'import enum; print(enum.__file__)'
then delete the whole enum directory that file lives in, it'll be in a site-packages directory. Delete the enum34-<version>.dist-info file next to it too.
Because you used --user, the package was installed in your user-site directory. You can get the location with the site module too:
python3.6 -m site --user-site
so you can remove the offending package with:
rm -rf `python3.6 -m site --user-site`/enum
rm `python3.6 -m site --user-site`/enum-*.dist-info
I did conda install -c acellera pyinstaller=3.2.3 as per Anaconda's website and it looks like it installed correctly but I get the following if I try to run it via cmd:
C:\Users\Cornelis Dirk Haupt\PycharmProjects\Mesoscale-Brain-Explorer\src>pyinstaller
Traceback (most recent call last):
File "C:\Anaconda3\Scripts\pyinstaller-script.py", line 9, in <module>
load_entry_point('PyInstaller==3.3.dev0+g8756735', 'console_scripts', 'pyinstaller')()
File "C:\Anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 542, in load_entry_point
File "C:\Anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2569, in load_entry_point
File "C:\Anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2229, in load
File "C:\Anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2235, in resolve
File "C:\Anaconda3\lib\site-packages\PyInstaller\__main__.py", line 21, in <module>
import PyInstaller.building.build_main
File "C:\Anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 34, in <module>
from .api import PYZ, EXE, COLLECT, MERGE
File "C:\Anaconda3\lib\site-packages\PyInstaller\building\api.py", line 38, in <module>
from PyInstaller.utils.win32 import winmanifest, icon, versioninfo, winresource
File "C:\Anaconda3\lib\site-packages\PyInstaller\utils\win32\versioninfo.py", line 17, in <module>
import pefile
ImportError: No module named 'pefile'
What's going on? Pyinstaller works fine with python 2.7 without Anaconda. But I've recently decided to make the jump to Anaconda + 3.5. I cant find any module named pefile or how to install it with Anaconda. I can install pefile easily using pip3 though.
You can use Anaconda's pip to install it, just go to the Script folder in Anaconda and execute:
pip.exe install pefile
install this instead:
conda install -c conda-forge pyinstaller=3.2.1
working fine for me after a couple of tries!
I have followed the instructions in here [http://www.pyimagesearch.com/2015/07/20/install-opencv-3-0-and-python-3-4-on-ubuntu/] , in order to install python3. I am using Ubtuno 12.04. Upon checking my python version, I have:
$ python --version
Python 2.7.3
$ python3 --version
Python 3.2.3
In Step 2, I use:
$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo python3 get-pip.py
but I receive the following error after running the second line:
/tmp/tmp4ijset/pip.zip/pip/_vendor/pkg_resources/__init__.py:80: UserWarning: Support for Python 3.0-3.2 has been dropped. Future versions will fail here.
Traceback (most recent call last):
File "get-pip.py", line 19177, in <module>
main()
File "get-pip.py", line 194, in main
bootstrap(tmpdir=tmpdir)
File "get-pip.py", line 82, in bootstrap
import pip
File "/tmp/tmp4ijset/pip.zip/pip/__init__.py", line 16, in <module>
File "/tmp/tmp4ijset/pip.zip/pip/vcs/mercurial.py", line 9, in <module>
File "/tmp/tmp4ijset/pip.zip/pip/download.py", line 36, in <module>
File "/tmp/tmp4ijset/pip.zip/pip/utils/ui.py", line 15, in <module>
File "/tmp/tmp4ijset/pip.zip/pip/_vendor/progress/bar.py", line 48
empty_fill = u'∙'
^
SyntaxError: invalid syntax
Q1: What is the source of this error please and how can I solve it to have pip3 installed on my machine?
Q2: How can I install openCV under python 3?
I originally had both python 2.7 and python 3 installed with python 2.7 as my default in PATH. I needed to run a script using python 3 but could not set it as my default python in PATH for some reason. After just uninstalling python 2.7 I opened 3 and ran the command python get-pip.py install which gave me this error
C:\Python30>python get-pip.py install
Traceback (most recent call last):
File "c:\users\jacob\appdata\local\temp\tmplqxvtx\pip.zip\pip\compat\__init__.py", line 16, in <module>
ImportError: cannot import name OrderedDict
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "get-pip.py", line 19177, in <module>
main()
File "get-pip.py", line 194, in main
bootstrap(tmpdir=tmpdir)
File "get-pip.py", line 82, in bootstrap
import pip
File "c:\users\jacob\appdata\local\temp\tmplqxvtx\pip.zip\pip\__init__.py", line 14, in <module>
File "c:\users\jacob\appdata\local\temp\tmplqxvtx\pip.zip\pip\utils\__init__.py", line 22, in <module>
File "c:\users\jacob\appdata\local\temp\tmplqxvtx\pip.zip\pip\compat\__init__.py", line 18, in <module>
File "c:\users\jacob\appdata\local\temp\tmplqxvtx\pip.zip\pip\compat\ordereddict.py", line 25, in <module>
ImportError: No module named UserDict
I already tried python -m pip install (module name) but it returns No module named pip
I assume you use windows, so here is an answer how to install pip on windows:
how-do-i-install-pip-on-windows
On Linux you could just type:
sudo apt install python-pip