brainsteam.co.uk/brainsteam/content/posts/legacy/2020-02-02-pytorch-1-x-x-an...

2.6 KiB
Raw Blame History

author date medium_post post_meta preview tags title type url
James 2020-02-02 14:40:46+00:00
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";}
date
/social/d506c6c8eb546ab46694543d588932d975f353cfc8d273b35f4168eb955ca764.png
developer
projects
python
work
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 didnt 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 youre 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 itll work out which version of Python youre running for you.

Now if youre using Pipenv which tries to simplify virtualenv management and package versioning, youll 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 Ive only found one other person whos asked about this particular issue on stackoverflow. Ive 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