il controllo dei pip fallisce, l'elenco dei condomini fallisce, l'ambiente di condominio si interrompe all'improvviso


0

Un bel giorno mi sono svegliato e il mio ambiente di condominio si è rotto, il che è stato davvero strano perché il mio pip, conda, tensorflow e numpy hanno funzionato il giorno precedente.

Ho iniziato la giornata installando accidentalmente un pacchetto sbagliato: pip install telegram-bot

Collecting telegram-bot
  Using cached https://files.pythonhosted.org/packages/0c/89/b5f6cdebf62f1b37dfc0fd53fee0f92760531a51d834e5238b3110429e93/telegram-bot-0.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/fy/xjkb7k0d3q16fqp1578b63f00000gn/T/pip-build-muqgbeev/telegram-bot/setup.py", line 12, in <module>
        import telegram
      File "/private/var/folders/fy/xjkb7k0d3q16fqp1578b63f00000gn/T/pip-build-muqgbeev/telegram-bot/telegram/__init__.py", line 15, in <module>
        from telegram import Bot, ChatActions
    ImportError: cannot import name 'Bot'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/fy/xjkb7k0d3q16fqp1578b63f00000gn/T/pip-build-muqgbeev/telegram-bot/

A questo punto la lista di condomini fallì misteriosamente:

$conda list

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

    Traceback (most recent call last):
      File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 1001, in __call__
        return func(*args, **kwargs)
      File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 84, in _main
        exit_code = do_call(args, p)
      File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 82, in do_call
        exit_code = getattr(module, func_name)(args, parser)
      File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/conda/cli/main_list.py", line 142, in execute
        show_channel_urls=context.show_channel_urls)
      File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/conda/cli/main_list.py", line 80, in print_packages
        show_channel_urls=show_channel_urls)
      File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/conda/cli/main_list.py", line 45, in list_packages
        installed = sorted(PrefixData(prefix, pip_interop_enabled=True).iter_records(),
      File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/conda/core/prefix_data.py", line 116, in iter_records
        return itervalues(self._prefix_records)
      File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/conda/core/prefix_data.py", line 145, in _prefix_records
        return self.__prefix_records or self.load() or self.__prefix_records
      File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/conda/core/prefix_data.py", line 69, in load
        self._load_site_packages()
      File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/conda/core/prefix_data.py", line 258, in _load_site_packages
        python_record = read_python_record(self.prefix_path, af, python_pkg_record.version)
      File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/conda/gateways/disk/read.py", line 245, in read_python_record
        pydist = PythonDistribution.init(prefix_path, anchor_file, python_version)
      File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/conda/common/pkg_formats/python.py", line 78, in init
        return PythonInstalledDistribution(prefix_path, anchor_file, python_version)
      File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/conda/common/pkg_formats/python.py", line 382, in __init__
        super(PythonInstalledDistribution, self).__init__(anchor_full_path, python_version)
      File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/conda/common/pkg_formats/python.py", line 106, in __init__
        self._check_files()
      File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/conda/common/pkg_formats/python.py", line 116, in _check_files
        assert isfile(fpath)
    AssertionError

`$ /Users/sunyitao/anaconda3/bin/conda list`

  environment variables:
                 CIO_TEST=<not set>
               CONDA_ROOT=/Users/sunyitao/anaconda3
                     PATH=/Users/sunyitao/google-cloud-sdk/bin:/Users/sunyitao/anaconda3/bin:/us
                          r/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.d
                          otnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Comman
                          ds:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin
               PYTHONPATH=::/Users/sunyitao/slim
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : None
       user config file : /Users/sunyitao/.condarc
 populated config files : /Users/sunyitao/.condarc
          conda version : 4.6.2
    conda-build version : 3.17.7
         python version : 3.6.5.final.0
       base environment : /Users/sunyitao/anaconda3  (writable)
           channel URLs : https://conda.anaconda.org/intel/osx-64
                          https://conda.anaconda.org/intel/noarch
                          https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/osx-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/sunyitao/anaconda3/pkgs
                          /Users/sunyitao/.conda/pkgs
       envs directories : /Users/sunyitao/anaconda3/envs
                          /Users/sunyitao/.conda/envs
               platform : osx-64
             user-agent : conda/4.6.2 requests/2.20.0 CPython/3.6.5 Darwin/18.2.0 OSX/10.14.2
                UID:GID : 501:20
             netrc file : None
           offline mode : False

Così ho cercato e ho fatto pip install -U setuptools e conda update conda senza errori, ma l'installazione di telegram-bot è ancora fallita. Ma quello che volevo davvero installare era pip install python-telegram-bot che è riuscito.

Quindi l'ho eseguito per verificare se il primo pacchetto è stato completamente rimosso:

$pip uninstall telegram-bot
Cannot uninstall requirement telegram-bot, not installed

Ho riascoltato di nuovo l'elenco ma lo stesso errore.

Sono andato avanti e ho fatto un po 'di lavoro con tensorflow. Dopo un po 'installo lightgbm con conda.

Downloading and Extracting Packages
lightgbm-2.2.1       | 617 KB    | ##################################################################################################### | 100%
numpy-base-1.15.4    | 6.0 MB    | ##################################################################################################### | 100%
llvm-openmp-4.0.1    | 454 KB    | ##################################################################################################### | 100%

Ora quando corro import tensorflow as tf Ho capito:

Using TensorFlow backend.
File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/tensor_util.py", line 32, in <module>
    from tensorflow.python.framework import fast_tensor_util
  File "__init__.pxd", line 872, in init tensorflow.python.framework.fast_tensor_util
ValueError: numpy.ufunc has the wrong size, try recompiling. Expected 192, got 216

Originariamente avevo 1.16 numpy da pip e un'altra versione di numpy da anaconda. Così ho disinstallato entrambe le versioni con pip e poi l'ho fatto conda uninstall numpy --force quindi non cancellerebbe tutti i miei pacchetti che dipendevano da numpy. mi sono imbattuto conda install numpy che è riuscito.

Ma ora quando importare Numpy ottengo:

ModuleNotFoundError: No module named 'numpy'

Ha fatto un controllo di sanità mentale con:

$which pip
/Users/sunyitao/anaconda3/bin/pip
$which conda
/Users/sunyitao/anaconda3/bin/conda
$which python
/Users/sunyitao/anaconda3/bin/python

controllo pip:

$pip check
Exception:
Traceback (most recent call last):
  File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py", line 2797, in _dep_map
    return self.__dep_map
  File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py", line 2608, in __getattr__
    raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py", line 2788, in _parsed_pkg_info
    return self._pkg_info
  File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py", line 2608, in __getattr__
    raise AttributeError(attr)
AttributeError: _pkg_info

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/pip-9.0.3-py3.6.egg/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/pip-9.0.3-py3.6.egg/pip/commands/check.py", line 20, in run
    missing_reqs_dict, incompatible_reqs_dict = check_requirements(dists)
  File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/pip-9.0.3-py3.6.egg/pip/operations/check.py", line 10, in check_requirements
    missing_reqs = list(get_missing_reqs(dist, installed_dists))
  File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/pip-9.0.3-py3.6.egg/pip/operations/check.py", line 30, in get_missing_reqs
    for requirement in dist.requires():
  File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py", line 2552, in requires
    dm = self._dep_map
  File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py", line 2799, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py", line 2808, in _compute_dependencies
    for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
  File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py", line 2790, in _parsed_pkg_info
    metadata = self.get_metadata(self.PKG_INFO)
  File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py", line 1468, in get_metadata
    value = self._get(self._fn(self.egg_info, name))
  File "/Users/sunyitao/anaconda3/lib/python3.6/site-packages/pip-9.0.3-py3.6.egg/pip/_vendor/pkg_resources/__init__.py", line 1577, in _get
    with open(path, 'rb') as stream:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/sunyitao/anaconda3/lib/python3.6/site-packages/parso-0.3.1.dist-info/METADATA'
You are using pip version 9.0.3, however version 19.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Sto deliberando di reinstallare tutto ora ma è davvero l'ultima opzione che potrebbe richiedere l'intera giornata.

Modificare: Ho risolto il problema di Numpy eseguendo

conda config --add channels conda-forge
conda install numpy --force-reinstall

Ora tensorflow e numpy stanno funzionando di nuovo, ma il controllo dei pip e l'elenco dei condomini continua a fallire. Quando attivo un controllo dei pip di ambiente diverso e l'elenco dei condomini funzionerà, sembra che si tratti di un problema con il mio ambiente di base.

Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.