-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
conda-based installation #189
Comments
That's fantastic, thanks Eric!
…On Thu, Jan 3, 2019 at 7:54 AM Eric Ma ***@***.***> wrote:
Putting this here and tagging myself @ericmjl <https://github.com/ericmjl>
so that I can remember this exists.
To get jax into the hands of data scientists and machine learning
researchers, conda installation would be very useful. I will take a stab
at this on conda-forge, and record my progress here.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#189>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJ4j3X8A5mSS07XGNkaMF5M2cehsW0Cks5u_WnhgaJpZM4ZnfRC>
.
|
To start off, I tried getting jax onto my own personal channel on anaconda.org. If I can do this successfully, usually I am able to get it onto conda-forge with no problems. Commands executed:
Everything builds correctly up till the point where the import tests run. Unfortunately, I don't see the a tarball for |
The tarball urls can be found here
https://github.com/google/jax/blob/master/README.md#pip-installation
…On Thu, Jan 3, 2019 at 8:19 AM Eric Ma ***@***.***> wrote:
To start off, I tried getting jax onto my own personal channel on
anaconda.org. If I can do this successfully, usually I am able to get it
onto conda-forge with no problems.
Commands executed:
$ conda skeleton pypi jax
$ cd jax
$ conda build .
Everything builds correctly up till the point where the import tests run.
jax imports jaxlib, and jaxlib needs to be on conda-forge and specified
as a dependency of jax in order for the jax build process to work
properly.
Unfortunately, I don't see the a tarball for jaxlib on PyPI. Perhaps that
needs to go up first?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#189 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAJ4jy10OLOqxUDj3gZhjDIkzh9r3i_fks5u_W_QgaJpZM4ZnfRC>
.
|
@alexbw I think those are the wheel URLs, not the tarballs. Does |
@ocefpaf, one question for you - can we pull down Python wheels from a URL and use that pre-compiled wheel as part of a conda-forge-based recipe? Having had a night to sleep over this issue, it seems to me that building from source is going to be a painful thing to do on conda-forge, while having pre-compiled Python wheels installed into the correct location would be easier. |
Even though prefer building from source we do "repacking" in cases like that. Here is an example: https://github.com/conda-forge/flask-restplus-feedstock/blob/d41ecd6077ba51df75cb15a2b06e737bdc43f8d6/recipe/meta.yaml |
@ocefpaf thanks for the response! Another dumb question, hope you don't mind - the jaxlib wheels are for macOS and Linux only: https://pypi.org/project/jaxlib/#files I plan to "repackage" only the Python 3 wheels. Is there a way for us to specify which repackaged wheel to be downloaded, based on OS? Or is this out of scope for conda-forge? |
Thanks for driving this, Eric! Just a question: how do we know that building will be painful on conda-forge? Our build process and build script are pretty simple if we can install and run bazel and meet the compiler toolchain requirements of TensorFlow. Since there are already conda packages for TF, we should be able to follow that setup, since the only thing JAX needs to compile from source is a sub-target inside TF. In other words, if we knew how to build TF on conda-forge, then we'd already know how to build what JAX needs, as it's a subset of TF. |
@mattjj the bazel portion of installation takes quite a long while to run, which is what drives most of the "pain" from installation. If I am not mistaken, it may be a drain on free community resources to have to build jaxlib from scratch each time. @ocefpaf, do you have any input on this? For reference, it takes over 10 minutes on my home GPU tower to build from source. |
Yep. Just use the pre-processor selectors like in this example.
At the moment we, conda-forge, cannot afford long builds (>1 hour) and we do not have GPU support yet. However, we are experimenting with azure pipelines to be able to do long builds, and I believe we may get even some GPUs. More on this soon... |
This is very helpful, thank you @ocefpaf! |
Wanted to ensure that there was a cross-reference. jaxlib conda-forge PR is here: conda-forge/staged-recipes#7529 I mimicked the Tensorflow build recipe. Each time there's an update to jaxlib, the recipe, specifically No builds happen for Windows, as it is currently unavailable. To encourage Py3k adoption, I also intentionally did not include the Python 2 wheels in the build. |
Looping back here about conda, guys. I tried submitting a PR for just jaxlib: conda-forge/staged-recipes#7529 However, it appears that there is an issue with the macOS build, which is only resolvable by building from source. I think things will be cleaner if jaxlib is separated from jax. @mattjj, I remember this was on your roadmap before - am I remembering correctly, or am I mistaken about this? |
Yes, we had a plan to separate out jaxlib and call it xlapy, though it hasn't been a high priority compared to other work because there hasn't been a clear upside. Is it possible to have separate conda packages for jax and jaxlib, without splitting the git repository? I ask mainly because we might not have time to dig into this for a while. |
@mattjj I can try something - e.g. downloading an zip or tar archive of the whole jax repository, and then building from source. Could you guys put up a tagged release on GitHub? That's generally better received by the conda-forge admins, and it'll give me a so-called "point release reference" that I can point the build recipe against, rather than always building against an ever-evolving |
Hah, looks like I was one step too fast for the conda-forge admins. I just updated the conda-forge PR: conda-forge/staged-recipes#7529 Looks like there's a fix for the error being encountered before. |
Is it viable to instead just clone a specific git commit? We might be able to do tagged releases and stuff, but I'd like to minimize the number of potential blockers for you. |
Any updates? Anything we can help with? It looks like other folks are eager for Conda packages too (#302) Thanks! |
@hawkinsp I'm still working on it! 😄 But yes, I've run into conda build issues at the moment. I stepped away from the conda-forge build for a little while (kwargs="work"), but you can track progress here: conda-forge/staged-recipes#7529 That PR, btw, is just a "copy the wheels over" PR to enable jax on CPU to be distributed by conda-forge. I think it will be more difficult to get jax + GPU over, unless there's a build process at Google you guys could use to release jax+jaxlib wheels targeted for various CUDAs? (If so, then I could re-attempt things.) |
Well, we build wheels for Python {2.7, 3.6, 3.7} x CUDA {9.0, 9.2, 10.0} already, which are the ones linked here: Our build script is open source: it is done by this script using a Docker container: https://github.com/google/jax/blob/master/build/build_jaxlib_wheels.sh Ideally we could somehow build one wheel and distribute it for both Conda and Pypi, but if needs be we could also build separate Conda packages as well. We just need to know how to build one... |
Oh!!! I'm sorry, I missed that. I was somehow focused on just the CPU versions. My bad.
conda-forge build scripts are basically specified entirely by a YAML file, or as a YAML file + some other scripts. The latter is what I tried doing in that PR, specifically here to get jaxlib into conda-forge. @ocefpaf, maybe you could provide some guidance to the jax team on where the docs for conda-forge recipes live? I've been doing packages for as long as conda-forge has been around, so it's kind of in my head now, but I know I've stumbled quite a few times because of the evolving infrastructure. The part where jax's distribution doesn't match my mental model of packaging is that I need to build two things (jax and jaxlib) for jax to work (i.e. jax depends on jaxlib), but jaxlib lives in the same repository as jax; usually dependencies are other packages maintained by other people, so I just have to worry about my own package at hand. In other words, I've usually seen some separation between package X and dependency of X. Though, maybe I'm not as seasoned enough as a software person and have only encountered the simple cases ^_^. |
It's not out of the question we could split |
Just to some input: Conda (more specifically anaconda) has it's own build env that it supplies so that the software can run in most places with relative ease. This includes it's own glibc allowing software built properly overtop of conda to run anywhere conda can be installed. When this environment isn't honored it can cause issues on systems anaconda otherwise works just fine on, centos 7 for example. |
@alexbw @dougalm @mattjj @hawkinsp thanks to @ocefpaf, there is a conda package for jax and jaxlib on conda-forge now! He kindly worked on packaging what is currently distributed on PyPI while at the SciPy 2019 sprints. It is currently only Python 3.7/CPU only. This is because it the recipe simply pulls down the py37 version (hard-coded). To the best of my knowledge, there’s no “elegant” way of distributing the CUDA-enabled packages using the same recipe given the current way jax and jaxlib are distributed on PyPI. If we could build jaxlib on conda-forge, that would greatly simplify the conda-based distribution story. I think @ocefpaf has more details than I do, as he knows the issues that he ran into trying to build jaxlib on conda-forge while at the sprints. |
Sorry if this is the wrong place to bring this up; I'm a fairly naive user just trying to see of some of the numpy fitting code I've written for my dissertation can be accelerated by putting in some jax in the right spots. I have found that when installing from conda the import for jax currently fails with a I'm on ubuntu 18.04, and I'm using the most recent conda: 4.7.12. I can replicate the issue by creating a new env, installing jax from the conda-forge channel, then popping open the interpreter and trying to I'm happy to make this a separate issue, but it seemed intimately related to the conversation here. Thanks for going to the trouble of trying to get this on conda. |
WSL gpu ops are 2/3 times slower than on native linux (tf2 and jax) or on windows10 (tf2) so still would be nice to have w10 support :P |
Hi, I second the previous posters' opinion that no-frills Perhaps we've been spoiled by PyTorch? How do they manage to make this so painless? It is a single conda command and no other instructions :) After trying a lot of different approaches unsuccessfully, the one that did it was @cloudhan's excellent repo with Windows wheels: https://github.com/cloudhan/jax-windows-builder You still need to get the right CUDA installed, and in my case I had to uninstall previous versions as they were still being wrongly used by JAX (ptax errors and warnings). Also it has specific jaxlib versions so I had to go through jax's previous versions' |
@jotaf98 Actually you could workaround it by manually setup the command line environment variable. Remove all cuda related paths from I have that in my powershell profile: |
Ah good point, it's very likely that the profusion of paths did not help, and removing the previous ones would've been effective. Still, a "You have the wrong CUDA version" message would have been a lot more informative than ptax errors at runtime. And going through the |
Hey there, is there a GPU-compatible conda installation for |
To echo @ma-sadeghi it would be really great if there was a cuda build available on conda, pip installing leaves my conda environment very inconsistent and it feels like I have to do surgery everytime I want to upgrade something |
Please see #10708 for deets, cuda-full builds should be ready very soon (pending more reviews) |
@ngam incredible, looking forward to testing this |
Should be already up on anaconda.org, try installing (note
|
Looks good! TLDR: |
If this is a done deal, can the installation instructions on the readme.md be updated? |
This is up to the jax team. I personally do not feel comfortable proposing a readme.md edit (it is unclear to me if the jax team want this publicized). I believe they may be wary of adopting this in their docs as they may not have the bandwidth for troubleshooting potential issues that may come up if one installs via conda. The conda-forge activities are (mostly) community-driven volunteer efforts and volunteers (like me) come and go. So while it may be more convenient to install from conda-forge, one would need to know it is not the "official" way. Potentially (I haven't tested this yet), the conda-forge build will be faster than the PyPI build --- this is the case with tensorflow for example, on both CPUs and GPUs, and so I predict it will be the case with jax; someone should run some benchmarks :) |
It might be a bit confusing to have to navigate this issue to understand how to install jax through conda. Thanks @ilemhadri for the TLDR. So if I understand correctly, Just one question. If one wants a CPU-only jax (say to install on a system that doesn't have a CUDA device), should I still use this command? |
I tried installing via (on a clean environment)
But eventually I get the following error:
Not sure if this should be a separate issue? |
@cossio if your machine doesn't have a GPU, please try The error
|
The above instructions were strictly for the GPU version because the CPU versions have long been available. Generally, you should just |
Also, if people have issues with conda/conda-forge installations or getting errors from conda-forge packages, please remember you can get better help if you open an issue elsewhere: |
The computer where I got the |
Please open an issue here https://github.com/conda-forge/jaxlib-feedstock and include the output of |
Putting this here and tagging myself @ericmjl so that I can remember this exists.
To get
jax
into the hands of data scientists and machine learning researchers,conda
installation would be very useful. I will take a stab at this on conda-forge, and record my progress here.The text was updated successfully, but these errors were encountered: