Charlie Parker
Charlie Parker

Reputation: 5201

Why is pip not letting me install torch==1.9.1+cu111 in a new conda env when I have another conda env that has exactly that version?

When I run the pip install in the new conda env:

(base) brando9~ $ pip install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html

Looking in links: https://download.pytorch.org/whl/torch_stable.html
ERROR: Could not find a version that satisfies the requirement torch==1.9.1+cu111 (from versions: 1.11.0, 1.11.0+cpu, 1.11.0+cu102, 1.11.0+cu113, 1.11.0+cu115, 1.11.0+rocm4.3.1, 1.11.0+rocm4.5.2, 1.12.0, 1.12.0+cpu, 1.12.0+cu102, 1.12.0+cu113, 1.12.0+cu116, 1.12.0+rocm5.0, 1.12.0+rocm5.1.1, 1.12.1, 1.12.1+cpu, 1.12.1+cu102, 1.12.1+cu113, 1.12.1+cu116, 1.12.1+rocm5.0, 1.12.1+rocm5.1.1, 1.13.0, 1.13.0+cpu, 1.13.0+cu116, 1.13.0+cu117, 1.13.0+cu117.with.pypi.cudnn, 1.13.0+rocm5.1.1, 1.13.0+rocm5.2, 1.13.1, 1.13.1+cpu, 1.13.1+cu116, 1.13.1+cu117, 1.13.1+cu117.with.pypi.cudnn, 1.13.1+rocm5.1.1, 1.13.1+rocm5.2)
ERROR: No matching distribution found for torch==1.9.1+cu111

the other env with that pytorch version:

