Unable to upgrade Scipy using PIP - python

I try to upgrade Scipy using PIP on Ubuntu 16.04 but always receive this error. I'm not sure what is going on. The progress reaches 99% and then stops, and spits out this error.
I've tried upgrading pip but the same error still occurs.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 310, in run
wb.build(autobuilding=True)
File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 750, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 370, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 587, in _prepare_file
session=self.session, hashes=hashes)
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 810, in unpack_url
hashes=hashes
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 649, in unpack_http_url
hashes)
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 871, in _download_http_url
_download_url(resp, link, content_file, hashes)
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 595, in _download_url
hashes.check_against_chunks(downloaded_chunks)
File "/usr/local/lib/python2.7/dist-packages/pip/utils/hashes.py", line 46, in check_against_chunks
for chunk in chunks:
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 563, in written_chunks
for chunk in chunks:
File "/usr/local/lib/python2.7/dist-packages/pip/utils/ui.py", line 139, in iter
for x in it:
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 552, in resp_read
decode_content=False):
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/response.py", line 353, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/response.py", line 310, in read
data = self._fp.read(amt)
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/cachecontrol/filewrapper.py", line 54, in read
self.__callback(self.__buf.getvalue())
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/cachecontrol/controller.py", line 275, in cache_response
self.serializer.dumps(request, response, body=body),
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/cachecontrol/serialize.py", line 87, in dumps
).encode("utf8"),
MemoryError

Try to disable the cache during install using
pip install --no-cache-dir packageName
where packageName is scipy in this case

The last line says "MemoryError"
Are you using a virtual environment?
If so, the environment probably requires more memory to be allocated to it.
Go to Player > Manage > Virtual Machine Settings
Here, drag the slider to choose a higher value of memory to be allocated.
Restart the virtual environment for the changes to take place.
I hope this helps!

Related

Strange exception while using pip to install python packages after deleting rabbitmq in Ubuntu 18.04

Good morining,
I was trying to install RabbitMQ in my Ubuntu18.04 but it was like brain surgery. I have decided to remove everything, but now when I try to install python packages with pip, the terminal return strange exceptions. I have similar problems when I try to compile a python script with visualStudio. I really appreciate your help. Stay tech!
These are the exceptions:
pip3 install numpy
Collecting numpy
Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 353, in run
wb.build(autobuilding=True)
File "/usr/lib/python3/dist-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 554, in _prepare_file
require_hashes
File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/lib/python3/dist-packages/pip/index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/lib/python3/dist-packages/pip/index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/lib/python3/dist-packages/pip/index.py", line 568, in _get_pages
page = self._get_page(location)
File "/usr/lib/python3/dist-packages/pip/index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/lib/python3/dist-packages/pip/index.py", line 795, in get_page
resp.raise_for_status()
File "/usr/share/python-wheels/requests-2.18.4-py2.py3-none-any.whl/requests/models.py", line 935, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://packagecloud.io/rabbitmq/rabbitmq-server/pypi/simple/numpy/
There is an excessive URL in ~/.pip/pip.conf or ~/.config/pip/pip.conf. Remove it and retry.

Cannot create python virtualenv

