question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow user to define temp directory location

See original GitHub issue
  • Pip version: 9.0.1
  • Python version: 3.5
  • Operating system: Trisquel

Description:

I have two partitions in the Linux box. One with 20 GB (partition 1) where OS runs and data are stored in other partition with 250+ GB space (partition 2).

The partition 1 always has less than 1 GB of space after prolonged use of the machine and so far no other program has complained about the lack of space.

When I run pip I specify an option for cache-dir in the partition 2. Unfortunately, pip creates temp directory in /tmp directory. This creates problem while installing large set of packages like tensorflow. Specifying target option isn’t helpful. Here is the code which creates temp directory.

    if options.target_dir:
            options.ignore_installed = True
            temp_target_dir = tempfile.mkdtemp()
            options.target_dir = os.path.abspath(options.target_dir)
            if (os.path.exists(options.target_dir) and not
                    os.path.isdir(options.target_dir)):
                raise CommandError(
                    "Target path exists but is not a directory, will not "
                    "continue."
                )
            install_options.append('--home=' + temp_target_dir)

One option is to use dir option while creating the directory.

  • Does it make sense to call tempfile.mkdtemp( dir=options.target_dir)?
  • Does it make sense to get the tmp directory from user?

What I’ve run:

krace@hotbox /m/u/c/tf> pwd
/media/user/code/tf
pip install tensorflow protobuf==3.0.0 numpy==1.11.1 pandas==0.18.1 bokeh==0.12.3 matplotlib pillow==3.4.2 --cache-dir .
Traceback (most recent call last):
  File "/media/user/code/tf/venv/lib/python3.5/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/media/user/code/tf/venv/lib/python3.5/site-packages/pip/commands/install.py", line 336, in run
    wb.build(autobuilding=True)
  File "/media/user/code/tf/venv/lib/python3.5/site-packages/pip/wheel.py", line 749, in build
    self.requirement_set.prepare_files(self.finder)
  File "/media/user/code/tf/venv/lib/python3.5/site-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/media/user/code/tf/venv/lib/python3.5/site-packages/pip/req/req_set.py", line 620, in _prepare_file
    session=self.session, hashes=hashes)
  File "/media/user/code/tf/venv/lib/python3.5/site-packages/pip/download.py", line 821, in unpack_url
    hashes=hashes
  File "/media/user/code/tf/venv/lib/python3.5/site-packages/pip/download.py", line 663, in unpack_http_url
    unpack_file(from_path, location, content_type, link)
  File "/media/user/code/tf/venv/lib/python3.5/site-packages/pip/utils/__init__.py", line 600, in unpack_file
    flatten=not filename.endswith('.whl')
  File "/media/user/code/tfvenv/lib/python3.5/site-packages/pip/utils/__init__.py", line 502, in unzip_file
    fp.write(data)
OSError: [Errno 28] No space left on device


Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
pfmoorecommented, May 3, 2017

AIUI pip should respect the standard TMPDIR environment variable. Does that work for you?

0reactions
lock[bot]commented, Jun 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to assign permissions for the Windows Temporary folder
Click Start, click Run, type explorer, and then click OK. · In Windows Explorer, move to the <drive:>\Windows folder. · Right-click Temp, and...
Read more >
windows 7 - Temp directory for all users? - Super User
Redirecting temp for all users to a single folder is not a good idea. Some applications write temp stuff related to a particular...
Read more >
How to set system TEMP and TMP to a different drive in ...
Right click on Computer and click on Properties. · Click on Advanced system settings on the left panel resulting in a dialog box...
Read more >
How to get temporary folder for current user - Stack Overflow
The TEMP environment variable would be set in two places: for the user itself, and for the local machine. If it's not set...
Read more >
Changing the Windows TEMP and TMP Directory
The Edit User Variable dialog box will be displayed. Alternatively, the user can double-click the TEMP variable row to display this dialog box....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found