pip install won't install on my machine - python

so, i am trying to upgrade my Django version to 1.4.2, but when i do pip install Django==1.4.2 -vvv i get:
Will skip URL http://awdb.pypi.python.org/simple/Django/ when looking for download links for Django==1.4.2
Getting page http://jlxn.pypi.python.org/simple/Django/
Could not fetch URL http://euea.pypi.python.org/simple/Django/: <urlopen error [Errno -3] Temporary failure in name resolution>
Will skip URL http://euea.pypi.python.org/simple/Django/ when looking for download links for Django==1.4.2
Getting page http://krrw.pypi.python.org/simple/Django/
Could not fetch URL http://hfyu.pypi.python.org/simple/Django/: <urlopen error [Errno -3] Temporary failure in name resolution>
Will skip URL http://hfyu.pypi.python.org/simple/Django/ when looking for download links for Django==1.4.2
Getting page http://ixoj.pypi.python.org/simple/Django/
when using --verbose i noticed that i got a :
pip install -i --verbose http://d.pypi.python.org/simple Django==1.4.2
Downloading/unpacking http://d.pypi.python.org/simple
Downloading simple (1.7Mb): 1.7Mb downloaded
Cannot unpack file /tmp/pip-zgK95n-unpack/simple (downloaded from /tmp/pip-NFrk4r-build, content-type: text/html; charset=utf-8); cannot detect archive format
Cannot determine archive format of /tmp/pip-NFrk4r-build
Storing complete log in /home/administrator/.pip/pip.log
info in the log:
Exception information:
Traceback (most recent call last):
File "/home/administrator/.virtualenvs/xxx/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py", line 104, in main
status = self.run(options, args)
File "/home/administrator/.virtualenvs/xxx/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/commands/install.py", line 245, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/home/administrator/.virtualenvs/xxx/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 985, in prepare_files
self.unpack_url(url, location, self.is_download)
File "/home/administrator/.virtualenvs/xxx/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 1109, in unpack_url
retval = unpack_http_url(link, location, self.download_cache, self.download_dir)
File "/home/administrator/.virtualenvs/xxx/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/download.py", line 456, in unpack_http_url
unpack_file(temp_location, location, content_type, link)
File "/home/administrator/.virtualenvs/xxx/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/util.py", line 505, in unpack_file
raise InstallationError('Cannot determine archive format of %s' % location)
InstallationError: Cannot determine archive format of /tmp/pip-NFrk4r-build
any ideas?

i was able to solve it by doing this:
pip install --verbose https://pypi.python.org/packages/source/D/Django/Django-1.4.2.tar.gz#md5=6ffecdc01ad360e1abdca1015ae0893a
the problem is that i still don't know the cause of the problem in the first place

Related

Error Installing pip for Python