I'm working on a legacy app that needs python2.6.2.
I installed successfully python 2.6.2 and setuptools.
Now when I try to create a virtualenv using this version it gives me this error:
$ virtualenv --python=/usr/local/python2.6.2/bin/python mypythonnewapp
Running virtualenv with interpreter /usr/local/python2.6.2/bin/python
New python executable in /home/vagrant/mypythonnewapp/bin/python
Installing setuptools<37, pip, wheel<0.30...
Complete output from command /home/vagrant/mypythonnewapp/bin/python - setuptools<37 pip wheel<0.30:
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
Collecting setuptools<37
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/virtualenv_support/pip-9.0.3-py2.py3-none-any.whl/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python2.6/site-packages/virtualenv_support/pip-9.0.3-py2.py3-none-any.whl/pip/commands/install.py", line 324, in run
requirement_set.prepare_files(finder)
File "/usr/lib/python2.6/site-packages/virtualenv_support/pip-9.0.3-py2.py3-none-any.whl/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python2.6/site-packages/virtualenv_support/pip-9.0.3-py2.py3-none-any.whl/pip/req/req_set.py", line 554, in _prepare_file
require_hashes
File "/usr/lib/python2.6/site-packages/virtualenv_support/pip-9.0.3-py2.py3-none-any.whl/pip/req/req_install.py", line 278, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/lib/python2.6/site-packages/virtualenv_support/pip-9.0.3-py2.py3-none-any.whl/pip/index.py", line 465, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/lib/python2.6/site-packages/virtualenv_support/pip-9.0.3-py2.py3-none-any.whl/pip/index.py", line 423, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/lib/python2.6/site-packages/virtualenv_support/pip-9.0.3-py2.py3-none-any.whl/pip/index.py", line 568, in _get_pages
page = self._get_page(location)
File "/usr/lib/python2.6/site-packages/virtualenv_support/pip-9.0.3-py2.py3-none-any.whl/pip/index.py", line 683, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/lib/python2.6/site-packages/virtualenv_support/pip-9.0.3-py2.py3-none-any.whl/pip/index.py", line 792, in get_page
"Cache-Control": "max-age=600",
File "/usr/lib/python2.6/site-packages/virtualenv_support/pip-9.0.3-py2.py3-none-any.whl/pip/_vendor/requests/sessions.py", line 521, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python2.6/site-packages/virtualenv_support/pip-9.0.3-py2.py3-none-any.whl/pip/download.py", line 386, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/lib/python2.6/site-packages/virtualenv_support/pip-9.0.3-py2.py3-none-any.whl/pip/_vendor/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python2.6/site-packages/virtualenv_support/pip-9.0.3-py2.py3-none-any.whl/pip/_vendor/requests/sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python2.6/site-packages/virtualenv_support/pip-9.0.3-py2.py3-none-any.whl/pip/_vendor/cachecontrol/adapter.py", line 37, in send
cached_response = self.controller.cached_request(request)
File "/usr/lib/python2.6/site-packages/virtualenv_support/pip-9.0.3-py2.py3-none-any.whl/pip/_vendor/cachecontrol/controller.py", line 111, in cached_request
resp = self.serializer.loads(request, cache_data)
File "/usr/lib/python2.6/site-packages/virtualenv_support/pip-9.0.3-py2.py3-none-any.whl/pip/_vendor/cachecontrol/serialize.py", line 114, in loads
return getattr(self, "_loads_v{0}".format(ver))(request, data)
File "/usr/lib/python2.6/site-packages/virtualenv_support/pip-9.0.3-py2.py3-none-any.whl/pip/_vendor/cachecontrol/serialize.py", line 196, in _loads_v2
return self.prepare_response(request, cached)
File "/usr/lib/python2.6/site-packages/virtualenv_support/pip-9.0.3-py2.py3-none-any.whl/pip/_vendor/cachecontrol/serialize.py", line 157, in prepare_response
**cached["response"]
TypeError: __init__() keywords must be strings
----------------------------------------
...Installing setuptools<37, pip, wheel<0.30...done.
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/virtualenv.py", line 2349, in <module>
main()
File "/usr/lib/python2.6/site-packages/virtualenv.py", line 712, in main
symlink=options.symlink)
File "/usr/lib/python2.6/site-packages/virtualenv.py", line 953, in create_environment
download=download,
File "/usr/lib/python2.6/site-packages/virtualenv.py", line 904, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "/usr/lib/python2.6/site-packages/virtualenv.py", line 796, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/vagrant/mypythonnewapp/bin/python - setuptools<37 pip wheel<0.30 failed with error code 2
Any suggestions other than upgrading anything are welcome.
Thanks
This seems like a bug in virtualenv. See how virtualenv.py limits versions of setuptools and wheel for Python 2.6, but not for pip. It must limit pip to version '<10' for Py 2.6. Please report the bug or better send a pull request.
Meanwhile create a virtualenv with --no-pip and later install pip into the virtualenv manually.
Try using pyenv. At least it claims to support versions of Python back to 2.1.3

Cannot create Virtualenv in Python

