8000 Rebuild ld cache in build by 8W9aG · Pull Request #1903 · replicate/cog · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Rebuild ld cache in build #1903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 11, 2024
Merged

Rebuild ld cache in build #1903

merged 4 commits into from
Sep 11, 2024

Conversation

8W9aG
Copy link
Contributor
@8W9aG 8W9aG commented Aug 23, 2024
  • Find all the python related SO’s, and their corresponding folders and put them in a cog.conf
    file in the /etc/ld.so.conf.d folder
  • Run ldconfig to rebuild the cache

* Find all the python related SO’s, and their
corresponding folders and put them in a cog.conf
file in the /etc/ld.so.conf.d folder
* Run ldconfig to rebuild the cache
Copy link
Contributor
@technillogue technillogue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks good, a related optimization I've used in the past is putting all the dependencies in . to reduce the number of ENOENT when importing. normally, python will go over everything in sys.path (usually starting with .) and try to open each library at each path. when I first tried I had some trouble with pyenv and installed binaries, but maybe something similar could work.

@8W9aG
Copy link
Contributor Author
8W9aG commented Aug 27, 2024

this looks good, a related optimization I've used in the past is putting all the dependencies in . to reduce the number of ENOENT when importing. normally, python will go over everything in sys.path (usually starting with .) and try to open each library at each path. when I first dad I had some trouble with pyenv and installed binaries, but maybe something similar could work.

I like that idea, I did see a tonne of ENOENT when I performed strace over the python invocation.

@8W9aG 8W9aG mentioned this pull request Aug 27, 2024
@technillogue
Copy link
Contributor

fwiw I believe nix using absolute paths for everything also helps

this is the current sys.path on a random container: ['', '/root/.pyenv/versions/3.10.14/lib/python310.zip', '/root/.pyenv/versions/3.10.14/lib/python3.10', '/root/.pyenv/versions/3.10.14/lib/python3.10/lib-dynload', '/root/.pyenv/versions/3.10.14/lib/python3.10/site-packages']

we might be able to improve on this in a simpler way by just shuffling it so that site-packages are first, or just symlinking all of site-packages into .

Signed-off-by: Will Sackfield <sackfield@replicate.com>
@8W9aG 8W9aG merged commit ac53c32 into main Sep 11, 2024
15 checks passed
@8W9aG 8W9aG deleted the add-ldcache-build branch September 11, 2024 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0