Skip to content
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

Generate Pypi-compatible indexes for our wheelhouses #114

Open
mboisson opened this issue Aug 11, 2022 · 4 comments
Open

Generate Pypi-compatible indexes for our wheelhouses #114

mboisson opened this issue Aug 11, 2022 · 4 comments
Assignees
Labels
discussion needed Issues that require discussion enhancement New feature or request

Comments

@mboisson
Copy link
Member

mboisson commented Aug 11, 2022

Using:
https://pypi.org/project/dumb-pypi/

We can generate a plain static file local Pypi index:

module load python/3.8
virtualenv dumb-pypi
source dumb-pypi/bin/activate
pip install dumb-pypi
pushd /cvmfs/soft.computecanada.ca/custom/python/wheelhouse/generic/; ls *.whl > ~/tmp/generic.lst; popd
dumb-pypi --package-list generic.lst --packages-url file:///cvmfs/soft.computecanada.ca/custom/python/wheelhouse/generic/ --output-dir generic-index

To use that index:

unset PIP_CONFIG_FILE
pip install --index file:///home/mboisson/tmp/generic-index/simple torch
Looking in indexes: file:///home/mboisson/tmp/generic-index/simple
Processing /cvmfs/soft.computecanada.ca/custom/python/wheelhouse/generic/torch-1.9.1+computecanada-cp38-cp38-linux_x86_64.whl
Processing /cvmfs/soft.computecanada.ca/custom/python/wheelhouse/generic/typing_extensions-4.3.0+computecanada-py3-none-any.whl
Installing collected packages: typing-extensions, torch
Successfully installed torch-1.9.1+computecanada typing-extensions-4.3.0+computecanada

What’s the significance of this ? We can generate and serve serverless instances of a local pypi. That means those can be used by tools that don’t support --find-links to point to a local directory containing wheels and only support pypi-style repositories (looking at you, poetry)

@mboisson
Copy link
Member Author

Well, that does not work with poetry because of this:

  InvalidSchema

  No connection adapters were found for 'file:///home/mboisson/tmp/generic-index/simple/torch/'

  at test_poetry/lib/python3.8/site-packages/requests/sessions.py:792 in get_adapter
      788│             if url.lower().startswith(prefix.lower()):
      789│                 return adapter
      790│
      791│         # Nothing matches :-/
    → 792│         raise InvalidSchema(f"No connection adapters were found for {url!r}")
      793│
      794│     def close(self):
      795│         """Closes all adapters and as such the session"""
      796│         for v in self.adapters.values():`

references: psf/requests#2732

@mboisson
Copy link
Member Author

It could be possible to generate the index, and then serve them locally using a local http.server:

python -m http.server $((UID % 60000 + 1024)) --directory /home/mboisson/tmp/local-index/ &

We must then add a symbolic link to the wheelhouse inside of that folder.

@mboisson mboisson added the discussion needed Issues that require discussion label Sep 15, 2022
@mklasby
Copy link

mklasby commented Sep 19, 2022

+1, this would be a big help so that we can effectively use poetry in compute canada servers. I do think this issue is best addressed in poetry itself as there really should be support for --find-links similar to pip.

My current workarounds are to either download the necessary wheels to my project and edit the pyproject.toml file to point the dependency to the cc wheel or build the lock file on a local environment and poetry export to a requirements file that I can use pip with to rebuild on compute canada with the local wheelhouse

@ccoulombe
Copy link
Contributor

ccoulombe commented Nov 8, 2022

I think poetry should instead provide the means to find wheels via find-links. If a PR is not already open, it would be the best solution.

Plus, poetry managed repository can be installed by pip with PEP-517.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion needed Issues that require discussion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants