1

I was trying to test the pip install -e . on my library ultimate-utils after changing laptops but I keep getting errors of this type:

(uutils_env) brandomiranda~/ultimate-utils ❯ pip install -e .                      
Obtaining file:///Users/brandomiranda/ultimate-utils
  Preparing metadata (setup.py) ... done
ERROR: Could not find a version that satisfies the requirement torchvision==0.10.1 (from ultimate-utils) (from versions: 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.2.1, 0.2.2, 0.2.2.post2, 0.2.2.post3)
ERROR: No matching distribution found for torchvision==0.10.1

or

(uutils_env) brandomiranda~/ultimate-utils ❯ pip install -e .
Obtaining file:///Users/brandomiranda/ultimate-utils
  Preparing metadata (setup.py) ... done
ERROR: Could not find a version that satisfies the requirement torch==1.9.1 (from ultimate-utils) (from versions: none)
ERROR: No matching distribution found for torch==1.9.1

where it seems it stopped working to install anything related to pytorch for some reason.

I tried updating pip and conda but it did not work. I did:

pip install --upgrade pip
conda update conda
conda update conda-build
conda update -n base -c defaults conda
conda update --name base conda
conda update --all
conda install anaconda

but none seem to work.

my setup.py looks as follows:

"""
conda create -n uutils_env python=3.9
conda activate uutils_env
conda remove --all --name uutils_env
rm -rf /Users/brando/anaconda3/envs/uutils_env

pip install -e ~/ultimate-utils/ultimate-utils-proj-src/

pip install ultimate-utils

To test it:
python -c "import uutils; uutils.hello()"
python -c "import uutils; uutils.torch_uu.hello()"

python -c "import uutils; uutils.torch_uu.gpu_test_torch_any_device()"
python -c "import uutils; uutils.torch_uu.gpu_test()"

PyTorch:
    basing the torch install from the pytorch website as of this writing: https://pytorch.org/get-started/locally/
    pip3 install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html

refs:
    - setup tools: https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#using-find-or-find-packages
"""
from setuptools import setup
from setuptools import find_packages
import os

# import pathlib

here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
    long_description = f.read()

setup(
    name='ultimate-utils',  # project name
    version='0.5.3',
    description="Brando's ultimate utils for science, machine learning and AI",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url='https://github.com/brando90/ultimate-utils',
    author='Brando Miranda',
    author_email='brandojazz@gmail.com',
    python_requires='>=3.9.0',
    license='MIT',
    package_dir={'': 'ultimate-utils-proj-src'},
    packages=find_packages('ultimate-utils-proj-src'),  # imports all modules/folders with  __init__.py & python files

    # for pytorch see doc string at the top of file
    install_requires=[
        # 'torch==1.9.1',
        'torchvision==0.10.1',
        'torchaudio==0.9.1',
        'dill',
        'networkx>=2.5',
        'scipy',
        'scikit-learn',
        'lark-parser',
        'torchtext==0.10.1',
        'tensorboard',
        'pandas',
        'progressbar2',
        'transformers',
        'requests',
        'aiohttp',
        'numpy',
        'plotly',
        'wandb',
        'matplotlib',
        # 'seaborn'

        # 'pygraphviz'  # removing because it requires user to install graphviz and gives other issues
    ]
)

the dir structure is simple:

enter image description here

How do I fix this and what is not working?

I am trying to avoid having to run pip commands outside like:

conda install pytorch torchvision torchaudio -c pytorch

at least for cpu in my local laptop...if I can install gpu ones automatically with a flag it could be nice but for future work...

Btw, I prefer no requirements.txt solutions if possible, but post those too in case nothing else works.


This is for an intel mac 2013, but I will have an m1 max in 2 months, so those answers are also welcomed!


still fails:

(uutils_env) brandomiranda~/ultimate-utils ❯ pip install -e .
Obtaining file:///Users/brandomiranda/ultimate-utils
  Preparing metadata (setup.py) ... done
ERROR: Could not find a version that satisfies the requirement torch<1.10.0,>=1.4.0 (from ultimate-utils) (from versions: none)
ERROR: No matching distribution found for torch<1.10.0,>=1.4.0

Related resources I tried:

Charlie Parker
  • 5,884
  • 57
  • 198
  • 323
  • The command `conda remove --all --name uutils_env` is removing the Python from the environment. This then probably leaves `python` resolving elsewhere, possibly even system-level. That Python version probably doesn't have the PyTorch builds you specified. – merv Dec 09 '21 at 22:41
  • @merv I am puzzled. Why are you telling me this...? – Charlie Parker Dec 10 '21 at 00:06
  • It's the third line in the comment section of the `setup.py` file, which I assume is how you set up the **uutils_env**. On a Mac, then `pip` would correspond to the `/usr/bin/python`, which is Python v2.7. That would explain why compatible `torch` and `torchvision` packages can't be found. Maybe include output from `which python` in the question. – merv Dec 10 '21 at 00:51
  • @merv I set it up by doing `conda create -n uutils_env python=3.9` then `pip install -e .`. The other thing doesn't say to run it in that order, they are just random commands. It's not in the readme either. Sorry if that was confusing. – Charlie Parker Dec 10 '21 at 00:55
  • Okay, but you should also be installing `pip` when creating the environment, i.e., `conda create -n uutils_env python=3.9 pip`. Otherwise, `pip` could still be resolving outside the environment. – merv Dec 10 '21 at 00:57
  • @merv I've never had to explicitly install pip before when I am using conda. Why are you suggesting this? – Charlie Parker Dec 10 '21 at 15:45
  • It seems that the torch issues went away once I created a conda env with python3.9. Need to do some more checks but that seems to have worked...bizarre. – Charlie Parker Dec 10 '21 at 15:46

1 Answers1

0

See this Why is python using 3.8.1 and 3.9, then fail to install packages (ERROR: Package pkg requires a different Python: 3.8.1 not in '>=3.9.0')? for a more complete answer but the summary is that pytorch seems to not be working right now reliable with python 3.10 so I created an env with 3.9 and then it installed what I needed.

Charlie Parker
  • 5,884
  • 57
  • 198
  • 323