MemoryError: needs a '--no-cache-dir' install option
See original GitHub issueFails with a Memory Error when using pipenv install on a machine without large memory - e.g. a minimal docker image, (although it appears to have adequate memory for most development - 800Mb / 1Gb available, and the same package works ok on most other environments) - see stack trace below
It appears to be a problem with pip itself. Excessive memory use when caching large packages #2984 Stack overflow: memory-error-while-using-pip-install-matplotlib
The recommended approach, pip install --no-cache-dir can be used as a workaround to allow this to run without reading the whole package into memory.
Is it possible to supply that argument using pipenv? Are there any other ways to fix it?
Pipfile
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
[packages]
mapnik = "*"
MemoryError
# pipenv install
Creating a virtualenv for this project...
⠋New python executable in /root/.local/share/virtualenvs/opt-zvmYt2-H/bin/python
Installing setuptools, pip, wheel...done.
Virtualenv location: /root/.local/share/virtualenvs/opt-zvmYt2-H
No package provided, installing all dependencies.
Pipfile found at /opt/Pipfile. Considering this to be the project home.
Installing dependencies from Pipfile.lock...
An error occured while installing! 7/30 - 00:00:34
Collecting mapnik==0.1
Downloading mapnik-0.1-cp27-none-any.whl (37.4MB)
Exception:
Traceback (most recent call last):
File "/root/.local/share/virtualenvs/opt-zvmYt2-H/local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/root/.local/share/virtualenvs/opt-zvmYt2-H/local/lib/python2.7/site-packages/pip/commands/install.py", line 335, in run
wb.build(autobuilding=True)
File "/root/.local/share/virtualenvs/opt-zvmYt2-H/local/lib/python2.7/site-packages/pip/wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "/root/.local/share/virtualenvs/opt-zvmYt2-H/local/lib/python2.7/site-packages/pip/req/req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/root/.local/share/virtualenvs/opt-zvmYt2-H/local/lib/python2.7/site-packages/pip/req/req_set.py", line 620, in _prepare_file
session=self.session, hashes=hashes)
File "/root/.local/share/virtualenvs/opt-zvmYt2-H/local/lib/python2.7/site-packages/pip/download.py", line 821, in unpack_url
hashes=hashes
File "/root/.local/share/virtualenvs/opt-zvmYt2-H/local/lib/python2.7/site-packages/pip/download.py", line 659, in unpack_http_url
hashes)
File "/root/.local/share/virtualenvs/opt-zvmYt2-H/local/lib/python2.7/site-packages/pip/download.py", line 882, in _download_http_url
_download_url(resp, link, content_file, hashes)
File "/root/.local/share/virtualenvs/opt-zvmYt2-H/local/lib/python2.7/site-packages/pip/download.py", line 603, in _download_url
hashes.check_against_chunks(downloaded_chunks)
File "/root/.local/share/virtualenvs/opt-zvmYt2-H/local/lib/python2.7/site-packages/pip/utils/hashes.py", line 46, in check_against_chunks
for chunk in chunks:
File "/root/.local/share/virtualenvs/opt-zvmYt2-H/local/lib/python2.7/site-packages/pip/download.py", line 571, in written_chunks
for chunk in chunks:
File "/root/.local/share/virtualenvs/opt-zvmYt2-H/local/lib/python2.7/site-packages/pip/utils/ui.py", line 139, in iter
for x in it:
File "/root/.local/share/virtualenvs/opt-zvmYt2-H/local/lib/python2.7/site-packages/pip/download.py", line 560, in resp_read
decode_content=False):
File "/root/.local/share/virtualenvs/opt-zvmYt2-H/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 357, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/root/.local/share/virtualenvs/opt-zvmYt2-H/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.py", line 314, in read
data = self._fp.read(amt)
File "/root/.local/share/virtualenvs/opt-zvmYt2-H/local/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 63, in read
self._close()
File "/root/.local/share/virtualenvs/opt-zvmYt2-H/local/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 50, in _close
self.__callback(self.__buf.getvalue())
File "/root/.local/share/virtualenvs/opt-zvmYt2-H/local/lib/python2.7/site-packages/pip/_vendor/cachecontrol/controller.py", line 275, in cache_response
self.serializer.dumps(request, response, body=body),
File "/root/.local/share/virtualenvs/opt-zvmYt2-H/local/lib/python2.7/site-packages/pip/_vendor/cachecontrol/serialize.py", line 87, in dumps
).encode("utf8"),
MemoryError
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Docker : error while performing "RUN pip install --no-cache ...
cache /pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check...
Read more >How to install torch in python - Intellipaat Community
I attempted pip3 install torch --no-cache-dir Later, I got: Collecting torch ... , yet I can't utilize that package outside conda.
Read more >Installation on Windows — Kivy 1.10.1 documentation
If you encounter a MemoryError while installing, add after pip install an option –no-cache-dir . For Python 3.5+, you can also use the...
Read more >Troubleshooting - Horovod documentation - Read the Docs
Pip install: no such option: –no-cache-dir¶. If you see the error message below, it means that your version of pip is out of...
Read more >pip install torch memory error
apt-get install python-matplotlib This error is coming up because, it seems, pip's caching mechanism is trying to read the entire file into memory...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As a workaround, I type the following in the terminal instead of using the pip.conf file:
$> export PIP_NO_CACHE_DIR=false
It will work. Hope it will help those who read this thread.
reference: https://pip.pypa.io/en/stable/user_guide/#configuration
open an issue with pip, to see if they’ll honor an environment variable for this.