37 lines
2.6 KiB
Markdown
37 lines
2.6 KiB
Markdown
---
|
|
author: James
|
|
date: 2020-02-02 14:40:46+00:00
|
|
medium_post:
|
|
- O:11:"Medium_Post":11:{s:16:"author_image_url";s:69:"https://cdn-images-1.medium.com/fit/c/200/200/0*naYvMn9xdbL5qlkJ.jpeg";s:10:"author_url";s:30:"https://medium.com/@jamesravey";s:11:"byline_name";N;s:12:"byline_email";N;s:10:"cross_link";s:2:"no";s:2:"id";s:12:"8e038847a808";s:21:"follower_notification";s:3:"yes";s:7:"license";s:19:"all-rights-reserved";s:14:"publication_id";s:2:"-1";s:6:"status";s:6:"public";s:3:"url";s:98:"https://medium.com/@jamesravey/pytorch-1-x-x-and-pipenv-and-specific-versions-of-cuda-8e038847a808";}
|
|
post_meta:
|
|
- date
|
|
preview: /social/d506c6c8eb546ab46694543d588932d975f353cfc8d273b35f4168eb955ca764.png
|
|
tags:
|
|
- developer
|
|
- projects
|
|
- python
|
|
- work
|
|
title: PyTorch 1.X.X and Pipenv and Specific versions of CUDA
|
|
type: posts
|
|
url: /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][1]
|
|
|
|
If you’re using pip and virtualenvs to manage your python environment you can just run:
|
|
|
|
<pre class="wp-block-preformatted" lang="shell">pip install torch==1.4.0+cu100 -f https://download.pytorch.org/whl/torch_stable.html </pre>
|
|
|
|
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][2]. I’ve also [opened a github ticket][3] in the pipenv project. I am curious to know if anyone else has run into this issue or has a solution
|
|
|
|
[1]: https://download.pytorch.org/whl/torch_stable.html
|
|
[2]: https://stackoverflow.com/questions/59752559/how-to-specify-pytorch-cuda-version-in-pipenv
|
|
[3]: https://github.com/pypa/pipenv/issues/4121 |