安装Pytorch几何图形时出现问题

wmtdaxz3  于 2023-03-18  发布在  其他
关注(0)|答案(1)|浏览(148)

我使用的是Arch Linux,我尝试通过conda安装Pytorch geometric,安装过程失败。
我按照说明操作,并设法在先前使用以下命令创建的单独Python环境中安装了Pytorch

conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia

看起来一切都很好。我试着在一个测试Python脚本中导入Torch库,效果很好。
当我尝试安装PyTorch几何图形时

conda install pyg -c pyg

我遇到了以下问题:

conda install pyg -c pyg                                                            

Collecting package metadata (current_repodata.json): failed

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/usr/lib/python3.10/site-packages/conda/gateways/repodata/__init__.py", line 132, in conda_http_errors
        yield
      File "/usr/lib/python3.10/site-packages/conda/gateways/repodata/__init__.py", line 101, in repodata
        response.raise_for_status()
      File "/usr/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status
        raise HTTPError(http_error_msg, response=self)
    requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://conda.anaconda.org/pyg/linux-64/current_repodata.json
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/usr/lib/python3.10/site-packages/requests/models.py", line 971, in json
        return complexjson.loads(self.text, **kwargs)
      File "/usr/lib/python3.10/site-packages/simplejson/__init__.py", line 525, in loads
        return _default_decoder.decode(s)
      File "/usr/lib/python3.10/site-packages/simplejson/decoder.py", line 372, in decode
        obj, end = self.raw_decode(s)
      File "/usr/lib/python3.10/site-packages/simplejson/decoder.py", line 402, in raw_decode
        return self.scan_once(s, idx=_w(s, idx).end())
    simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/usr/lib/python3.10/site-packages/conda/exceptions.py", line 1124, in __call__
        return func(*args, **kwargs)
      File "/usr/lib/python3.10/site-packages/conda/cli/main.py", line 69, in main_subshell
        exit_code = do_call(args, p)
      File "/usr/lib/python3.10/site-packages/conda/cli/conda_argparse.py", line 91, in do_call
        return getattr(module, func_name)(args, parser)
      File "/usr/lib/python3.10/site-packages/conda/notices/core.py", line 109, in wrapper
        return func(*args, **kwargs)
      File "/usr/lib/python3.10/site-packages/conda/cli/main_install.py", line 20, in execute
        install(args, parser, 'install')
      File "/usr/lib/python3.10/site-packages/conda/cli/install.py", line 264, in install
        unlink_link_transaction = solver.solve_for_transaction(
      File "/usr/lib/python3.10/site-packages/conda/core/solve.py", line 132, in solve_for_transaction
        unlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier,
      File "/usr/lib/python3.10/site-packages/conda/core/solve.py", line 175, in solve_for_diff
        final_precs = self.solve_final_state(update_modifier, deps_modifier, prune, ignore_pinned,
      File "/usr/lib/python3.10/site-packages/conda/core/solve.py", line 280, in solve_final_state
        ssc = self._collect_all_metadata(ssc)
      File "/usr/lib/python3.10/site-packages/conda/common/io.py", line 84, in decorated
        return f(*args, **kwds)
      File "/usr/lib/python3.10/site-packages/conda/core/solve.py", line 447, in _collect_all_metadata
        index, r = self._prepare(prepared_specs)
      File "/usr/lib/python3.10/site-packages/conda/core/solve.py", line 1060, in _prepare
        reduced_index = get_reduced_index(self.prefix, self.channels,
      File "/usr/lib/python3.10/site-packages/conda/core/index.py", line 267, in get_reduced_index
        new_records = SubdirData.query_all(spec, channels=channels, subdirs=subdirs,
      File "/usr/lib/python3.10/site-packages/conda/core/subdir_data.py", line 124, in query_all
        result = tuple(chain.from_iterable(executor.map(subdir_query, channel_urls)))
      File "/usr/lib/python3.10/concurrent/futures/_base.py", line 621, in result_iterator
        yield _result_or_cancel(fs.pop())
      File "/usr/lib/python3.10/concurrent/futures/_base.py", line 319, in _result_or_cancel
        return fut.result(timeout)
      File "/usr/lib/python3.10/concurrent/futures/_base.py", line 458, in result
        return self.__get_result()
      File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
        raise self._exception
      File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
        result = self.fn(*self.args, **self.kwargs)
      File "/usr/lib/python3.10/site-packages/conda/core/subdir_data.py", line 113, in <lambda>
        subdir_query = lambda url: tuple(
      File "/usr/lib/python3.10/site-packages/conda/core/subdir_data.py", line 129, in query
        self.load()
      File "/usr/lib/python3.10/site-packages/conda/core/subdir_data.py", line 215, in load
        _internal_state = self._load()
      File "/usr/lib/python3.10/site-packages/conda/core/subdir_data.py", line 323, in _load
        raw_repodata_str = self._repo.repodata(mod_etag_headers)
      File "/usr/lib/python3.10/site-packages/conda/gateways/repodata/__init__.py", line 94, in repodata
        with conda_http_errors(self._url, filename):
      File "/usr/lib/python3.10/contextlib.py", line 153, in __exit__
        self.gen.throw(typ, value, traceback)
      File "/usr/lib/python3.10/site-packages/conda/gateways/repodata/__init__.py", line 179, in conda_http_errors
        raise RepodataIsEmpty(
      File "/usr/lib/python3.10/site-packages/conda/exceptions.py", line 461, in __init__
        body = response.json()
      File "/usr/lib/python3.10/site-packages/requests/models.py", line 975, in json
        raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
    requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

`$ /usr/bin/conda install pyg -c pyg`

  environment variables:
                 CIO_TEST=<not set>
        CONDA_DEFAULT_ENV=myenv
                CONDA_EXE=/usr/bin/conda
             CONDA_PREFIX=/home/massimo/.conda/envs/myenv
    CONDA_PROMPT_MODIFIER=(myenv)
         CONDA_PYTHON_EXE=/usr/bin/python
               CONDA_ROOT=/usr
              CONDA_SHLVL=1
                CUDA_PATH=/opt/cuda
           CURL_CA_BUNDLE=<not set>
               LD_PRELOAD=<not set>
                     PATH=/home/massimo/.conda/envs/myenv/bin:/usr/condabin:/usr/local/bin:/usr/
                          bin:/usr/local/sbin:/opt/android-sdk/platform-tools:/opt/cuda/bin:/opt
                          /cuda/nsight_compute:/opt/cuda/nsight_systems/bin:/usr/bin/site_perl:/
                          usr/bin/vendor_perl:/usr/bin/core_perl
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : myenv
    active env location : /home/massimo/.conda/envs/myenv
            shell level : 1
       user config file : /home/massimo/.condarc
 populated config files : /etc/conda/condarc
                          /home/massimo/.condarc
          conda version : 23.1.0
    conda-build version : not installed
         python version : 3.10.9.final.0
       virtual packages : __archspec=1=x86_64
                          __cuda=12.0=0
                          __glibc=2.37=0
                          __linux=6.2.5=0
                          __unix=0=0
       base environment : /usr  (read only)
      conda av data dir : /usr/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/pyg/linux-64
                          https://conda.anaconda.org/pyg/noarch
                          https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/massimo/.conda/pkgs
       envs directories : /home/massimo/.conda/envs
                          /usr/envs
               platform : linux-64
             user-agent : conda/23.1.0 requests/2.28.2 CPython/3.10.9 Linux/6.2.5-arch1-1 arch/rolling glibc/2.37
                UID:GID : 1000:985
             netrc file : None
           offline mode : False

An unexpected error has occurred. Conda has prepared the above report.

If submitted, this report will be used by core maintainers to improve
future releases of conda.

我不明白是什么问题,也许我的系统安装了cuda12.1,应该降级到11.7,但这不是虚拟环境应该解决的问题吗?

nhhxz33t

nhhxz33t1#

多于评论,少于回答:
对您的问题的简短回答是否定的,python虚拟环境管理python包及其依赖项,但通常不能有效地管理较低级别(系统级和操作系统级)软件包。因此,如果您的软件包与这些较低级别的软件包(如CUDA)紧密连接,您需要分别管理这些包。(试着安装带有python绑定、启用CUDA和FFMPEG的OpenCV,一周后的头痛你就会明白我的意思。)Docker和其他容器-基于的系统解决了一些操作系统包级别的问题,但Nvidia Docker仍然需要您在Docker外部安装CUDA。
所以,总的来说,没有。抛开这些不谈,this video在处理pytorch几何的麻烦安装时对我很有帮助,如果你最终需要多个版本的CUDA来完成这项工作,这是有先例的,这个问题是here解决的。

相关问题