(metalearning3.9) [pzy2@vision-submit ~]$ pip list
Package                            Version              Location
---------------------------------- -------------------- ------------------
absl-py                            1.0.0
aiohttp                            3.8.3
aiosignal                          1.3.1
alabaster                          0.7.12
anaconda-client                    1.9.0
anaconda-project                   0.10.1
antlr4-python3-runtime             4.8
anyio                              2.2.0
appdirs                            1.4.4
argcomplete                        2.0.0
argh                               0.26.2
argon2-cffi                        20.1.0
arrow                              0.13.1
asn1crypto                         1.4.0
astroid                            2.6.6
astropy                            4.3.1
asttokens                          2.0.7
astunparse                         1.6.3
async-generator                    1.10
async-timeout                      4.0.2
atomicwrites                       1.4.0
attrs                              21.2.0
autopep8                           1.5.7
Babel                              2.9.1
backcall                           0.2.0
backports.shutil-get-terminal-size 1.0.0
beautifulsoup4                     4.10.0
binaryornot                        0.4.4
bitarray                           2.3.0
bkcharts                           0.2
black                              19.10b0
bleach                             4.0.0
bokeh                              2.4.1
boto                               2.49.0
Bottleneck                         1.3.2
brotlipy                           0.7.0
cached-property                    1.5.2
cachetools                         5.0.0
certifi                            2021.10.8
cffi                               1.14.6
chardet                            4.0.0
charset-normalizer                 2.0.4
cherry-rl                          0.1.4
click                              8.0.3
cloudpickle                        2.0.0
clyent                             1.2.2
colorama                           0.4.4
conda                              4.12.0
conda-content-trust                0+unknown
conda-pack                         0.6.0
conda-package-handling             1.8.0
conda-token                        0.3.0
configparser                       5.3.0
contextlib2                        0.6.0.post1
cookiecutter                       1.7.2
crc32c                             2.3
crcmod                             1.7
cryptography                       3.4.8
cycler                             0.10.0
Cython                             0.29.24
cytoolz                            0.11.0
daal4py                            2021.3.0
dask                               2021.10.0
debugpy                            1.4.1
decorator                          5.1.0
defusedxml                         0.7.1
diff-match-patch                   20200713
dill                               0.3.4
distributed                        2021.10.0
docker-pycreds                     0.4.0
docutils                           0.17.1
entrypoints                        0.3
et-xmlfile                         1.1.0
executing                          0.9.1
fairseq                            0.12.2               /home/pzy2/fairseq
fastcache                          1.1.0
fastcluster                        1.2.6
fasteners                          0.17.3
filelock                           3.3.1
flake8                             3.9.2
Flask                              1.1.2
flatbuffers                        2.0.7
fonttools                          4.25.0
frozenlist                         1.3.0
fsspec                             2021.8.1
gast                               0.4.0
gcs-oauth2-boto-plugin             3.0
gevent                             21.8.0
gitdb                              4.0.9
GitPython                          3.1.27
glob2                              0.7
gmpy2                              2.0.8
google-apitools                    0.5.32
google-auth                        2.6.3
google-auth-oauthlib               0.4.6
google-pasta                       0.2.0
google-reauth                      0.1.1
gql                                0.2.0
graphql-core                       1.1
greenlet                           1.1.1
grpcio                             1.44.0
gsutil                             5.9
gym                                0.22.0
gym-notices                        0.0.6
h5py                               3.3.0
HeapDict                           1.0.1
higher                             0.2.1
html5lib                           1.1
httplib2                           0.20.4
huggingface-hub                    0.5.1
hydra-core                         1.0.7
idna                               3.2
imagecodecs                        2021.8.26
imageio                            2.9.0
imagesize                          1.2.0
importlib-metadata                 4.12.0
inflection                         0.5.1
iniconfig                          1.1.1
intervaltree                       3.1.0
ipykernel                          6.4.1
ipython                            7.29.0
ipython-genutils                   0.2.0
ipywidgets                         7.6.5
isort                              5.9.3
itsdangerous                       2.0.1
jdcal                              1.4.1
jedi                               0.18.0
jeepney                            0.7.1
Jinja2                             2.11.3
jinja2-time                        0.2.0
joblib                             1.1.0
json5                              0.9.6
jsonschema                         3.2.0
jupyter                            1.0.0
jupyter-client                     6.1.12
jupyter-console                    6.4.0
jupyter-core                       4.8.1
jupyter-server                     1.4.1
jupyterlab                         3.2.1
jupyterlab-pygments                0.1.2
jupyterlab-server                  2.8.2
jupyterlab-widgets                 1.0.0
keras                              2.10.0
Keras-Preprocessing                1.1.2
keyring                            23.1.0
kiwisolver                         1.3.1
lark-parser                        0.12.0
lazy-object-proxy                  1.6.0
learn2learn                        0.1.7
libarchive-c                       2.9
libclang                           14.0.6
littleutils                        0.2.2
llvmlite                           0.37.0
locket                             0.2.1
loguru                             0.6.0
lxml                               4.6.3
Markdown                           3.3.6
MarkupSafe                         1.1.1
matplotlib                         3.4.3
matplotlib-inline                  0.1.2
mccabe                             0.6.1
mistune                            0.8.4
mkl-fft                            1.3.1
mkl-random                         1.2.2
mkl-service                        2.4.0
mock                               4.0.3
monotonic                          1.6
more-itertools                     8.10.0
mpmath                             1.2.1
msgpack                            1.0.2
multidict                          6.0.2
multipledispatch                   0.6.0
munkres                            1.1.4
mypy-extensions                    0.4.3
nbclassic                          0.2.6
nbclient                           0.5.3
nbconvert                          6.1.0
nbformat                           5.1.3
nest-asyncio                       1.5.1
networkx                           2.6.3
nltk                               3.6.5
nose                               1.3.7
notebook                           6.4.5
numba                              0.54.1
numexpr                            2.7.3
numpy                              1.20.3
numpydoc                           1.1.0
nvidia-ml-py3                      7.352.0
nvidia-smi                         0.1.3
oauth2client                       4.1.3
oauthlib                           3.2.0
olefile                            0.46
omegaconf                          2.0.6
opencv-python                      4.6.0.66
openpyxl                           3.0.9
opt-einsum                         3.3.0
ordered-set                        4.1.0
packaging                          21.0
pandas                             1.3.4
pandocfilters                      1.4.3
parso                              0.8.2
partd                              1.2.0
path                               16.0.0
pathlib2                           2.3.6
pathspec                           0.7.0
pathtools                          0.1.2
patsy                              0.5.2
pep8                               1.7.1
pexpect                            4.8.0
pickleshare                        0.7.5
Pillow                             8.4.0
pip                                22.2.2
pkginfo                            1.7.1
plotly                             5.7.0
pluggy                             0.13.1
ply                                3.11
portalocker                        2.5.1
poyo                               0.5.0
progressbar2                       4.0.0
prometheus-client                  0.11.0
promise                            2.3
prompt-toolkit                     3.0.20
protobuf                           3.19.6
psutil                             5.8.0
ptyprocess                         0.7.0
py                                 1.10.0
pyasn1                             0.4.8
pyasn1-modules                     0.2.8
pycodestyle                        2.7.0
pycosat                            0.6.3
pycparser                          2.20
pycurl                             7.44.1
pydocstyle                         6.1.1
pyerfa                             2.0.0
pyflakes                           2.3.1
Pygments                           2.10.0
pylint                             2.9.6
pyls-spyder                        0.4.0
pyodbc                             4.0.0-unsupported
pyOpenSSL                          21.0.0
pyparsing                          3.0.4
pyrsistent                         0.18.0
PySocks                            1.7.1
pytest                             6.2.4
python-dateutil                    2.8.2
python-lsp-black                   1.0.0
python-lsp-jsonrpc                 1.0.0
python-lsp-server                  1.2.4
python-slugify                     5.0.2
python-utils                       3.1.0
pytz                               2021.3
pyu2f                              0.1.5
PyWavelets                         1.1.1
pyxdg                              0.27
PyYAML                             6.0
pyzmq                              22.2.1
QDarkStyle                         3.0.2
qpth                               0.0.15
qstylizer                          0.1.10
QtAwesome                          1.0.2
qtconsole                          5.1.1
QtPy                               1.10.0
regex                              2021.8.3
requests                           2.26.0
requests-oauthlib                  1.3.1
retry-decorator                    1.1.1
rope                               0.19.0
rsa                                4.7.2
Rtree                              0.9.7
ruamel-yaml-conda                  0.15.100
sacrebleu                          2.2.0
sacremoses                         0.0.49
scikit-image                       0.18.3
scikit-learn                       0.24.2
scikit-learn-intelex               2021.20210714.170444
scipy                              1.7.1
seaborn                            0.11.2
SecretStorage                      3.3.1
Send2Trash                         1.8.0
sentry-sdk                         1.5.9
setproctitle                       1.2.2
setuptools                         58.0.4
shortuuid                          1.0.8
simplegeneric                      0.8.1
singledispatch                     3.7.0
sip                                4.19.13
six                                1.16.0
sklearn                            0.0
smmap                              5.0.0
sniffio                            1.2.0
snowballstemmer                    2.1.0
sorcery                            0.2.2
sortedcollections                  2.1.0
sortedcontainers                   2.4.0
soupsieve                          2.2.1
Sphinx                             4.2.0
sphinxcontrib-applehelp            1.0.2
sphinxcontrib-devhelp              1.0.2
sphinxcontrib-htmlhelp             2.0.0
sphinxcontrib-jsmath               1.0.1
sphinxcontrib-qthelp               1.0.3
sphinxcontrib-serializinghtml      1.1.5
sphinxcontrib-websupport           1.2.4
spyder                             5.1.5
spyder-kernels                     2.1.3
SQLAlchemy                         1.4.22
statsmodels                        0.12.2
subprocess32                       3.5.4
sympy                              1.9
tables                             3.6.1
TBB                                0.2
tblib                              1.7.0
tensorboard                        2.10.1
tensorboard-data-server            0.6.1
tensorboard-plugin-wit             1.8.1
tensorflow-estimator               2.10.0
tensorflow-gpu                     2.10.1
tensorflow-io-gcs-filesystem       0.27.0
termcolor                          2.0.1
terminado                          0.9.4
testpath                           0.5.0
text-unidecode                     1.3
textdistance                       4.2.1
tfrecord                           1.14.1
threadpoolctl                      2.2.0
three-merge                        0.1.1
tifffile                           2021.7.2
timm                               0.6.11
tinycss                            0.4
tokenizers                         0.11.6
toml                               0.10.2
toolz                              0.11.1
torch                              1.9.1+cu111
torchaudio                         0.9.1
torchmeta                          1.8.0
torchtext                          0.10.1
torchvision                        0.10.1+cu111
tornado                            6.1
tqdm                               4.62.3
traitlets                          5.1.0
transformers                       4.18.0
typed-ast                          1.4.3
typing-extensions                  3.10.0.2
ujson                              4.0.2
ultimate-anatome                   0.1.1
ultimate-aws-cv-task2vec           0.0.1
unicodecsv                         0.14.1
Unidecode                          1.2.0
urllib3                            1.26.7
wandb                              0.13.5
watchdog                           2.1.3
wcwidth                            0.2.5
webencodings                       0.5.1
Werkzeug                           2.0.2
wheel                              0.37.0
whichcraft                         0.6.1
widgetsnbextension                 3.5.1
wrapt                              1.12.1
wurlitzer                          2.1.1
xlrd                               2.0.1
XlsxWriter                         3.0.1
xlwt                               1.3.0
yapf                               0.31.0
yarl                               1.7.2
zict                               2.0.0
zipp                               3.6.0
zope.event                         4.5.0
zope.interface                     5.4.0
WARNING: You are using pip version 22.2.2; however, version 22.3.1 is available.
You should consider upgrading via the '/home/pzy2/miniconda3/envs/metalearning3.9/bin/python -m pip install --upgrade pip' command.
(metalearning3.9) [pzy2@vision-submit ~]$

I asked a related question because I can't install pytorch with cuda with conda, see details here: why does conda install the pytorch CPU version despite me putting explicitly to download the cuda toolkit version?


I think this works:

# -- Install PyTorch sometimes requires more careful versioning due to cuda, ref: official install instruction https://pytorch.org/get-started/previous-versions/
# you need python 3.9 for torch version 1.9.1 to work, due to torchmeta==1.8.0 requirement
if ! python -V 2>&1 | grep -q 'Python 3\.9'; then
    echo "Error: Python 3.9 is required!"
    exit 1
fi

pip install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html

Upvotes: 3

Views: 13839

Answers (2)

Charlie Parker
Charlie Parker

Reputation: 5201

To install pytorch 1.9.1cu11 you need python 3.9 to be avaiable. Added that to my bash install.sh

# - create conda env
conda create -n metalearning_gpu python=3.9
conda activate metalearning_gpu
## conda remove --name metalearning_gpu --all

# - make sure pip is up to date
which python
pip install --upgrade pip
pip3 install --upgrade pip
which pip
which pip3

# -- Install PyTorch sometimes requires more careful versioning due to cuda, ref: official install instruction https://pytorch.org/get-started/previous-versions/
# you need python 3.9 for torch version 1.9.1 to work, due to torchmeta==1.8.0 requirement
if ! python -V 2>&1 | grep -q 'Python 3\.9'; then
    echo "Error: Python 3.9 is required!"
    exit 1
fi

pip install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html

Upvotes: 1

Kraigolas
Kraigolas

Reputation: 5560

From looking at the link you've provided, I can see

cu111/torch-1.9.1%2Bcu111-cp36-cp36m-linux_x86_64.whl
cu111/torch-1.9.1%2Bcu111-cp36-cp36m-win_amd64.whl
cu111/torch-1.9.1%2Bcu111-cp37-cp37m-linux_x86_64.whl
cu111/torch-1.9.1%2Bcu111-cp37-cp37m-win_amd64.whl
cu111/torch-1.9.1%2Bcu111-cp38-cp38-linux_x86_64.whl
cu111/torch-1.9.1%2Bcu111-cp38-cp38-win_amd64.whl
cu111/torch-1.9.1%2Bcu111-cp39-cp39-linux_x86_64.whl
cu111/torch-1.9.1%2Bcu111-cp39-cp39-win_amd64.whl

cp39 means Python version 3.9. Notice there is no support for 3.10 or 3.11. In your new environment, you probably are running a newer version of Python, whereas in the other environment you have Python 3.6, 3.7, 3.8, or 3.9

Upvotes: 3

Related Questions