In order to install python packages, you must have pip installed. Very clear instructions are found here: https://packaging.python.org/installing/
However, when attempting to install pip via python get-pip.py I receive the following error:
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip'
To no avail, I've tried to follow the advice on GitHub (https://github.com/pypa/pip/issues/3761) to alter my permissions and to disable System Integrity Protection as found at this link (http://osxdaily.com/2015/10/05/disable-rootless-system-integrity-protection-mac-os-x/).
Also, note that pip does not exist on my machine:
Myname-MBP:python myname$ pip
-bash: pip: command not found
I'm running OSX 10.12.2.
Solution:
After trying Tristan's & Coolq B's suggestion sudo python get-pip.py it worked. However, if at first you don't succeed, try again: after the first try, I experienced a timeout error. I tried it again and it worked. Both results posted:
First try (timeout error):
Myname-MBP:python myname$ sudo python get-pip.py
Password:
The directory '/Users/myname/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/myname/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pip
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
19% |██████▎ | 245kB 11kB/s eta 0:01:32Exception:
Traceback (most recent call last):
File "/tmp/tmpq4Sjum/pip.zip/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/tmp/tmpq4Sjum/pip.zip/pip/commands/install.py", line 324, in run
requirement_set.prepare_files(finder)
File "/tmp/tmpq4Sjum/pip.zip/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/tmp/tmpq4Sjum/pip.zip/pip/req/req_set.py", line 620, in _prepare_file
session=self.session, hashes=hashes)
File "/tmp/tmpq4Sjum/pip.zip/pip/download.py", line 821, in unpack_url
hashes=hashes
File "/tmp/tmpq4Sjum/pip.zip/pip/download.py", line 659, in unpack_http_url
hashes)
File "/tmp/tmpq4Sjum/pip.zip/pip/download.py", line 882, in _download_http_url
_download_url(resp, link, content_file, hashes)
File "/tmp/tmpq4Sjum/pip.zip/pip/download.py", line 603, in _download_url
hashes.check_against_chunks(downloaded_chunks)
File "/tmp/tmpq4Sjum/pip.zip/pip/utils/hashes.py", line 46, in check_against_chunks
for chunk in chunks:
File "/tmp/tmpq4Sjum/pip.zip/pip/download.py", line 571, in written_chunks
for chunk in chunks:
File "/tmp/tmpq4Sjum/pip.zip/pip/utils/ui.py", line 139, in iter
for x in it:
File "/tmp/tmpq4Sjum/pip.zip/pip/download.py", line 560, in resp_read
decode_content=False):
File "/tmp/tmpq4Sjum/pip.zip/pip/_vendor/requests/packages/urllib3/response.py", line 357, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/tmp/tmpq4Sjum/pip.zip/pip/_vendor/requests/packages/urllib3/response.py", line 324, in read
flush_decoder = True
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "/tmp/tmpq4Sjum/pip.zip/pip/_vendor/requests/packages/urllib3/response.py", line 246, in _error_catcher
raise ReadTimeoutError(self._pool, None, 'Read timed out.')
ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.
Second Try (success):
MyName-MBP:python myname$ sudo python get-pip.py
Password:
The directory '/Users/myname/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/myname/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pip
Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 143kB/s
Collecting wheel
Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
100% |████████████████████████████████| 71kB 72kB/s
Installing collected packages: pip, wheel
Successfully installed pip-9.0.1 wheel-0.29.0

pypi not finding registered package

I have a package that I submitted to Pypi using the python setup.py register command:
https://bitbucket.org/lskibinski/et3
You can see it here:
https://pypi.python.org/pypi?name=et3&version=1.0&:action=display
However, for some mysterious reason, pip install et3 doesn't work. The error I get is:
$ pip install et3 -vvv --no-cache-dir
Collecting et3
1 location(s) to search for versions of et3:
* https://pypi.python.org/simple/et3/
Getting page https://pypi.python.org/simple/et3/
Starting new HTTPS connection (1): pypi.python.org
"GET /simple/et3/ HTTP/1.1" 200 111
Analyzing links from page https://pypi.python.org/simple/et3/
Could not find a version that satisfies the requirement et3 (from versions: )
Cleaning up...
No matching distribution found for et3
Exception information:
Traceback (most recent call last):
File "/home/luke/dev/python/lax/venv/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/luke/dev/python/lax/venv/lib/python2.7/site-packages/pip/commands/install.py", line 299, in run
requirement_set.prepare_files(finder)
File "/home/luke/dev/python/lax/venv/lib/python2.7/site-packages/pip/req/req_set.py", line 370, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/home/luke/dev/python/lax/venv/lib/python2.7/site-packages/pip/req/req_set.py", line 522, in _prepare_file
finder, self.upgrade, require_hashes)
File "/home/luke/dev/python/lax/venv/lib/python2.7/site-packages/pip/req/req_install.py", line 268, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/home/luke/dev/python/lax/venv/lib/python2.7/site-packages/pip/index.py", line 491, in find_requirement
'No matching distribution found for %s' % req
DistributionNotFound: No matching distribution found for et3
It seems like it can't find any versions to download. Do I need to specify something more than download_url? Are further manual steps required?
ok, figured it out. download_url doesn't appear to do much at all. I had to do:
python setup.py register
python setup.py sdist upload
... and it now works. The documentation for all of this is terrible.

