I'm trying to use the pipenv and pytorch.
To install pytorch in windows, I have to write following codes into the Pipfile:
[packages]
torch = {file = "http://download.pytorch.org/whl/cpu/torch-0.4.1-cp37-cp37m-win_amd64.whl"}
However, the wheel file is different for the linux.
[packages]
torch = {file = "http://download.pytorch.org/whl/cpu/torch-0.4.1.post2-cp37-cp37m-linux_x86_64.whl "}
How to specify both of them in Pipfile?
This article demonstrates how to structure your
Pipfile
to usepytorch
across multiple platforms. I tweaked their example to deal withwhl
files on my local file system:In this case,
pyfoo
is an internal libarary that has been built usingpython setup.py build
andpython setup.py bdist_wheel
.The article uses some kind of
pipenv
generated hash in place ofpyfoo-win
. I could not coercepipenv
into generating that hash, so I created my own string. It may just be the prefix of the hash in the lock file.Note: This approach is working for me, but there is a downer: both
whl
files need to be present when you install packages.pipenv sync
bombs out if one of them is missing, even though it really only needs one of the two. Interestingly, the contents of the irrelevant file does not seem to matter. On my linux machine, I did anecho 'hello' >
to the windows whl file, andpipenv
was happy with it.