Mac can not install psycopg-binary==3.2.1 (MAC 13.5.1 (22G90) M1)
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"
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:
-
Ensure you are using the correct version specified in the
pyproject.tomlfile, which is^3.1.9. You can do this by running:poetry add psycopg-binary@^3.1.9 -
If the issue persists, try using the
psycopgpackage instead ofpsycopg-binary, as it might have better compatibility with your system. Modify yourpyproject.tomlto usepsycopg:[tool.poetry.dependencies] psycopg = "^3.1.9" -
Update your dependencies:
poetry update -
Set an environment variable to avoid issues specific to macOS:
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES -
Install additional dependencies or tools required for building the package on an M1 Mac:
brew install libpq brew link --force libpq -
Ensure the
OBJC_DISABLE_INITIALIZE_FORK_SAFETYenvironment 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:
-
Clone the LangFlow repository:
git clone https://github.com/langflow-ai/langflow.git -
Navigate to the
docker_exampledirectory:cd langflow/docker_example -
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.
@xiaoqiangkx Do you need any assistance with this case? If not, please let us know if this issue can be closed.
Hey @xiaoqiangkx
How are you?
This is weird. We have 3.19 in the pyproject.toml psycopg-binary = "^3.1.9"
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.
See https://github.com/psycopg/psycopg/issues/858
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"
Any news on this?
I can reproduce the same issue on M2.
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).
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