-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Allow poetry add
to force build dependencies from source
#5599
Comments
If you need to avoid installation during add you can do the following (with #5600). poetry add --lock package
poetry install --no-binary package |
If it's not remembered in pyproject.toml, every person building the project will have to be told to do the --no-binary install option though, no? |
Perhaps. However, this is a user preference and not a project preference I believe. I'm unsure if a project level preference for this really makes sense. That would mean we lock only source distribution etc (which is weird when a bdist is available) and further there is no way to put this information in the project's metadata when building bdist or sdists. |
@abn what you say does make sense as this is not exactly a project level preference. The work around to use |
@abn I am afraid that this can be a project preference and/or even necessity. A common issue with geospatial packages is that they bundle e.g. GEOS inside the wheel. When you need more than one of these packages and the GEOS binaries are different you run into trouble. E.g.: geopandas/geopandas#2355 To replicate with
will result in performance issues (and/or strange bugs)
To circumvent this you need to pretty much always use the source distribution for both shapely and pygeos. So, if I understand this correctly, in order to install the source distributions you have to do it like this:
which indeed works. The question is what happens when a new
Am I wrong? |
You are not wrong in the update case. You can also use The implementation I have proposed is purely focussed on cases where a project is being deployed. I might revert the change and reconsider a broader implementation. However, this will introduce a range of other issues.
I still do think the project should enforce what distribution is used by the user when being installed. Maybe it is better off as a |
@abn thank you very much for taking the time to further look into this. I understand that these geospatial packages are kind of a niche field, but they are an existing pain point WRT to poetry usage/adoption. As far as the metadata goes, I am afraid I don't have much to offer. I have never had a close look at the relevant PEPs. Nevertheless, it feels that forcing binary or source distributions at the package level is somewhat questionable. The choice of which distribution to install should be made downstream by whomever deploys the software. Therefore a package should not contain such information. For example, using the binary distribution might be OK in certain cases. E.g. you might not have a compiler where you deploy, or you might be missing the GEOS library or whatever. In these cases you want the binary package, even if it means degraded performance. That being said, i don't consider the deployment of a package a huge issue. Pip can handle it just fine. E.g.
The question is what do you do while developing. And this brings me to the thing that I am not really fond of with #5600, i.e. the fact that the commands to install/upgrade stop being simple to use. Practically speaking, you will never be able to use plain At first glance, from a UX point of view, #5609 seems a much better workaround to me. That being said, it could be argued that package specific configurations don't really belong in |
The thing is, it's not package specific but rather environment specific. As in, chances are if you want sdist for a particular package, you'd need that for other projects on the system as well. Applies the other way around too. And poetry right now is strict when parsing pyproject toml. This means poetry-core will need to allow this first etc. And I don't think there is a good place in there for this either. I'd be against putting this in the dependency specification because as I said this is an environment configuration not a project configuration per say. Atleast for now I do not see this changing. |
@abn Hi abn, trying to implement this command with grpcio as it can't build on Mac M1 with the binary, but am getting the error |
This is added in version 1.2 here which is still in beta. You can install beta to use this feature |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Feature Request
Can we have an option in
poetry add
to build a dependency from source instead of just downloading the existing package for the platform?I am talking something equivalent to
pip3 install --no-binary :all: <package> --ignore-installed
.Current work-around is to use
poetry run pip3 install ....
and then dopoetry add --lock
to update the lock file. It will be good to have a flag inadd
to do this easily.The text was updated successfully, but these errors were encountered: