couldn't install pip in windows - python

I am trying to install pip in windows.
when i run the get-pip.py file i get the following message:
C:\Python27>python get-pip.py
Collecting pip Using cached pip-7.1.2-py2.py3-none-any.whl
Hash of the package https://pypi.python.org/packages/py2.py3/p/pip/pip-7.1.2-py2.py3-none-any.whl#md5=5ff9fec0be479e4e36df467556deed4d (from https://pypi.python.org/simple/pip/) (ab1a3864641ecb4ba77b0d30cfdc8442) doesn't match the expected hash 5ff9fec0be479e4e36df467556deed4d!
Bad md5 hash for package https://pypi.python.org/packages/py2.py3/p/pip/pip-7.1.2-py2.py3-none-any.whl#md5=5ff9fec0be479e4e36df467556deed4d (from https://pypi.python.org/simple/pip/)
I don't know what the problem is. can someone help me?

Thanks disflux for your comment that was useful and also this post.
I ignored the cache file using the option: --no-cache-dir
Now the command looks something like this C:\Python27>python get-pip.py --no-cache-dir
Successfully installed pip.

Related

Update python library offline

I need to update offline a library in Python.
I have downloaded the library with pip download and then I try to update the library with the command:
pip install --no-index --user --find-links /tmp/pip/ --upgrade Werkzeug==0.15.5
which gives:
Ignoring indexes: https://...
Collecting Werkzeug==0.15.5
Installing collected packages: Werkzeug
Successfully installed Werkzeug-0.11.15
and then the library stays in the same version!
pip freeze | grep Wer
Werkzeug==0.11.15
Any ideas why this happens?
UPDATE: After the comment from #hoefling I rerun with the -vvv option and this is what I got:
pip install --no-index --user --find-links /tmp/pip2/ -vvv Werkzeug==0.15.5
Ignoring indexes: https://pypi:pypi#..../simple/
Collecting Werkzeug==0.15.5
0 location(s) to search for versions of Werkzeug:
Skipping link /tmp/pip2/werk/ (from -f); not a file
Found link file:///tmp/pip2/werk/Werkzeug-0.15.5-py2.py3-none-any.whl, version:
0.15.5
Local files found: /tmp/pip2/werk/Werkzeug-0.15.5-py2.py3-none-any.whl
Using version 0.15.5 (newest of versions: 0.15.5)
Installing collected packages: Werkzeug
Successfully installed Werkzeug-0.11.15
Cleaning up...
Try this command:
pip install Werkzeug-0.15.5.tar.gz
and the result must be like this:
Processing ./Werkzeug-0.15.5.tar.gz
Installing collected packages: Werkzeug
Running setup.py install for Werkzeug ... done
Successfully installed Werkzeug-0.15.5
This behaviour can happen because pip by default works with system Python which is located in /usr/bin/ on Linux. When installing the package, by giving Python --user flag your package is installed in your user's version of Python, probably located somewhere in ~/.local/.
To solve the problem you can install the package to your system Python, which is generally not recommended without --user flag. Another option is to use virtual environments and have the distribution that is made specifically for your project. Currently the recommended way is using venv.
$ python -m venv env
$ source env/bin/activate
(env) $ pip install ... (packages you need to install without --user flag)
(env) $ pip freeze
# should give you the packages you installed
This can help you not only with this example, but it can always keep your system Python installation clean and if you mess something up, you will only mess the environment you are having for specific project.

Command not found after installing successfully via pip

I just downloaded youtube-dl via pip as follows:
sukhvir#SN:~$ sudo pip install youtube-dl
Downloading/unpacking youtube-dl
Downloading youtube_dl-2015.06.25-py2.py3-none-any.whl (965kB): 965kB downloaded
Installing collected packages: youtube-dl
Successfully installed youtube-dl
Cleaning up...
then when i try to run it, the following error shows up:
sukhvir#SN:~$ youtube-dl https://www.youtube.com/watch?v=QcIy9NiNbmo
-bash: youtube-dl: command not found
Can you please help as to why this is happening and how can i rectify this issue ?
I know it is a bit old, but I ran in the same problem.
The solution is simple: you installed it with 'sudo' rights,
so if you run it with sudo youtube-dl will start without problem (as module).
To avoid this, you could install pip install --user youtube-dl

