首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何从PyTorch列表中安装setup.py和相关工具?

如何从PyTorch列表中安装setup.py和相关工具?
EN

Stack Overflow用户
提问于 2021-12-09 19:50:04
回答 1查看 564关注 0票数 1

在更换笔记本电脑后,我试图在pip install -e .上测试我的图书馆终极用途,但我一直收到这种类型的错误:

代码语言:javascript
复制
(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

代码语言:javascript
复制
(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

似乎是因为某种原因而停止安装任何与火把有关的设备。

我试着更新pip和conda,但没有成功。我做了:

代码语言:javascript
复制
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

但似乎都不起作用。

我的setup.py看起来如下:

代码语言:javascript
复制
"""
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
    ]
)

dir结构很简单:

我该如何解决这个问题,哪些不起作用?

我试图避免在外面运行pip命令,例如:

代码语言:javascript
复制
conda install pytorch torchvision torchaudio -c pytorch

至少对于我的本地笔记本电脑...if中的cpu来说,我可以用一个标志自动安装gpu,这可能是很好的,但是对于以后的工作.

顺便说一句,如果可能的话,我不喜欢任何requirements.txt解决方案,但是如果没有其他的解决方案,我也会发布这些解决方案。

这是一个英特尔mac 2013年,但我将有一个最大的m1在2个月,所以这些答案也是欢迎的!

仍然失败:

代码语言:javascript
复制
(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

我尝试过的相关资源:

EN

回答 1

Stack Overflow用户

发布于 2021-12-10 17:51:52

请参阅这个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')?,以获得更完整的答案,但总结是,py手电筒现在似乎无法使用python3.10,所以我用3.9创建了一个env,然后安装了我所需要的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70295885

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档