langflow icon indicating copy to clipboard operation
langflow copied to clipboard

Mac can not install psycopg-binary==3.2.1 (MAC 13.5.1 (22G90) M1)

Open xiaoqiangkx opened this issue 1 year ago • 7 comments

Describe the bug Hey Forks, I run make backend, it failed

Browser and Version

  • MAC 13.5.1 (22G90) M1

Code

Package operations: 1 install, 0 updates, 0 removals

  - Installing psycopg-binary (3.2.1): Failed

  RuntimeError

  Unable to find installation candidates for psycopg-binary (3.2.1)

  at ~/Library/Application Support/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/chooser.py:74 in choose_for
       70│ 
       71│             links.append(link)
       72│ 
       73│         if not links:
    →  74│             raise RuntimeError(f"Unable to find installation candidates for {package}")
       75│ 
       76│         # Get the best link
       77│         chosen = max(links, key=lambda link: self._sort_key(package, link))
       78│ 

Cannot install psycopg-binary.

make[1]: *** [install_backend] Error 1
make: *** [backend] Error 2

I can change psycopg-binary and psycopg == 3.1.19 and build a new poetry lock to run it.

Could you please use "~3.1.19" in pyproject.toml file?

psycopg = "~=3.1.19"
psycopg-binary = "~=3.1.19"

xiaoqiangkx avatar Jul 09 '24 03:07 xiaoqiangkx

The installation of psycopg-binary==3.2.1 might be failing on your Mac due to compatibility issues with the M1 chip. Here are some steps to resolve this issue:

  1. Ensure you are using the correct version specified in the pyproject.toml file, which is ^3.1.9. You can do this by running:

    poetry add psycopg-binary@^3.1.9
    
  2. If the issue persists, try using the psycopg package instead of psycopg-binary, as it might have better compatibility with your system. Modify your pyproject.toml to use psycopg:

    [tool.poetry.dependencies]
    psycopg = "^3.1.9"
    
  3. Update your dependencies:

    poetry update
    
  4. Set an environment variable to avoid issues specific to macOS:

    export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
    
  5. Install additional dependencies or tools required for building the package on an M1 Mac:

    brew install libpq
    brew link --force libpq
    
  6. Ensure the OBJC_DISABLE_INITIALIZE_FORK_SAFETY environment variable is set:

    export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
    

Then, try installing the package again [1].

Alternatively, you can use Docker to bypass compatibility issues. Follow these steps:

  1. Clone the LangFlow repository:

    git clone https://github.com/langflow-ai/langflow.git
    
  2. Navigate to the docker_example directory:

    cd langflow/docker_example
    
  3. Run the Docker Compose file:

    docker compose up
    

LangFlow will be accessible at http://localhost:7860/ [2][3][4][5].

To continue talking to Dosu, mention @dosu.

dosubot[bot] avatar Jul 09 '24 03:07 dosubot[bot]

@xiaoqiangkx Do you need any assistance with this case? If not, please let us know if this issue can be closed.

carlosrcoelho avatar Jul 23 '24 14:07 carlosrcoelho

Hey @xiaoqiangkx

How are you?

This is weird. We have 3.19 in the pyproject.toml psycopg-binary = "^3.1.9"

ogabrielluiz avatar Jul 23 '24 14:07 ogabrielluiz

For M1 Macs the minimum MacOS version is 14:

psycopg_binary-3.2.1-cp312-cp312-macosx_12_0_x86_64.whl
psycopg_binary-3.2.1-cp312-cp312-macosx_14_0_arm64.whl

For Intel ones the minimum is MacOS 12.

rafrafek avatar Jul 26 '24 10:07 rafrafek

See https://github.com/psycopg/psycopg/issues/858

rafrafek avatar Jul 26 '24 10:07 rafrafek

This is weird. We have 3.19 in the pyproject.toml psycopg-binary = "^3.1.9"

There is:

psycopg = "^3.1.9"
psycopg-binary = "^3.1.9"

which means it's compatible with 3.2.1 and the lock file confirms that:

https://github.com/langflow-ai/langflow/blob/main/poetry.lock#L7287 https://github.com/langflow-ai/langflow/blob/main/poetry.lock#L7310

BTW it's better to define

psycopg = { extras = ["binary"], version = "^3.1.9" }

rather than

psycopg = "^3.1.9"
psycopg-binary = "^3.1.9"

rafrafek avatar Jul 26 '24 14:07 rafrafek

Any news on this?

I can reproduce the same issue on M2.

image

paulosalvatore avatar Aug 03 '24 01:08 paulosalvatore

Refer to https://github.com/psycopg/psycopg/issues/858 as well as the warning for MacOS ARM chips in https://www.psycopg.org/psycopg3/docs/basic/install.html#binary-installation.

The issue seems to be difficulty in builders targeting older versions of MacOS on ARM chips (https://github.com/psycopg/psycopg/issues/858#issuecomment-2217172495).

tommyhe6 avatar Aug 11 '24 21:08 tommyhe6

Thank you all for digging into this issue. I've updated to lock to 3.1.19 for now, as >=3.1.20 will cause issues for users on macOS 11, 12, 13.

See https://endoflife.date/macos for EOL for 11, 12, 13.

https://github.com/langflow-ai/langflow/pull/3292/files

jordanrfrazier avatar Aug 12 '24 21:08 jordanrfrazier