-
Notifications
You must be signed in to change notification settings - Fork 104
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
pypi auth issue when installing lock-file with package from private index #247
Comments
I had a bit of time debugging this and in the end I traced the bug until here deep in the poetry code base: https://github.com/python-poetry/poetry/blob/1.1/poetry/repositories/legacy_repository.py#L118
self._url is an absolute url, with the auth information: Since href is not relative, urljoin simply returns Not sure what to make out of that though. One of these seems most plausible:
Do you think it would make sense to address this within conda-lock? Something like From @neersighted on poetry discord:
My current hypothesis is that poetry losing the auth information is actually a bug (or at least unexpected behaviour) in the poetry code base, but it doesn't really show for them because poetry discourages adding authentication information to the repo url. I feel the easiest workaround in conda-lock would be to also follow poetries strategy to strip auth information (if not already stripped by poetry) and use |
I had some more time to play around, and removing '#' in this line together with the https://github.com/conda-incubator/conda-lock/blob/main/conda_lock/conda_lock.py#L800 I feel the cleanest way to deal with all of this is to extend stripping and re-adding auth also to poetry-solved packages. I might even have some time to work on that - but it would be nice to get a quick thumbs up/down before I start to make sure I don't miss something obvious before I invest the time :) |
Thanks for looking into this! I see you're working with explicit lockfiles. Do things work any better with new-style lockfiles? |
...I'd personally rather see the new-style lockfiles developed further, so I'm wondering if there's something missing there for your use case. |
Good news and bad news: it seems that switching to the new-stye lockfiles works out of the box - however it seems, I tripped over a new problem: #261. |
I finally had some time to look into this again. I am somewhat sure that skipping lines starting with No matter what lock-file is being used, it seems to get reformatted to the explicit lockfile style, which has pip entries as Would you be fine with a PR that changes the logic such that lines starting with |
Sounds reasonable to me. @mariusvniekerk, do you agree? |
FYI I'm having this exact issue. Glad to see there exists a reasonable solution, eagerly awaiting it! |
@mariusvniekerk any thoughts on this one? I am still interested in fixing this. |
Just in case anyone is coming here because you are trying get reproducible environments with conda and python packages (including private repos), you might try the combo of conda+poetry rather than conda+pip. It is a little more work to set up but I think the benefits of poetry have made it worth the effort in my opinion. Here is a great post explaining how to do it. |
@kevinpauli, I personally did not get this to work, at least not for pytorch. I tried satisfying pytorch with conda-forge::pytorch-gpu and torch from pypi, both pinned down to patch, and poetry still pulled in a wealth of packages for pytorch. I guess it only really works if the conda and pip packages have exactly the same dependencies with exactly the same names. |
I am struggeling getting conda-lock with a private gitlab index to work:
I have setup my pypi repository following the instructions on the readme.
poetry config repositories.foo
gives me the expected output:with this I was able to create a lockfile with
conda-lock lock -k explict
.The lockfile lists the package as:
In the lock file the url does not contain the authentication information.
If I try to create the environment from the lock file, i get an auth error:
I tried to play around with the
--auth
option but this one only seems to apply to private conda packages - pip entries start with a#
and are automatically ignored.Any clues what i am missing here? How is the authentication supposed to work? Should the auth information be in the pypi index url in the lockfile - and if so, how do I get it there?
The text was updated successfully, but these errors were encountered: