2.6 KiB
author | date | medium_post | post_meta | preview | tags | title | type | url | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
James | 2020-02-02 14:40:46+00:00 |
|
|
/social/d506c6c8eb546ab46694543d588932d975f353cfc8d273b35f4168eb955ca764.png |
|
PyTorch 1.X.X and Pipenv and Specific versions of CUDA | posts | /2020/02/02/pytorch-1-x-x-and-pipenv-and-specific-versions-of-cuda/ |
I recently ran into an issue where the newest version of Torch (as of writing 1.4.0) requires a newer version of CUDA/Nvidia Drivers than I have installed.
Last time I tried to upgrade my CUDA version it took me several hours/days so I didn’t really want to have to spend lots of time on that.
As it happens PyTorch has an archive of compiled python whl objects for different combinations of Python version (3.5, 3.6, 3.7, 3.8 – heck even 2.X which is no longer officially supported), CUDA Version (9.2, 10.0, 10.1) and Torch version (from 0.1 to 1.4). You can specify which you want to install if you know the right incantation. The full index is available here
If you’re using pip and virtualenvs to manage your python environment you can just run:
pip install torch==1.4.0+cu100 -f https://download.pytorch.org/whl/torch_stable.html
This will install torch 1.4.0 with cuda 10.0 support and it’ll work out which version of Python you’re running for you.
Now if you’re using Pipenv which tries to simplify virtualenv management and package versioning, you’ll quickly see that there is no way to run the above with pipenv install
. Currently the only solution I can find is to manually run the above command prefixed with pipenv run
So far I’ve only found one other person who’s asked about this particular issue on stackoverflow. I’ve also opened a github ticket in the pipenv project. I am curious to know if anyone else has run into this issue or has a solution