Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Python by (16.4k points)

I attempted

pip3 install torch --no-cache-dir

Later, I got:

Collecting torch

      Downloading https://files.pythonhosted.org/packages/24/19/4804aea17cd136f1705a5e98a00618cb8f6ccc375ad8bfa437408e09d058/torch-1.4.0-cp36-cp36m-manylinux1_x86_64.whl (753.4MB)

        100% |████████████████████████████████| 753.4MB 5.7MB/s 

    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 342, in run

        requirement_set.prepare_files(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 620, in _prepare_file

        session=self.session, hashes=hashes)

      File "/usr/lib/python3/dist-packages/pip/download.py", line 821, in unpack_url

        hashes=hashes

      File "/usr/lib/python3/dist-packages/pip/download.py", line 663, in unpack_http_url

        unpack_file(from_path, location, content_type, link)

      File "/usr/lib/python3/dist-packages/pip/utils/__init__.py", line 617, in unpack_file

        flatten=not filename.endswith('.whl')

      File "/usr/lib/python3/dist-packages/pip/utils/__init__.py", line 506, in unzip_file

        data = zip.read(name)

      File "/usr/lib/python3.6/zipfile.py", line 1338, in read

        return fp.read()

      File "/usr/lib/python3.6/zipfile.py", line 858, in read

        buf += self._read1(self.MAX_N)

      File "/usr/lib/python3.6/zipfile.py", line 948, in _read1

        data = self._decompressor.decompress(data, n)

    MemoryError

What would it be a good idea for me to do now to install PyTorch? 

I attempted pretty much every method referenced on google. I'm dealing with Ubuntu, I took a try at utilizing conda as well, yet I can't utilize that package outside conda.

1 Answer

0 votes
by (26.4k points)

You can try this for pip environment

pip3 install torchvision

Try below code, for code environment (Execute the command at anaconda prompt)

conda install PyTorch -c PyTorch

You can also try the below code to turn off your cache

pip3 --no--cache-dir install torchvision

or

pip3 install torchvision--no-cache-dir

or

pip install --no-cache-dir torchvision

Try to execute one by one

Are you looking for a good python tutorial? Join the python course fast and gain more knowledge in python.

Related questions

0 votes
3 answers
0 votes
1 answer
asked Nov 27, 2020 in Python by bharathbk (280 points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jul 5, 2019 in Python by Sammy (47.6k points)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...