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 to customize location of .eggs directory

See original GitHub issue

Apparently the PYTHON_EGG_CACHE environment variable does not affect the location of the .eggs directory when building a Python package using a command like python setup.py build: https://github.com/pypa/setuptools/blob/38b9010bc3527e89561c7a985e0908a3071b7ff5/setuptools/dist.py#L745

My code lives in a read-only partition mounted into a Docker container and therefore the build fails:

...
  File "/usr/local/lib/python3.6/dist-packages/pkg_resources/__init__.py", line 1077, in obtain
    return installer(requirement)
  File "/usr/local/lib/python3.6/dist-packages/setuptools/dist.py", line 778, in fetch_build_egg
    install_dir = self.get_egg_cache_dir()
  File "/usr/local/lib/python3.6/dist-packages/setuptools/dist.py", line 747, in get_egg_cache_dir
    os.mkdir(egg_cache_dir)
OSError: [Errno 30] Read-only file system: './.eggs'

Setting the PYTHON_EGG_CACHE variable has no effect on this behavior, but I guess it should?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
gilbsgilbscommented, Sep 1, 2022

It’s not a valid use case, because you need write support to generate the egg-info metadata. And yes, .eggs and .egg-info directory are generated in the source directory.

The point of this issue is that you could write them both in the current working directory (or somewhere else) instead of the project’s directory if write isn’t available there. Is there a specific reason why this would not be possible or desirable? Apart from saying “it’s not a valid use-case” while not suggesting a portable solution to a use-case that does exist for at least two people (and probably more).

Edit: FWIW, this is a polite and understandable yet firm answer. Saying “It’s not a valid use-case” out of nowhere is just being mean and condescending to the users and that doesn’t help. I feel disappointed this kind of behavior is still present in the python packaging community…

0reactions
craigphickscommented, Oct 4, 2020

@gilbsgilbs @tgpfeiffer I had a slightly different problem when specifying an install directory

$ easy_install --install-dir /opt/myapp  myapp.egg
<fail message>

it erred out with a message that it could only write to a valid site-packages directory. As I workaround I set up a virtual environment and activated it

$ python3 -m venv --prompt myapp /opt/myapp
$ /source opt/myapp/bin/activate
(myapp)$ easy_install --install-dir /opt/myapp  myapp.egg
<success message>

As a result under /opt/myapp/lib/site-packages/lib were mostly many compact ‘.egg’ files, and under '/opt/myapp/share were many compact wheel files. The total memory used by the virtual environment only (containing python3, etc.) was 8mb, a small fraction of the total compact installed ‘myapp’ which came to 84mb.

Of course to call ‘myapp’ pre-requires another call to ‘’’
$ /source opt/myapp/bin/activate ‘’’ I don’t grasp your exact usage requirements, but there seemed enough potential overlap I thought it might be worth posting this message.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is the Python egg cache (PYTHON_EGG_CACHE)?
From my investigations it turns out that some eggs are packaged as zip files, and are saved as such in Python's site-packages directory....
Read more >
The Internal Structure of Python Eggs - Setuptools
For the .egg format, the base location is the .egg itself. That is, adding the .egg filename or directory name to sys.path makes...
Read more >
Chapter 38 - The Python egg — Python 101 1.0 documentation
The egg file itself is basically a zip file. If you change the extension to “zip”, you can look inside it and see...
Read more >
Bunny Day - Animal Crossing: New Horizons Wiki Guide - IGN
The different eggs can be used to craft unique Bunny Day recipes that are given by Zipper himself, learned by picking up eggs,...
Read more >
Wilsonville Egg Hunt
Let's Talk, Wilsonville! News · Social Media · Subscribe. Parks & Rec Info. Email · Staff Directory. Parks & Rec Admin Building:
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