What else do you have in your install_requires? Protobuf shouldn't have a dependency on numpy, so could this be coming from something else? Protobuf uses setup.py instead of pyproject.toml and doesn't include numpy there. Looks like we previously had a few things in install_requires in 3.17 and below, but afaict these don't seem to use numpy transitively either.
If this still seems to be coming from protobuf, can you provide more information on where/how you are getting the "ValueError: numpy.ndarray size changed ..." error? On Thu, Aug 4, 2022 at 2:35 AM Sonja Offwood-De Klerk < [email protected]> wrote: > Hi Sandy, > > Thank you so much for your reply. > > So the problem I am facing is that I am trying to install protobuf with > "no binary", so basically I am trying to do > "pip install protobuf --no-binary protobuf" which would work in a > requirements.txt, however our library is packaged with setup.py. From some > googling I came across this solution > <https://stackoverflow.com/questions/68436434/how-to-instruct-pip-to-install-a-requirement-with-no-binary-flag/68437088#68437088> > which indicates > that the workaround is to download the python tar.gz in the > install_requires. (I can't add the --no-binary flag in the the > install-requires) > > Does that make sense? > > Maybe to give a bit more background as to why I am even trying to install > protobuf with the --no-binary flag, because there may be an alternative > solution to my issue - > > When trying to build my environment using your suggestion of > install_requires=['protobuf>=3.17.3'] , I get the following error, which > seems to be caused by a conflict in numpy versions being used in the build > of protobuf vs my local requirements of numpy. > ValueError: numpy.ndarray size changed, may indicate binary > incompatibility. Expected 88 from C header, got 80 from PyObject. > > According to this solution > <https://github.com/scikit-learn-contrib/hdbscan/issues/457#issuecomment-773671043> > which I found for the same error but using a different repo, the options > are to > > - upgrade numpy to >=1.20 (which I can't because I have dependencies > with numpy<1.20) or > - to use "minimum supported numpy" version in pyproject.toml (which > may be an option from the protobuf side?) > - or to install protobuf with the --no-binary tag (which is the one I > am attempting).. > > So I either need "minimum supported numpy" version in pyproject.toml of > protobuf to be set, or to install protobuf with the --no-binary tag? > > Hope you can assist. > Kind regards, > Sonja > > > On Wed, 3 Aug 2022 at 21:49, 'Sandy Zhang' via Protocol Buffers < > [email protected]> wrote: > >> Hi Sonja, >> >> Based on the install_requires documentation >> <https://packaging.python.org/en/latest/discussions/install-requires-vs-requirements/#install-requires>, >> it seems that the specified project is installed by pip. Instead of >> specifying the python tar.gz published on github, I think you should be >> able to specify based on our pypi release >> <https://pypi.org/project/protobuf/#history> instead. Can you try >> install_requires=['protobuf>=3.17.3'] or equivalent for your version >> requirements and let me know if that works instead? >> >> >> On Wednesday, August 3, 2022 at 1:57:43 AM UTC-7 >> [email protected] wrote: >> >>> I am trying to include the dependency to protobuf for python with no >>> binary, and am packaging my library with a setup.py file. I am using the >>> below code: >>> >>> from setuptools import setup, find_packages >>> setup( name='your package`, >>> version='0.1', >>> packages=find_packages(), >>> install_requires= >>> [ 'protobuf@ >>> https://github.com/protocolbuffers/protobuf/releases/download/v3.17.3/protobuf-python-3.17.3.tar.gz' >>> ] >>> ) >>> >>> However it gives the error message "no pyproject.toml or setup.py file >>> found". i have tried various versions/releases of protobif with the same >>> error. >>> >>> When I try to download it manually, I have to first go into the python >>> folder before I can see the setup.py and I assume that extra step is what's >>> causing the issue? >>> >>> Would you be able to assist how I can go about installing the package >>> with no binary to avoid this issue? >>> >>> Kind regards, >>> Sonja >>> >>> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "Protocol Buffers" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/protobuf/cpTyexeJF1c/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/protobuf/da3dc2d3-555b-4112-8ff0-6ec683acb663n%40googlegroups.com >> <https://groups.google.com/d/msgid/protobuf/da3dc2d3-555b-4112-8ff0-6ec683acb663n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/CAFEUQ6OdtvqqJ--tDjdWV3-pT7haotxktinYv9CKCfhUqOKKmA%40mail.gmail.com.