I'm struggling with virtualenv in Python.
After virtualenv _env I get:
Running virtualenv with interpreter /usr/bin/python2
New python executable in /home/marcin/Documents/Projects/django_tutorial/_env/bin/python2
Also creating executable in /home/marcin/Documents/Projects/django_tutorial/_env/bin/python
Installing setuptools, pkg_resources, pip, wheel...
Complete output from command /home/marcin/Documen...ial/_env/bin/python2 - setuptools pkg_resources pip wheel:
Collecting setuptools
Downloading setuptools-38.4.0-py2.py3-none-any.whl (489kB)
Exception:
Traceback (most recent call last):
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/commands/install.py", line 353, in run
wb.build(autobuilding=True)
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/req/req_set.py", line 620, in _prepare_file
session=self.session, hashes=hashes)
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 821, in unpack_url
hashes=hashes
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 659, in unpack_http_url
hashes)
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 882, in _download_http_url
_download_url(resp, link, content_file, hashes)
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 603, in _download_url
hashes.check_against_chunks(downloaded_chunks)
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/utils/hashes.py", line 46, in check_against_chunks
for chunk in chunks:
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 571, in written_chunks
for chunk in chunks:
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/utils/ui.py", line 139, in iter
for x in it:
File "/usr/share/python-wheels/pip-9.0.1-py2.py3-none-any.whl/pip/download.py", line 560, in resp_read
decode_content=False):
File "/home/marcin/Documents/Projects/django_tutorial/_env/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/response.py", line 432, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/home/marcin/Documents/Projects/django_tutorial/_env/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/response.py", line 397, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "/home/marcin/Documents/Projects/django_tutorial/_env/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/response.py", line 312, in _error_catcher
raise ReadTimeoutError(self._pool, None, 'Read timed out.')
ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.
----------------------------------------
...Installing setuptools, pkg_resources, pip, wheel...done.
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 2375, in <module>
main()
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 724, in main
symlink=options.symlink)
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 992, in create_environment
download=download,
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 922, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "/usr/lib/python2.7/dist-packages/virtualenv.py", line 817, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/marcin/Documen...ial/_env/bin/python2 - setuptools pkg_resources pip wheel failed with error code 2
I've got:
virtualenv 15.1.0
pip 9.0.1
Python 2.7.13
I'm out of ideas. I tried exporting locales, reinstalling pip, setuptools and virtualenv.
Do you have any suggestions? I will be grateful.
If you are in China, you can change your pip source to solve this issue.
mkdir ~/.pip
echo '[global]' > ~/.pip/pip.conf
echo 'index-url = https://pypi.tuna.tsinghua.edu.cn/simple' >> ~/.pip/pip.conf
By using the mirror of Tsinghua University, you might solve your problem.

Install tensorflow via pip but failed just as follows

Traceback (most recent call last):<br>
File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main<br>
status = self.run(options, args)<br>
File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 335, in run<br>
wb.build(autobuilding=True)<br>
File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 749, in build<br>
self.requirement_set.prepare_files(self.finder)<br>
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))<br>
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 620, in _prepare_file
session=self.session, hashes=hashes)<br>
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 821, in unpack_url
hashes=hashes<br>
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 659, in unpack_http_url
hashes)<br>
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 882, in _download_http_url
_download_url(resp, link, content_file, hashes)<br>
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 603, in _download_url
hashes.check_against_chunks(downloaded_chunks)<br>
File "/usr/local/lib/python2.7/dist-packages/pip/utils/hashes.py", line 46, in check_against_chunks<br>
for chunk in chunks:<br>
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 571, in written_chunks
for chunk in chunks:<br>
File "/usr/local/lib/python2.7/dist-packages/pip/utils/ui.py", line 139, in iter<br>
for x in it:<br>
File "/usr/local/lib/python2.7/dist-packages/pip/download.py", line 560, in resp_read
decode_content=False):<br>
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/response.py", line 357, in stream<br>
data = self.read(amt=amt, decode_content=decode_content)<br>
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/response.py", line 324, in read<br>
flush_decoder = True<br>
File "/usr/lib/python2.7/contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)<br>
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/response.py", line 246, in _error_catcher<br>
raise ReadTimeoutError(self._pool, None, 'Read timed out.')<br>
ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.
I solved it by modifying the command like this:
pip --default-timeout=100 install THEPACKAGENAME
You can also try installing using wheel packages.
The Wheel packages depend on the kind of operating system you have, the python version and whether you want to install with CPU/GPU support.
Also upgrade you protobuf before installing Tensorflow.
Please find a list of packages here:
https://www.tensorflow.org/install/install_linux#the_url_of_the_tensorflow_python_package
You can then issue this command :
$ sudo pip install --upgrade <TF wheel package URL> - For Python 2.7
$ sudo pip3 install --upgrade <TF wheel package URL> - For Python 3.x
Tensorflow site has some details on some common installation problems. You can look at those as well, just in case.
https://www.tensorflow.org/install/install_linux#common_installation_problems

