-
Notifications
You must be signed in to change notification settings - Fork 364
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
Add wheels to PyPI #219
Comments
Is whl for Spacy for python 2.7 64-bit available now? |
Cannot install spacy in Anaconda python2.7-64-bit in Windows 10. Any help appreciated.
|
The reason this hasn't been done is just because it feels like such a hassle for platforms mainly used for dev. And would we do it once we'd have to continue supporting it. But we'll see. I'll look into how messy this is. |
@Jahaja I'd really appreciate wheels in the package too, as it's something that blocks us from installing Sanic easily. There's a demo for how to build them automatically for linux: https://github.com/pypa/python-manylinux-demo |
We would very much appreciate ujson as a manylinux wheel, so that we can use it here with API Star (and Sanic) on Lambda: Miserlou/Zappa#801 |
It would also help out when you cant use gcc on the server, my sysadmins dont allow gcc so I cannot build from source. |
I have wheels for 2.7-3.6 building see #280. Im working on Windows wheels now. |
Windows wheels are looking to be a bit more complicated. For example VS 2008 doesn't have stdint.h (which is easy enough to work around by doing the defines on Windows manually), and ultrajson.h isn't getting included correctly. |
@ethanhs any update on this? |
There are unofficial windows wheels for lfd.uci.edu/~gohlke/pythonlibs is a great site, with a huge list of windows binaries for Python. |
Hi @hugovk! I'm happy to reopen my PR |
here's a script which builds the manylinux wheels: #!/usr/bin/env python3
import argparse
import os.path
import re
import subprocess
VERSION = re.compile(r':: Python :: (\d\.\d)$')
EXES = []
with open('setup.py') as f:
for line in f:
match = VERSION.search(line)
if match:
major_s, minor_s = match[1].split('.')
major, minor = int(major_s), int(minor_s)
if (major, minor) == (2, 7):
EXES.extend(('cp27-cp27mu', 'cp27-cp27m'))
elif (major, minor) < (3, 8):
EXES.append(f'cp{major}{minor}-cp{major}{minor}m')
else:
EXES.append(f'cp{major}{minor}-cp{major}{minor}')
def main():
parser = argparse.ArgumentParser()
parser.add_argument('version')
args = parser.parse_args()
pkg = f'ujson=={args.version}'
os.makedirs('dist', exist_ok=True)
for exe in EXES:
pip = f'/opt/python/{exe}/bin/pip'
if subprocess.call((
'docker', 'run', '--rm',
# so files are not root-owned
'--user', f'{os.getuid()}:{os.getgid()}',
'--volume', f'{os.path.abspath("dist")}:/dist:rw',
'quay.io/pypa/manylinux1_x86_64:latest',
'bash', '-euxc',
f'{pip} wheel -w /tmp/wheels --no-deps {pkg} && '
f'auditwheel repair -w /dist /tmp/wheels/*.whl',
)):
return 1
return 0
if __name__ == '__main__':
exit(main()) feel free to steal / adjust it |
output: $ ./bin/build-manylinux 2.0.1
...
$ ls dist/
ujson-2.0.1-cp27-cp27m-manylinux1_x86_64.whl
ujson-2.0.1-cp27-cp27mu-manylinux1_x86_64.whl
ujson-2.0.1-cp35-cp35m-manylinux1_x86_64.whl
ujson-2.0.1-cp36-cp36m-manylinux1_x86_64.whl
ujson-2.0.1-cp37-cp37m-manylinux1_x86_64.whl
ujson-2.0.1-cp38-cp38-manylinux1_x86_64.whl |
I really prefer to create wheel files using docker images for greater binary compatibility. You can see how I did that in a Cython project of mine. Also, the bash script that does the actual build. I kind of "borrowed" the idea from here 😅 |
@vltr that's exactly what the script does if you read it ;) |
@asottile argh, I'm really sorry, I think I passed through the docker call 😬 |
Thanks! I've added that to the repo in #379. Once that's merged, I suggest doing this:
|
Windows |
Any luck with MacOS wheels? |
Maybe consider cibuildwheel? |
Hi, I've set up a few C extension wheel building pipelines on TravisCI before. I could do this pretty easily for ujson and resolve this issue permanently. Would you be ok for me to do this? |
It would be better to just use Github Actions like the current situation, which makes things simpler and avoids having to deal with multiple CI systems. |
Ok, no problem. Let me know if you change your mind. Travis is pretty easy. |
Not my call :-)
So are github actions 🤷 |
Alright fair enough. I'd just want to see this resolved. |
Yes please! GitHub Actions is preferred, but Travis CI is fine too! |
@hugovk and everyone else, sorry for not being able to see this (yet). Family issues + Covid-19 + work adaptations made any of my extra time to vanish into thin air 😬 |
@vltr No problem whatsoever, all the best. |
OK. I've setup a github action and got it working. @goanpeca I take back what I said about TravisCI - github actions are much easier. I'll to a pull request in a bit. Are we still trying to support Python 2.7? It's causing issues on Mac. |
Awesome @bwoodsend thanks for working on it :-) |
Thank you! No need to support 2.7 any more, it's just been dropped in #404. |
Thanks to @bwoodsend we now have Windows and macOS wheels for Python 3.5-3.8 ready for testing! It would be great if some people could test out -- but not in production -- the wheels, especially on Windows. You can find them here: |
✅ Smoke test on macOS: import sys
print(sys.version)
import ujson
print(ujson.__version__)
print(ujson.dumps([{"key": "value"}, 81, True]))
|
✅ Same smoke test on |
I can confirm the Windows ones work. Don't ask me what's going on with my Python PATHs. @hugovk I wish my python installations were as organised as yours. Python3.5> λ C:\test_environments\vpl_testing\py_3_5_3\python -m pip install -i https://test.pypi.org/simple/ ujson==2.0.4.dev47
Requirement already satisfied: ujson==2.0.4.dev47 in c:\test_environments\vpl_testing\py_3_5_3\lib\site-packages
You are using pip version 9.0.1, however version 20.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
> λ C:\test_environments\vpl_testing\py_3_5_3\python.exe ujson-smoke.py
3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 16:02:32) [MSC v.1900 64 bit (AMD64)]
2.0.4.dev47
[{"key":"value"},81,true] Python3.6> λ C:\test_environments\vpl_testing\py_3_6_0\python -m pip install -i https://test.pypi.org/simple/ ujson==2.0.4.dev47
Looking in indexes: https://test.pypi.org/simple/
Collecting ujson==2.0.4.dev47
Downloading https://test-files.pythonhosted.org/packages/22/02/d3eb57c4b6933794d510abb153487fb7790a7162a79bd7e9b093d3e88992/ujson-2.0.4.dev47-cp36-cp36m-win_amd64.whl (43 kB)
|████████████████████████████████| 43 kB 213 kB/s
Installing collected packages: ujson
Successfully installed ujson-2.0.4.dev47
> λ C:\test_environments\vpl_testing\py_3_6_0\\python.exe ujson-smoke.py
3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)]
2.0.4.dev47
[{"key":"value"},81,true] Python3.7> λ E:\pythons\py_3_7_7\python -m pip install -i https://test.pypi.org/simple/ ujson==2.0.4.dev47
Looking in indexes: https://test.pypi.org/simple/
Collecting ujson==2.0.4.dev47
Downloading https://test-files.pythonhosted.org/packages/0f/65/3007df5aff41c83eff7c779b5bddee48d575f3c189c410dd8cf3d03dbc20/ujson-2.0.4.dev47-cp37-cp37m-win_amd64.whl (43kB)
|████████████████████████████████| 51kB 409kB/s
Installing collected packages: ujson
Successfully installed ujson-2.0.4.dev47
> λ E:\pythons\py_3_7_7\python ujson-smoke.py
3.7.7 (tags/v3.7.7:d7c567b08f, Mar 10 2020, 10:41:24) [MSC v.1900 64 bit (AMD64)]
2.0.4.dev47
[{"key":"value"},81,true] Python3.8 (my default).> pip install -i https://test.pypi.org/simple/ ujson==2.0.4.dev47
Looking in indexes: https://test.pypi.org/simple/
Collecting ujson==2.0.4.dev47
Downloading https://test-files.pythonhosted.org/packages/dd/28/cb07a3c3d1822927577978e07b6da724a07c577db7c06f00a29be24e77c3/ujson-2.0.4.dev47-cp38-cp38-win_amd64.whl (43 kB)
|████████████████████████████████| 43 kB 274 kB/s
Installing collected packages: ujson
Attempting uninstall: ujson
Found existing installation: ujson 1.35
Uninstalling ujson-1.35:
Successfully uninstalled ujson-1.35
Successfully installed ujson-2.0.4.dev47
> λ python ujson-smoke.py
3.8.0 (tags/v3.8.0:fa919fd, Oct 14 2019, 19:37:50) [MSC v.1916 64 bit (AMD64)]
2.0.4.dev47
[{"key":"value"},81,true] |
Ahh @hugovk I see you beat me to it... |
Thanks, good to see it working in other environments too :) (I use pyenv for non-3.8 installations.) |
Thanks for sharing that. I've found all kinds of environment managers that seem to do everything except multiple Pythons. |
Any idea when this can propagate to normal PyPi? I can't wait to be shot of all my statements along the lines of: try:
import ujson as json
except ImportError:
import json |
Within a week or so? I'd like to give others a few days to test out too. |
OK. Looking forward to it. Big thanks for letting and helping me do this. 🚀🚀 |
"A week or so" became 28 days, but wheels are now released on PyPI! Thanks everyone! |
First, thanks for building and maintaining ujson. We at spaCy use it pretty much everywhere where we deal with json.
While many users don't mind installing from source, now as we have with wheels a solid binary distribution format it would be great if you could adopt it and provide wheels for OS X and Windows on PyPI.
Setting up a build environment on Windows is particularly tricky as there is no simple guide you can follow that applies to all Python versions. What makes matters worse is that pip's error on a missing msvc compiler is unnecessarily cryptic and people are easily confused, see explosion/spaCy#334
The Python community is already pretty far in adopting wheels, see http://pythonwheels.com, unfortunately ujson still belongs in the not-supporting camp. As a popular Python package I urge you guys to adopt wheels.
If you would provide wheels spaCy could be installed without build system on OS X and Windows as ujson is the only non-wheel dependency missing. I guess there will be many other projects that will benefit from it as well. If you think that's not possible we will probably have to switch to a slower alternative and/or provide a graceful fallback, that's not my preference though.
If you need help setting up an automatic build system I can lend a hand. I would be also happy to provide ours (https://ci.spacy.io) to you.
The text was updated successfully, but these errors were encountered: