PIP install version problems on Mac OS

Viewed 730

I am trying to install several dependencies for a python project from a requirements.txt file.

When it encounters the "torch" dependency, it claims to be unable to find version 1.3.1 -- but only on my Mac and not on Ubuntu, which is puzzling. (using a different version like 1.4 is not an option for this project, unfortunately)

On my Mac:

➜  code mkdir test_proj
➜  code cd test_proj
➜  test_proj mkvirtualenv $(basename $(pwd))
created virtual environment CPython3.8.5.final.0-64 in 304ms
  creator CPython3Posix(dest=/Users/aeb/.virtualenvs/test_proj, clear=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/Users/aeb/Library/Application Support/virtualenv)
    added seed packages: pip==20.2.2, setuptools==49.6.0, wheel==0.35.1
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
virtualenvwrapper.user_scripts creating /Users/aeb/.virtualenvs/test_proj/bin/predeactivate
virtualenvwrapper.user_scripts creating /Users/aeb/.virtualenvs/test_proj/bin/postdeactivate
virtualenvwrapper.user_scripts creating /Users/aeb/.virtualenvs/test_proj/bin/preactivate
virtualenvwrapper.user_scripts creating /Users/aeb/.virtualenvs/test_proj/bin/postactivate
virtualenvwrapper.user_scripts creating /Users/aeb/.virtualenvs/test_proj/bin/get_env_details
(test_proj) ➜  test_proj which python
/Users/aeb/.virtualenvs/test_proj/bin/python
(test_proj) ➜  test_proj which pip
/Users/aeb/.virtualenvs/test_proj/bin/pip
(test_proj) ➜  test_proj pip install torch==1.3.1
ERROR: Could not find a version that satisfies the requirement torch==1.3.1 (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2, 1.4.0, 1.5.0, 1.5.1, 1.6.0)
ERROR: No matching distribution found for torch==1.3.1
(test_proj) ➜  test_proj

Interestingly, within an Ubuntu VM, there is no issue with the same pip install command:

user@devbox-vm2:~$ pip3 install torch==1.3.1
Collecting torch==1.3.1
  Using cached https://files.pythonhosted.org/packages/88/95/90e8c4c31cfc67248bf944ba42029295b77159982f532c5689bcfe4e9108/torch-1.3.1-cp36-cp36m-manylinux1_x86_64.whl

Does anyone know why the mac version of pip is having trouble finding this specific version of PyTorch, but Ubuntu is not having the same problem and completes successfully?

Perhaps more to the point, is there a way to "point" the Mac version of pip to the same package file that the Ubuntu VM is using, since that seems to be working (or an analogous modification I can make to the requirements.txt file so that it works on Mac, and not just on Ubuntu)?

Many thanks!

2 Answers

torch 1.3.1 doesn't provide wheels for Python 3.8 so your Python on Mac cannot install it. On Ubuntu you use Python 3.6 so pip on Ubuntu can install this version.

Use Python 3.6 or 3.7 on Mac.

When you look at the list of files available for that version of Torch, you can see that:

  • There is no source distribution (which would generally be a .tar.gz) version that you would be able to recompile;
  • All available binary distributions target either:
    • manylinux1 is a tag that works on many linux versions, that can be pretty old - it is not surprising that it would work on Ubuntu, with Python 2.7, 3.5, 3.6 or 3.7;
    • Mac OS 10.6 with Python 3.5, or Mac OS 10.7 with Python 2.7, 3.6, or 3.7 - these builds would probably work on later versions of Mac OS, provided the version of Python matches;

In particular, none of these distributions can run on Python 3.8, which is the version of Python shown by your console output.

Related