Encoding error when attempt to install matplotlib on ubuntu

I'm attempting to install matplotlib in a python2 virtualenv in Ubuntu 14.04, and am running into the following error:
../virtualenv/bin/pip install matplotlib
Traceback (most recent call last):
File "/home/me/sites/dashboard.mysite.com/virtualenv/local/lib/python2.7/site-packages/pip/basecommand.py", line 211, in main
status = self.run(options, args)
File "/home/me/sites/dashboard.mysite.com/virtualenv/local/lib/python2.7/site-packages/pip/commands/install.py", line 305, in run
wb.build(autobuilding=True)
File "/home/me/sites/dashboard.mysite.com/virtualenv/local/lib/python2.7/site-packages/pip/wheel.py", line 705, in build
self.requirement_set.prepare_files(self.finder)
File "/home/me/sites/dashboard.mysite.com/virtualenv/local/lib/python2.7/site-packages/pip/req/req_set.py", line 334, in prepare_files
functools.partial(self._prepare_file, finder))
File "/home/me/sites/dashboard.mysite.com/virtualenv/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 "/home/me/sites/dashboard.mysite.com/virtualenv/local/lib/python2.7/site-packages/pip/req/req_set.py", line 491, in _prepare_file
session=self.session)
File "/home/me/sites/dashboard.mysite.com/virtualenv/local/lib/python2.7/site-packages/pip/download.py", line 825, in unpack_url
session,
File "/home/me/sites/dashboard.mysite.com/virtualenv/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 "/home/me/sites/dashboard.mysite.com/virtualenv/local/lib/python2.7/site-packages/pip/download.py", line 886, in _download_http_url
_download_url(resp, link, content_file)
File "/home/me/sites/dashboard.mysite.com/virtualenv/local/lib/python2.7/site-packages/pip/download.py", line 621, in _download_url
for chunk in progress_indicator(resp_read(4096), 4096):
File "/home/me/sites/dashboard.mysite.com/virtualenv/local/lib/python2.7/site-packages/pip/utils/ui.py", line 133, in iter
for x in it:
File "/home/me/sites/dashboard.mysite.com/virtualenv/local/lib/python2.7/site-packages/pip/download.py", line 586, in resp_read
decode_content=False):
File "/home/me/sites/dashboard.mysite.com/virtualenv/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 307, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/home/me/sites/dashboard.mysite.com/virtualenv/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 243, in read
data = self._fp.read(amt)
File "/home/me/sites/dashboard.mysite.com/virtualenv/local/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 54, in read
self.__callback(self.__buf.getvalue())
File "/home/me/sites/dashboard.mysite.com/virtualenv/local/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.py", line 224, in cache_response
self.serializer.dumps(request, response, body=body),
File "/home/me/sites/dashboard.mysite.com/virtualenv/local/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.py", line 49, in dumps
"body": _b64_encode_bytes(body),
File "/home/me/sites/dashboard.mysite.com/virtualenv/local/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.py", line 12, in _b64_encode_bytes
return base64.b64encode(b).decode("ascii")
MemoryError
Any thoughts about what might be going on and why I am getting a Memory Error?
This appears to be the MemoryError while trying to install a large package (matplotlib) in a low memory environment. It appears that the cause is the caching mechanism, as disabling the cache fixes the issue.
Try this:
pip install --no-cache-dir matplotlib

Categories