How to install pyinstaller using pip

I am trying to install PyInstaller using pip but i am failing in doing so. I have Python 2.7.
Error:
C:\Python27\Scripts>pip install pyinstaller
Downloading/unpacking pyinstaller
Cannot fetch index base URL http://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement pyinstaller
No distributions at all found for pyinstaller
Storing complete log in C:\Users\hardik\AppData\Roaming\pip\pip.log
I tried upgrading pip first with pip install -U pip setuptools but got the same error:
C:\Users\hardik>pip install -U pip setuptools
Cannot fetch index base URL pypi.python.org/simple
Could not find any downloads that satisfy the requirement pip in c:\python27\lib \site-packages
No distributions at all found for pip in c:\python27\lib\site-packages
Storing complete log in C:\Users\hardik\AppData\Roaming\pip\pip.log
I was facing the same issue, and this is how I solved it:
pip install https://github.com/pyinstaller/pyinstaller/tarball/develop

Python version messing with my BeautifulSoup4

So I just downloaded get-pip.py and ran it. Everything looks good (I got "successfully installed pip").
When I run:
pip install beautifulsoup4
I get:
Requirement already satisfied (use --upgrade to upgrade): beautifulsoup4 in /Library/Python/2.7/site-packages/beautifulsoup4-4.3.2-py2.7.egg
Cleaning up...
So it looks like I have beautifulsoup4 set up for python 2.7...yes? I want it set up for python 3.3 (which is what I get when I type python into iTerm). Any thoughts on how to do this?
Feel like it shouldn't be terribly difficult but have looked around to no avail
Thanks guys,
Mariogs
You should be able to install for a specific version using that version's pip
pip-3.3 install beautifulsoup4
Simillarly Download Beautifulsoup into ur system untar it then type
pyton3.3 setup.py install
If you don't have pip3 installed do the following:
curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
sudo python3 get-pip.py
curl -O http://python-distribute.org/distribute_setup.py
sudo python3 distribute_setup.py
Add
export PATH=/Library/Frameworks/Python.framework/Versions/3.3/bin:$PATH
to your .bash_profile
Then restart terminal and sudo pip install beautifulsoup4

pip --find-links option doesn't seems to be working

When attempt to install from pip
$ pip install Django==1.4
Most likely I get
Error while getting
http://pypi.python.org/packages/source/D/Django/Django-1.4.tar.gz#md5=ba8e86198a93c196015df0b363ab1109
(from http://pypi.python.org/simple/Django/)
Per suggested by Jacob in his blog, I added --use-mirrors but no luck.
Several comments made to this blog note that they are hosting file on their own.
So I hosted tar.gz file to say example.com/packages directory.
The command below successfully install Django 1.4
$ pip install https://example.com/packages/Django-1.4.tar.gz
The commands below doesn't seems to be working and want to find out what am I doing wrong.
$ pip install --find-links=https://example.com/packages/ Django==1.4
$ pip install --find-links "https://example.com/packages/" Django==1.4
$ pip install -f https://example.com/packages/ Django==1.4
Result in:
Downloading/unpacking Django==1.4 Error
while getting
http://pypi.python.org/packages/source/D/Django/Django-1.4.tar.gz#md5=ba8e86198a93c196015df0b363ab1109
(from http://pypi.python.org/simple/Django/)
Not sure why it appears to be ignoring --find-links option
Apache auto-index is enabled for Packages directory hence pointing browser to https://example.com will return list of tar.gz files
Any advice would be appriciated

Categories

Resources