Azure / azure-cli

Azure Command-Line Interface
MIT License
4.01k stars 2.98k forks source link

[db-up] installation issues on Mac OS X #12854

Closed jdubois closed 4 years ago

jdubois commented 4 years ago

When installing db-up (az extension add --name db-up) I have installation errors.

First error: Error: pg_config executable not found.

First error is Error: pg_config executable not found.. This is fixed by installing PostgreSQL:

brew install postgresql

Second error: ERROR: Failed building wheel for psycopg2-binary

Second error is ERROR: Failed building wheel for psycopg2-binary, here is the complete log:

  Building wheel for Cython (setup.py): finished with status 'done'
  Created wheel for Cython: filename=Cython-0.29.6-cp38-cp38-macosx_10_15_x86_64.whl size=1977318 sha256=80944c6e98572415a33e5b7056363e92fd63b90312b7b268ce7313097b36975e
  Stored in directory: /private/var/folders/xz/c48y439156s9fl21dnzk_4c80000gn/T/pip-ephem-wheel-cache-za5wkx91/wheels/5b/b1/1d/d4b66f8ad6359cd37e29123becf3057e00c25cf07f97eff8c0
Successfully built Cython
Failed to build psycopg2-binary
ERROR: azure-cli-core 2.2.0 has requirement wheel==0.30.0, but you'll have wheel 0.34.2 which is incompatible.
Installing collected packages: psycopg2-binary, setuptools, six, protobuf, mysql-connector-python, Cython, db-up
  Created temporary directory: /private/var/folders/xz/c48y439156s9fl21dnzk_4c80000gn/T/pip-record-zm51ao6_
    Running setup.py install for psycopg2-binary: started
    Running command /usr/local/Cellar/azure-cli/2.2.0_1/libexec/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/xz/c48y439156s9fl21dnzk_4c80000gn/T/pip-install-sceqc68r/psycopg2-binary/setup.py'"'"'; __file__='"'"'/private/var/folders/xz/c48y439156s9fl21dnzk_4c80000gn/T/pip-install-sceqc68r/psycopg2-binary/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/xz/c48y439156s9fl21dnzk_4c80000gn/T/pip-record-zm51ao6_/install-record.txt --single-version-externally-managed --home /private/var/folders/xz/c48y439156s9fl21dnzk_4c80000gn/T/pip-target-q8fqw22i --compile --install-headers /usr/local/Cellar/azure-cli/2.2.0_1/libexec/bin/../include/site/python3.8/psycopg2-binary
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.15-x86_64-3.8
    creating build/lib.macosx-10.15-x86_64-3.8/psycopg2
    copying lib/_json.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2
    copying lib/extras.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2
    copying lib/errorcodes.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2
    copying lib/tz.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2
    copying lib/_range.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2
    copying lib/_ipaddress.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2
    copying lib/__init__.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2
    copying lib/psycopg1.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2
    copying lib/extensions.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2
    copying lib/sql.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2
    copying lib/pool.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2
    creating build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_transaction.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/dbapi20.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_extras_dictcursor.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_with.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_types_basic.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_bug_gc.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_module.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_psycopg2_dbapi20.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_async.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_dates.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_async_keyword.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/testutils.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_connection.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_copy.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_bugX000.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/__init__.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_cursor.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_types_extras.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_sql.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_fast_executemany.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_green.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_ipaddress.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_cancel.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_quote.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/testconfig.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_errcodes.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_replication.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_lobject.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/test_notify.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    copying tests/dbapi20_tpc.py -> build/lib.macosx-10.15-x86_64-3.8/psycopg2/tests
    Skipping optional fixer: buffer
    Skipping optional fixer: idioms
    Skipping optional fixer: set_literal
    Skipping optional fixer: ws_comma
    running build_ext
    building 'psycopg2._psycopg' extension
    creating build/temp.macosx-10.15-x86_64-3.8
    creating build/temp.macosx-10.15-x86_64-3.8/psycopg
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION=2.7.7 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=120002 -DHAVE_LO64=1 -I/usr/local/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/include/python3.8 -I. -I/usr/local/include -I/usr/local/include/postgresql/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.15-x86_64-3.8/psycopg/psycopgmodule.o
    psycopg/psycopgmodule.c:689:18: error: incomplete definition of type 'struct _is'
        while (interp->next)
               ~~~~~~^
    /usr/local/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/include/python3.8/pystate.h:20:8: note: forward declaration of 'struct _is'
    struct _is;
           ^
    psycopg/psycopgmodule.c:690:24: error: incomplete definition of type 'struct _is'
            interp = interp->next;
                     ~~~~~~^
    /usr/local/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/include/python3.8/pystate.h:20:8: note: forward declaration of 'struct _is'
    struct _is;
           ^
    2 errors generated.

    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
    <http://initd.org/psycopg/docs/install.html>).

    error: command 'clang' failed with exit status 1
    Running setup.py install for psycopg2-binary: finished with status 'error'
Cleaning up...
  Removing source in /private/var/folders/xz/c48y439156s9fl21dnzk_4c80000gn/T/pip-install-sceqc68r/psycopg2-binary
  Removing source in /private/var/folders/xz/c48y439156s9fl21dnzk_4c80000gn/T/pip-install-sceqc68r/Cython