'error: Error -5 while decompressing data: incomplete or truncated stream' when installing pip package

I'm having the following error when running pip install Pillow==2.9.0 in a virtualenv: error: Error -5 while decompressing data: incomplete or truncated stream
Other packages install/uninstall fine, it just seems to affects Pillow 2.9.0. It doesn't seem to matter what virtualenv I'm in (or not).
Downloading a source tarball and installing from that worked, but since this is on a build server that's not an ideal workaround as I want to rely on pip install -r requirements.txt
Versions:
pip --version: pip 7.1.0 from /usr/local/lib/python2.7/site-packages (python 2.7)
python --version: Python 2.7.10
The full traceback is:
Collecting Pillow==2.9.0
/mnt/jenkins/jobA/workspace/.pyenv/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Exception:
Traceback (most recent call last):
File "/mnt/jenkins/jobA/workspace/.pyenv/local/lib/python2.7/site-packages/pip/basecommand.py", line 223, in main
status = self.run(options, args)
File "/mnt/jenkins/jobA/workspace/.pyenv/local/lib/python2.7/site-packages/pip/commands/install.py", line 282, in run
requirement_set.prepare_files(finder)
File "/mnt/jenkins/jobA/workspace/.pyenv/local/lib/python2.7/site-packages/pip/req/req_set.py", line 334, in prepare_files
functools.partial(self._prepare_file, finder))
File "/mnt/jenkins/jobA/workspace/.pyenv/local/lib/python2.7/site-packages/pip/req/req_set.py", line 321, in _walk_req_to_install
more_reqs = handler(req_to_install)
File "/mnt/jenkins/jobA/workspace/.pyenv/local/lib/python2.7/site-packages/pip/req/req_set.py", line 491, in _prepare_file
session=self.session)
File "/mnt/jenkins/jobA/workspace/.pyenv/local/lib/python2.7/site-packages/pip/download.py", line 825, in unpack_url
session,
File "/mnt/jenkins/jobA/workspace/.pyenv/local/lib/python2.7/site-packages/pip/download.py", line 673, in unpack_http_url
from_path, content_type = _download_http_url(link, session, temp_dir)
File "/mnt/jenkins/jobA/workspace/.pyenv/local/lib/python2.7/site-packages/pip/download.py", line 857, in _download_http_url
stream=True,
File "/mnt/jenkins/jobA/workspace/.pyenv/local/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 477, in get
return self.request('GET', url, **kwargs)
File "/mnt/jenkins/jobA/workspace/.pyenv/local/lib/python2.7/site-packages/pip/download.py", line 373, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/mnt/jenkins/jobA/workspace/.pyenv/local/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 465, in request
resp = self.send(prep, **send_kwargs)
File "/mnt/jenkins/jobA/workspace/.pyenv/local/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 573, in send
r = adapter.send(request, **kwargs)
File "/mnt/jenkins/jobA/workspace/.pyenv/local/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.py", line 36, in send
cached_response = self.controller.cached_request(request)
File "/mnt/jenkins/jobA/workspace/.pyenv/local/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.py", line 102, in cached_request
resp = self.serializer.loads(request, self.cache.get(cache_url))
File "/mnt/jenkins/jobA/workspace/.pyenv/local/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.py", line 108, in loads
return getattr(self, "_loads_v{0}".format(ver))(request, data)
File "/mnt/jenkins/jobA/workspace/.pyenv/local/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.py", line 164, in _loads_v2
cached = json.loads(zlib.decompress(data).decode("utf8"))
error: Error -5 while decompressing data: incomplete or truncated stream
Turns out that there was a corrupt entry in pip's local cache (located in my case, and by default I believe, in ~/.cache/pip).
I tested that by trying pip install --no-cache-dir Pillow==2.9.0 and lo and behold, it worked.
To confirm it was the cache, I ran:
pip uninstall Pillow
rm -rf ~/.cache/pip/*
pip install Pillow==2.9.0
which succeeded where it had failed before.
I don't know how there came to be a problem with the cache, but my guess is that pip got interrupted mid-download causing the cached data for Pillow to be corrupted
I found my issue to be with memory, of the disk.
Running df showed I had used 92% memory. After deleting and cleaning the hard drive (using Disk Usage Analyzer) I was able to successfully decompress data
for anyone having similar situation as mine. It's run out of space during installation --> cache still there but corrupted.
so ?
remove this folder ~/.cache/pip and pip works again.

Download URL for PyPi Package

I am written a small package and have successfully uploaded the package to pypi but when i do to install using pip, this traceback comes and it never gets installed.
Downloading/unpacking pytransmit
Getting page https://pypi.python.org/simple/pytransmit/
URLs to search for versions for pytransmit:
* https://pypi.python.org/simple/pytransmit/
Analyzing links from page https://pypi.python.org/simple/PyTransmit/
Could not find any downloads that satisfy the requirement pytransmit
Cleaning up...
Removing temporary dir c\temp\pip_build_dd...
No distributions at all found for pytransmit
Exception information:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\pip\basecommand.py", line 122, in main
status = self.run(options, args)
File "C:\Python27\lib\site-packages\pip\commands\install.py", line 270, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "C:\Python27\lib\site-packages\pip\req.py", line 1157, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "C:\Python27\lib\site-packages\pip\index.py", line 285, in find_requirement
raise DistributionNotFound('No distributions at all found for %s' % req)
DistributionNotFound: No distributions at all found for pytransmit
How shall i make it installable using pip.
You don't have any files to download. You can follow the official tutorial and upload your package files.
Essencially you need to register your package first -
python setup.py register
and then upload the distributables -
python setup.py sdist bdist_wininst upload

pip install - Connection reset by peer

When I try to install lxml using pip I had the exception "Connection reset by peer":
Downloading/unpacking lxml
Downloading lxml-3.0.1.tar.gz (3.2Mb): 643Kb downloaded
Exception:
Traceback (most recent call last):
File "/home/dummyuser/work/virt-dev-env/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py", line 104, in main
status = self.run(options, args)
File "/home/dummyuser/work/virt-dev-env/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/commands/install.py", line 245, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/home/dummyuser/work/virt-dev-env/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 985, in prepare_files
self.unpack_url(url, location, self.is_download)
File "/home/dummyuser/work/virt-dev-env/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 1109, in unpack_url
retval = unpack_http_url(link, location, self.download_cache, self.download_dir)
File "/home/dummyuser/work/virt-dev-env/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/download.py", line 451, in unpack_http_url
download_hash = _download_url(resp, link, temp_location)
File "/home/dummyuser/work/virt-dev-env/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/download.py", line 368, in _download_url
chunk = resp.read(4096)
File "/usr/lib/python2.7/socket.py", line 380, in read
data = self._sock.recv(left)
File "/usr/lib/python2.7/httplib.py", line 561, in read
s = self.fp.read(amt)
File "/usr/lib/python2.7/socket.py", line 380, in read
data = self._sock.recv(left)
error: [Errno 104] Connection reset by peer
This only happened when installing lxml, other modules got installed with pip no problems. Anybody had the same problem?
Try to choose another PyPI mirror, either directly:
pip install -i http://e.pypi.python.org/simple lxml
Or by letting pip find the best mirror:
pip install --use-mirrors lxml
It turns out the mirror I was using somehow is not accessible from the network. The way I got around with it is installing it via OS directly using:
$ apt-get install python-lxml
then copy it to my virtual env:
$ cp -r /usr/lib/python2.7/dist-packages/lxml* /home/dummyuser/work/virt-dev-env/local/lib/python2.7/site-packages/
I then have it in my virtual env:
$ pip freeze
........
lxml==2.3.2
........
In my case, was an ipv6 issue. Some mirrors still don't have full ipv6 access.
Disable ipv6 and try again.

Categories

Resources