[Contre-mesures d'erreur] Gestion des erreurs d'installation de django-heroku

1. Origines

https://qiita.com/norifumi92/items/a4b3dc4b3a1d474317c8 Lorsque j'ai essayé d'implémenter les fonctions de téléchargement et de téléchargement de fichiers CSV basées sur Je suis tombé sur l'installation de django-heroku, j'ai donc créé cette page en guise de rappel.

2. Environnement d'exécution

environnement

mac OS Catalina 10.15.4

3. Message d'erreur

(open3d) csv_uploader $ pip install django-heroku
Collecting django-heroku
  Using cached django_heroku-0.3.1-py2.py3-none-any.whl (6.2 kB)
Requirement already satisfied: dj-database-url>=0.5.0 in /Users/[User]/anaconda3/envs/open3d/lib/python3.7/site-packages (from django-heroku) (0.5.0)
Collecting psycopg2
  Using cached psycopg2-2.8.5.tar.gz (380 kB)
Requirement already satisfied: whitenoise in /Users/[User]/anaconda3/envs/open3d/lib/python3.7/site-packages (from django-heroku) (5.0.1)
Requirement already satisfied: django in /Users/[User]/anaconda3/envs/open3d/lib/python3.7/site-packages (from django-heroku) (3.0.3)
Requirement already satisfied: asgiref~=3.2 in /Users/[User]/anaconda3/envs/open3d/lib/python3.7/site-packages (from django->django-heroku) (3.2.3)
Requirement already satisfied: pytz in /Users/[User]/anaconda3/envs/open3d/lib/python3.7/site-packages (from django->django-heroku) (2019.3)
Requirement already satisfied: sqlparse>=0.2.2 in /Users/[User]/anaconda3/envs/open3d/lib/python3.7/site-packages (from django->django-heroku) (0.3.0)
Building wheels for collected packages: psycopg2
  Building wheel for psycopg2 (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/[User]/anaconda3/envs/open3d/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/9k/8_b7gs7x28jgq7yrkcwd0jsr0000gn/T/pip-install-qe181bpf/psycopg2/setup.py'"'"'; __file__='"'"'/private/var/folders/9k/8_b7gs7x28jgq7yrkcwd0jsr0000gn/T/pip-install-qe181bpf/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/9k/8_b7gs7x28jgq7yrkcwd0jsr0000gn/T/pip-wheel-6om_gi_o
       cwd: /private/var/folders/9k/8_b7gs7x28jgq7yrkcwd0jsr0000gn/T/pip-install-qe181bpf/psycopg2/
  Complete output (36 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.9-x86_64-3.7
  creating build/lib.macosx-10.9-x86_64-3.7/psycopg2
  copying lib/_json.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
  copying lib/extras.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
  copying lib/compat.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
  copying lib/errorcodes.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
  copying lib/tz.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
  copying lib/_range.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
  copying lib/_ipaddress.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
  copying lib/_lru_cache.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
  copying lib/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
  copying lib/extensions.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
  copying lib/errors.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
  copying lib/sql.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
  copying lib/pool.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
  running build_ext
  building 'psycopg2._psycopg' extension
  creating build/temp.macosx-10.9-x86_64-3.7
  creating build/temp.macosx-10.9-x86_64-3.7/psycopg
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/[User]/anaconda3/envs/open3d/include -arch x86_64 -I/Users/[User]/anaconda3/envs/open3d/include -arch x86_64 -DPSYCOPG_VERSION=2.8.5 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=120002 -DHAVE_LO64=1 -I/Users/[User]/anaconda3/envs/open3d/include/python3.7m -I. -I/usr/local/include -I/usr/local/include/postgresql/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.9-x86_64-3.7/psycopg/psycopgmodule.o
  xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
  
  It appears you are missing some prerequisite to build the package from source.
  
  You may install a binary package by installing 'psycopg2-binary' from PyPI.
  If you want to install psycopg2 from source, please install the packages
  required for the build and try again.
  
  For further information please check the 'doc/src/install.rst' file (also at
  <https://www.psycopg.org/docs/install.html>).
  
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for psycopg2
  Running setup.py clean for psycopg2
Failed to build psycopg2
Installing collected packages: psycopg2, django-heroku
    Running setup.py install for psycopg2 ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/[User]/anaconda3/envs/open3d/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/9k/8_b7gs7x28jgq7yrkcwd0jsr0000gn/T/pip-install-qe181bpf/psycopg2/setup.py'"'"'; __file__='"'"'/private/var/folders/9k/8_b7gs7x28jgq7yrkcwd0jsr0000gn/T/pip-install-qe181bpf/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/9k/8_b7gs7x28jgq7yrkcwd0jsr0000gn/T/pip-record-9ul34ulc/install-record.txt --single-version-externally-managed --compile --install-headers /Users/[User]/anaconda3/envs/open3d/include/python3.7m/psycopg2
         cwd: /private/var/folders/9k/8_b7gs7x28jgq7yrkcwd0jsr0000gn/T/pip-install-qe181bpf/psycopg2/
    Complete output (36 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.9-x86_64-3.7
    creating build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/_json.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/extras.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/compat.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/errorcodes.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/tz.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/_range.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/_ipaddress.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/_lru_cache.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/__init__.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/extensions.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/errors.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/sql.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    copying lib/pool.py -> build/lib.macosx-10.9-x86_64-3.7/psycopg2
    running build_ext
    building 'psycopg2._psycopg' extension
    creating build/temp.macosx-10.9-x86_64-3.7
    creating build/temp.macosx-10.9-x86_64-3.7/psycopg
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/[User]/anaconda3/envs/open3d/include -arch x86_64 -I/Users/[User]/anaconda3/envs/open3d/include -arch x86_64 -DPSYCOPG_VERSION=2.8.5 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=120002 -DHAVE_LO64=1 -I/Users/[User]/anaconda3/envs/open3d/include/python3.7m -I. -I/usr/local/include -I/usr/local/include/postgresql/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.9-x86_64-3.7/psycopg/psycopgmodule.o
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
    
    It appears you are missing some prerequisite to build the package from source.
    
    You may install a binary package by installing 'psycopg2-binary' from PyPI.
    If you want to install psycopg2 from source, please install the packages
    required for the build and try again.
    
    For further information please check the 'doc/src/install.rst' file (also at
    <https://www.psycopg.org/docs/install.html>).
    
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/[User]/anaconda3/envs/open3d/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/9k/8_b7gs7x28jgq7yrkcwd0jsr0000gn/T/pip-install-qe181bpf/psycopg2/setup.py'"'"'; __file__='"'"'/private/var/folders/9k/8_b7gs7x28jgq7yrkcwd0jsr0000gn/T/pip-install-qe181bpf/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/9k/8_b7gs7x28jgq7yrkcwd0jsr0000gn/T/pip-record-9ul34ulc/install-record.txt --single-version-externally-managed --compile --install-headers /Users/[User]/anaconda3/envs/open3d/include/python3.7m/psycopg2 Check the logs for full command output.

4. Contre-mesures

J'ai entré la commande suivante.

(open3d) csv_uploader $ xcode-select --install
xcode-select: note: install requested for command line developer tools

(Référence) https://qiita.com/nishina555/items/e23d73067a5cac182a63

5. Conclusion

Il y avait beaucoup d'informations sur le net sur l'installation de psycopg2-binary et l'erreur d'installation de postgresql, mais cela n'a pas conduit à une solution. Mais hors du message d'erreur

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

J'ai prêté attention et pris des mesures pour résoudre le problème. Il est important de lire attentivement le message d'erreur et de le traiter un par un. Si vous vous concentrez trop sur l'erreur de la première ligne, vous ne verrez pas la forêt en regardant les arbres.

Recommended Posts

[Contre-mesures d'erreur] Gestion des erreurs d'installation de django-heroku
Gestion des erreurs de trame principale
Erreur d'installation de Jupyter
Erreur d'installation de centOS 7
Gestion des erreurs Python
Gestion des erreurs SikuliX
django.db.migrations.exceptions.InconsistentMigrationHistory Gestion des erreurs
[AWS] Résumé des contre-mesures d'erreur d'installation de l'interface de ligne de commande
À propos de la gestion des erreurs Tweepy
Gestion des erreurs dans PythonBox
Gestion des erreurs GraphQL (gqlgen)
Autour de la gestion des erreurs de feedparser
Réponse aux erreurs lors de l'installation de mecab-python
À propos de FastAPI ~ Gestion des erreurs de point de terminaison ~
Type de dictionnaire Contre-mesures d'erreur clé
Mémorandum de gestion des erreurs de construction PyCUDA
Erreur divisée par 0 Gestion de ZeroDivisionError
Gestion des erreurs lors de la mise à jour de Fish shell