Removed build tracker: '/private/var/folders/xz/c48y439156s9fl21dnzk_4c80000gn/T/pip-req-tracker-_ap2ajpz'
ERROR: Command errored out with exit status 1: /usr/local/Cellar/azure-cli/2.2.0_1/libexec/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/xz/c48y439156s9fl21dnzk_4c80000gn/T/pip-install-sceqc68r/psycopg2-binary/setup.py'"'"'; __file__='"'"'/private/var/folders/xz/c48y439156s9fl21dnzk_4c80000gn/T/pip-install-sceqc68r/psycopg2-binary/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/xz/c48y439156s9fl21dnzk_4c80000gn/T/pip-record-zm51ao6_/install-record.txt --single-version-externally-managed --home /private/var/folders/xz/c48y439156s9fl21dnzk_4c80000gn/T/pip-target-q8fqw22i --compile --install-headers /usr/local/Cellar/azure-cli/2.2.0_1/libexec/bin/../include/site/python3.8/psycopg2-binary Check the logs for full command output.
Exception information:
Traceback (most recent call last):
  File "/usr/local/Cellar/azure-cli/2.2.0_1/libexec/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 186, in _main
    status = self.run(options, args)
  File "/usr/local/Cellar/azure-cli/2.2.0_1/libexec/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 395, in run
    installed = install_given_reqs(
  File "/usr/local/Cellar/azure-cli/2.2.0_1/libexec/lib/python3.8/site-packages/pip/_internal/req/__init__.py", line 67, in install_given_reqs
    requirement.install(
  File "/usr/local/Cellar/azure-cli/2.2.0_1/libexec/lib/python3.8/site-packages/pip/_internal/req/req_install.py", line 820, in install
    install_legacy(
  File "/usr/local/Cellar/azure-cli/2.2.0_1/libexec/lib/python3.8/site-packages/pip/_internal/operations/install/legacy.py", line 70, in install
    runner(
  File "/usr/local/Cellar/azure-cli/2.2.0_1/libexec/lib/python3.8/site-packages/pip/_internal/utils/subprocess.py", line 271, in runner
    call_subprocess(
  File "/usr/local/Cellar/azure-cli/2.2.0_1/libexec/lib/python3.8/site-packages/pip/_internal/utils/subprocess.py", line 242, in call_subprocess
    raise InstallationError(exc_msg)
pip._internal.exceptions.InstallationError: Command errored out with exit status 1: /usr/local/Cellar/azure-cli/2.2.0_1/libexec/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/xz/c48y439156s9fl21dnzk_4c80000gn/T/pip-install-sceqc68r/psycopg2-binary/setup.py'"'"'; __file__='"'"'/private/var/folders/xz/c48y439156s9fl21dnzk_4c80000gn/T/pip-install-sceqc68r/psycopg2-binary/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/xz/c48y439156s9fl21dnzk_4c80000gn/T/pip-record-zm51ao6_/install-record.txt --single-version-externally-managed --home /private/var/folders/xz/c48y439156s9fl21dnzk_4c80000gn/T/pip-target-q8fqw22i --compile --install-headers /usr/local/Cellar/azure-cli/2.2.0_1/libexec/bin/../include/site/python3.8/psycopg2-binary Check the logs for full command output.

Command '['/usr/local/Cellar/azure-cli/2.2.0_1/libexec/bin/python', '-m', 'pip', 'install', '--target', '/Users/julien/.azure/cliextensions/db-up', '/var/folders/xz/c48y439156s9fl21dnzk_4c80000gn/T/tmpq83ud0nz/db_up-0.1.13-py2.py3-none-any.whl', '-vv', '--disable-pip-version-check', '--no-cache-dir']' returned non-zero exit status 1.
Homebrew patch: Deleting the temporarily created /Users/julien/.pydistutils.cfg
Pip failed so deleting anything we might have installed at /Users/julien/.azure/cliextensions/db-up
cli.azure.cli.core.util : An error occurred. Pip failed with status code 1. Use --debug for more information.
An error occurred. Pip failed with status code 1. Use --debug for more information.
az_command_data_logger : exit code: 1
telemetry.save : Save telemetry record of length 2530 in cache
telemetry.check : Returns Positive.
telemetry.main : Begin creating telemetry upload process.
telemetry.process : Creating upload process: "/usr/local/Cellar/azure-cli/2.2.0_1/libexec/bin/python /usr/local/Cellar/azure-cli/2.2.0_1/libexec/lib/python3.8/site-packages/azure/cli/telemetry/__init__.py /Users/julien/.azure"
telemetry.process : Return from creating process
telemetry.main : Finish creating telemetry upload process.
command ran in 58.963 seconds.
yonzhan commented 4 years ago

@fengzhou-msft please take a look.

schiavarino8 commented 4 years ago

I'm having the same problem. I recently upgrade my version from 2.2.0 to 2.3.1 and the issue persist.

giuscri commented 4 years ago

same, with macOS 10.15.3 and az 2.3.1. Any workaround to fix for this?

khink commented 4 years ago

For what it's worth: I get the same error when i simply pip install psycopg2==2.7.3.1 in a fresh virtualenv. Using the latest psycopg2==2.8.5 fixes it.

EthanMelamed commented 4 years ago

For what it's worth: I get the same error when i simply pip install psycopg2==2.7.3.1 in a fresh virtualenv. Using the latest psycopg2==2.8.5 fixes it.

  • Python 3.8
  • Postgres is in /Applications/Postgres.app/ (so no Homebrew)
  • Python used for creating virtualenv in /Library/Frameworks/Python.framework/ (so no Homebrew)
  • MacOS Mojave (10.14.6)

How would you use this as a workaround? I am having this issue too

This fails for me using azure cli v2.2.0 and v.2.4.0

fengzhou-msft commented 4 years ago

@Juliehzl is working on the fix.

fengzhou-msft commented 4 years ago

Please install the latest db-up 0.1.14 and try again.

Mathew-Stylianidis-SB commented 2 years ago

psycopg2==2.8.5

Installing this psycopg2 version and PostgresSQL solved my issues on MacOS Big Sur (M1).