Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install pyscopg2 on pdm 2.0.2 #1255

Closed
1 task done
samrensenhouse opened this issue Jul 21, 2022 · 1 comment · Fixed by #1260
Closed
1 task done

Unable to install pyscopg2 on pdm 2.0.2 #1255

samrensenhouse opened this issue Jul 21, 2022 · 1 comment · Fixed by #1260
Labels
🐛 bug Something isn't working

Comments

@samrensenhouse
Copy link

  • I have searched the issue tracker and believe that this is not a duplicate.

Make sure you run commands with -v flag before pasting the output.

Steps to reproduce

  • Have this pyproject.toml file
[project]
name = ""
version = ""
description = ""
authors = [
]

dependencies = [
    "psycopg2~=2.9",
]

requires-python = ">=3.8"
license = {text = "MIT"}

[tool.pdm]

[build-system]
requires = ["pdm-pep517>=0.12.0"]
build-backend = "pdm.pep517.api"
  • Run this Dockerfile:
FROM python:3.8

RUN pip3 install pdm==2.0.2

COPY pyproject.toml pyproject.toml

RUN pdm install -v
  • See failure below:
#8 1.075 Lock file does not exist
#8 1.076 Updating the lock file...
#8 1.078 python.use_venv is on, creating a virtualenv for this project...
#8 1.207 Run command: ['/usr/local/bin/python', '-m', 'virtualenv', '--no-pip', '--no-setuptools', '--no-wheel', '/.venv', '-p', '/usr/bin/python3.9']
#8 1.524 created virtual environment CPython3.9.2.final.0-64 in 154ms
#8 1.524   creator CPython3Posix(dest=/.venv, clear=False, no_vcs_ignore=False, global=False)
#8 1.524   activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
#8 1.544 Virtualenv is created successfully at /.venv
#8 1.551 pdm.termui: ======== Start resolving requirements ========
#8 1.551 pdm.termui:   psycopg2~=2.9
#8 1.551 pdm.termui:   python>=3.8
#8 1.551 pdm.termui:   Adding requirement psycopg2~=2.9
#8 2.319 pdm.termui:   Adding requirement python>=3.8
#8 2.320 pdm.termui: ======== Starting round 0 ========
#8 2.368 pdm.termui: Pinning: python None
#8 2.368 pdm.termui: ======== Ending round 0 ========
#8 2.368 pdm.termui: ======== Starting round 1 ========
#8 2.468 unearth: Downloading <Link https://files.pythonhosted.org/packages/00/7f/a1e886c894385c731dd063dfc4bcc6b252c502222b8dbd58ca40bc970691/psycopg2-2.9.3-cp310-cp310-win32.whl (from None)> to /tmp/pdm-build-9ztib84z/psycopg2-2.9.3-cp310-cp310-win32.whl
#8 4.080 pdm.termui: Pinning: psycopg2 2.9.3
#8 4.080 pdm.termui: ======== Ending round 1 ========
#8 4.080 pdm.termui: ======== Starting round 2 ========
#8 4.080 pdm.termui: ======== Resolution Result ========
#8 4.080 pdm.termui: Stable pins:
#8 4.080 pdm.termui:     python None
#8 4.080 pdm.termui:   psycopg2 2.9.3
#8 4.602 🔒 Lock successful
#8 4.606 Changes are written to pdm.lock.
#8 4.687 Synchronizing working set with lock file: 1 to add, 0 to update, 0 to remove
#8 4.687
#8 4.696 unearth: Downloading <Link https://files.pythonhosted.org/packages/d1/1e/b450599a27b1809bccbd4e369f397cb18dc56b875778d961f9ae180b54b7/psycopg2-2.9.3.tar.gz (from None)> to /tmp/pdm-download-2ch11coh/psycopg2-2.9.3.tar.gz     
#8 5.334 pdm.termui: Preparing isolated env for PEP 517 build...
#8 5.414 pdm.termui: Saving wheel to cache: <Link https://files.pythonhosted.org/packages/d1/1e/b450599a27b1809bccbd4e369f397cb18dc56b875778d961f9ae180b54b7/psycopg2-2.9.3.tar.gz (from None)>
#8 5.415 pdm.termui: Running PEP 517 backend to build a wheel for <Link https://files.pythonhosted.org/packages/d1/1e/b450599a27b1809bccbd4e369f397cb18dc56b875778d961f9ae180b54b7/psycopg2-2.9.3.tar.gz (from None)>
#8 6.526 pdm.termui: Using pip 21.2.4 from /usr/local/lib/python3.8/site-packages/pip (python 3.9)
#8 7.379 pdm.termui: Collecting setuptools>=40.8.0
#8 7.500 pdm.termui:   Downloading setuptools-63.2.0-py3-none-any.whl (1.2 MB)
#8 7.919 pdm.termui: Collecting wheel
#8 7.947 pdm.termui:   Downloading wheel-0.37.1-py2.py3-none-any.whl (35 kB)
#8 8.322 pdm.termui: Installing collected packages: wheel, setuptools
#8 8.356 pdm.termui:   Creating /tmp/pdm-build-env-ipa0jvls-shared/bin
#8 8.356 pdm.termui:   changing mode of /tmp/pdm-build-env-ipa0jvls-shared/bin/wheel to 777
#8 9.070 pdm.termui: Successfully installed setuptools-63.2.0 wheel-0.37.1
#8 9.435 pdm.termui: WARNING: You are using pip version 21.2.4; however, version 22.2 is available.
#8 9.435 pdm.termui: You should consider upgrading via the '/.venv/bin/python -m pip install --upgrade pip' command.
#8 9.767 pdm.termui: /tmp/pdm-build-env-ipa0jvls-shared/lib/python3.9/site-packages/setuptools/config/setupcfg.py:463: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
#8 9.767 pdm.termui:   warnings.warn(msg, warning_class)
#8 9.785 pdm.termui: running egg_info
#8 9.787 pdm.termui: writing psycopg2.egg-info/PKG-INFO
#8 9.787 pdm.termui: writing dependency_links to psycopg2.egg-info/dependency_links.txt
#8 9.788 pdm.termui: writing top-level names to psycopg2.egg-info/top_level.txt
#8 9.838 pdm.termui: reading manifest file 'psycopg2.egg-info/SOURCES.txt'
#8 9.840 pdm.termui: reading manifest template 'MANIFEST.in'
#8 9.851 pdm.termui: adding license file 'LICENSE'
#8 9.855 pdm.termui: writing manifest file 'psycopg2.egg-info/SOURCES.txt'
#8 10.20 pdm.termui: /tmp/pdm-build-env-ipa0jvls-shared/lib/python3.9/site-packages/setuptools/config/setupcfg.py:463: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
#8 10.20 pdm.termui:   warnings.warn(msg, warning_class)
#8 10.21 pdm.termui: running bdist_wheel
#8 10.22 pdm.termui: running build
#8 10.22 pdm.termui: running build_py
#8 10.22 pdm.termui: creating build
#8 10.22 pdm.termui: creating build/lib.linux-x86_64-cpython-39
#8 10.22 pdm.termui: creating build/lib.linux-x86_64-cpython-39/psycopg2
#8 10.22 pdm.termui: copying lib/errorcodes.py -> build/lib.linux-x86_64-cpython-39/psycopg2
#8 10.22 pdm.termui: copying lib/pool.py -> build/lib.linux-x86_64-cpython-39/psycopg2
#8 10.22 pdm.termui: copying lib/errors.py -> build/lib.linux-x86_64-cpython-39/psycopg2
#8 10.22 pdm.termui: copying lib/sql.py -> build/lib.linux-x86_64-cpython-39/psycopg2
#8 10.22 pdm.termui: copying lib/tz.py -> build/lib.linux-x86_64-cpython-39/psycopg2
#8 10.22 pdm.termui: copying lib/_range.py -> build/lib.linux-x86_64-cpython-39/psycopg2
#8 10.22 pdm.termui: copying lib/extensions.py -> build/lib.linux-x86_64-cpython-39/psycopg2
#8 10.22 pdm.termui: copying lib/__init__.py -> build/lib.linux-x86_64-cpython-39/psycopg2
#8 10.22 pdm.termui: copying lib/extras.py -> build/lib.linux-x86_64-cpython-39/psycopg2
#8 10.22 pdm.termui: copying lib/_ipaddress.py -> build/lib.linux-x86_64-cpython-39/psycopg2
#8 10.22 pdm.termui: copying lib/_json.py -> build/lib.linux-x86_64-cpython-39/psycopg2
#8 10.22 pdm.termui: running build_ext
#8 10.27 pdm.termui: building 'psycopg2._psycopg' extension
#8 10.27 pdm.termui: creating build/temp.linux-x86_64-cpython-39
#8 10.27 pdm.termui: creating build/temp.linux-x86_64-cpython-39/psycopg
#8 10.27 pdm.termui: x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-RNBry6/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-securit
y -g -fwrapv -O2 -fPIC "-DPSYCOPG_VERSION=2.9.3 (dt dec pq3 ext lo64)" -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=130005 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/.venv/include -I/usr/include/python3.9 -I. -I/usr/include/postgresql -I/usr/include/postgresql/13/server -I/usr/include/libxml2 -c psycopg/adapter_asis.c -o build/temp.linux-x86_64-cpython-39/psycopg/adapter_asis.o -Wdeclaration-after-statement
#8 10.28 pdm.termui: In file included from psycopg/adapter_asis.c:28:
#8 10.28 pdm.termui: ./psycopg/psycopg.h:35:10: fatal error: Python.h: No such file or directory
#8 10.28 pdm.termui:    35 | #include <Python.h>
#8 10.28 pdm.termui:       |          ^~~~~~~~~~
#8 10.28 pdm.termui: compilation terminated.
#8 10.28 pdm.termui:
#8 10.28 pdm.termui: It appears you are missing some prerequisite to build the package from source.
#8 10.28 pdm.termui:
#8 10.28 pdm.termui: You may install a binary package by installing 'psycopg2-binary' from PyPI.
#8 10.28 pdm.termui: If you want to install psycopg2 from source, please install the packages
#8 10.28 pdm.termui: required for the build and try again.
#8 10.28 pdm.termui:
#8 10.28 pdm.termui: For further information please check the 'doc/src/install.rst' file (also at
#8 10.28 pdm.termui: <https://www.psycopg.org/docs/install.html>).
#8 10.28 pdm.termui:
#8 10.28 pdm.termui: error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
#8 10.32   ✖ Install psycopg2 2.9.3 failed
#8 10.32 pdm.termui: Error occurs:
#8 10.32 Traceback (most recent call last):
#8 10.32   File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
#8 10.32     result = self.fn(*self.args, **self.kwargs)
#8 10.32   File "/usr/local/lib/python3.8/site-packages/pdm/installers/synchronizers.py", line 217, in install_candidate
#8 10.32     self.manager.install(can)
#8 10.32   File "/usr/local/lib/python3.8/site-packages/pdm/installers/manager.py", line 39, in install
#8 10.32     installer(str(prepared.build()), self.environment, prepared.direct_url())
#8 10.32   File "/usr/local/lib/python3.8/site-packages/pdm/models/candidates.py", line 344, in build
#8 10.32     builder.build(build_dir, metadata_directory=self._metadata_dir)
#8 10.32   File "/usr/local/lib/python3.8/site-packages/pdm/builders/wheel.py", line 28, in build
#8 10.32     filename = self._hook.build_wheel(out_dir, config_settings, metadata_directory)
#8 10.32   File "/usr/local/lib/python3.8/site-packages/pep517/wrappers.py", line 208, in build_wheel
#8 10.32     return self._call_hook('build_wheel', {
#8 10.32   File "/usr/local/lib/python3.8/site-packages/pep517/wrappers.py", line 322, in _call_hook
#8 10.32     self._subprocess_runner(
#8 10.32   File "/usr/local/lib/python3.8/site-packages/pdm/builders/base.py", line 248, in subprocess_runner
#8 10.32     return log_subprocessor(cmd, cwd, extra_environ=env)
#8 10.32   File "/usr/local/lib/python3.8/site-packages/pdm/builders/base.py", line 87, in log_subprocessor
#8 10.32     raise BuildError(
#8 10.32 pdm.exceptions.BuildError: Call command ['/.venv/bin/python', '/usr/local/lib/python3.8/site-packages/pep517/in_process/_in_process.py', 'build_wheel', '/tmp/tmp1i9zbuhc'] return non-zero status(1). Make sure the package is PEP 517-compliant, or you can add `--no-isolation` to the command.
#8 10.33 Retry failed jobs
#8 10.33 pdm.termui: Preparing isolated env for PEP 517 build...
#8 10.40 pdm.termui: Saving wheel to cache: <Link https://files.pythonhosted.org/packages/d1/1e/b450599a27b1809bccbd4e369f397cb18dc56b875778d961f9ae180b54b7/psycopg2-2.9.3.tar.gz (from None)>
#8 10.40 pdm.termui: Running PEP 517 backend to build a wheel for <Link https://files.pythonhosted.org/packages/d1/1e/b450599a27b1809bccbd4e369f397cb18dc56b875778d961f9ae180b54b7/psycopg2-2.9.3.tar.gz (from None)>
#8 10.68 pdm.termui: /tmp/pdm-build-env-ipa0jvls-shared/lib/python3.9/site-packages/setuptools/config/setupcfg.py:463: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
#8 10.68 pdm.termui:   warnings.warn(msg, warning_class)
#8 10.70 pdm.termui: running egg_info
#8 10.70 pdm.termui: writing psycopg2.egg-info/PKG-INFO
#8 10.70 pdm.termui: writing dependency_links to psycopg2.egg-info/dependency_links.txt
#8 10.70 pdm.termui: writing top-level names to psycopg2.egg-info/top_level.txt
#8 10.75 pdm.termui: reading manifest file 'psycopg2.egg-info/SOURCES.txt'
#8 10.75 pdm.termui: reading manifest template 'MANIFEST.in'
#8 10.76 pdm.termui: adding license file 'LICENSE'
#8 10.76 pdm.termui: writing manifest file 'psycopg2.egg-info/SOURCES.txt'
#8 11.09 pdm.termui: /tmp/pdm-build-env-ipa0jvls-shared/lib/python3.9/site-packages/setuptools/config/setupcfg.py:463: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
#8 11.09 pdm.termui:   warnings.warn(msg, warning_class)
#8 11.10 pdm.termui: running bdist_wheel
#8 11.11 pdm.termui: running build
#8 11.11 pdm.termui: running build_py
#8 11.11 pdm.termui: running build_ext
#8 11.16 pdm.termui: building 'psycopg2._psycopg' extension
#8 11.16 pdm.termui: x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-RNBry6/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-securit
y -g -fwrapv -O2 -fPIC "-DPSYCOPG_VERSION=2.9.3 (dt dec pq3 ext lo64)" -DPSYCOPG_DEBUG=1 -DPG_VERSION_NUM=130005 -DHAVE_LO64=1 -DPSYCOPG_DEBUG=1 -I/.venv/include -I/usr/include/python3.9 -I. -I/usr/include/postgresql -I/usr/include/postgresql/13/server -I/usr/include/libxml2 -c psycopg/adapter_asis.c -o build/temp.linux-x86_64-cpython-39/psycopg/adapter_asis.o -Wdeclaration-after-statement
#8 11.17 pdm.termui: In file included from psycopg/adapter_asis.c:28:
#8 11.17 pdm.termui: ./psycopg/psycopg.h:35:10: fatal error: Python.h: No such file or directory
#8 11.17 pdm.termui:    35 | #include <Python.h>
#8 11.17 pdm.termui:       |          ^~~~~~~~~~
#8 11.17 pdm.termui: compilation terminated.
#8 11.17 pdm.termui:
#8 11.17 pdm.termui: It appears you are missing some prerequisite to build the package from source.
#8 11.17 pdm.termui: 
#8 11.17 pdm.termui: You may install a binary package by installing 'psycopg2-binary' from PyPI.
#8 11.17 pdm.termui: If you want to install psycopg2 from source, please install the packages
#8 11.17 pdm.termui: required for the build and try again.
#8 11.17 pdm.termui:
#8 11.17 pdm.termui: For further information please check the 'doc/src/install.rst' file (also at
#8 11.17 pdm.termui: <https://www.psycopg.org/docs/install.html>).
#8 11.17 pdm.termui:
#8 11.17 pdm.termui: error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
#8 11.21   ✖ Install psycopg2 2.9.3 failed
#8 11.21 pdm.termui: Error occurs:
#8 11.21 Traceback (most recent call last):
#8 11.21   File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
#8 11.21     result = self.fn(*self.args, **self.kwargs)
#8 11.21   File "/usr/local/lib/python3.8/site-packages/pdm/installers/synchronizers.py", line 217, in install_candidate
#8 11.21     self.manager.install(can)
#8 11.21   File "/usr/local/lib/python3.8/site-packages/pdm/installers/manager.py", line 39, in install
#8 11.21     installer(str(prepared.build()), self.environment, prepared.direct_url())
#8 11.21   File "/usr/local/lib/python3.8/site-packages/pdm/models/candidates.py", line 344, in build
#8 11.21     builder.build(build_dir, metadata_directory=self._metadata_dir)
#8 11.21   File "/usr/local/lib/python3.8/site-packages/pdm/builders/wheel.py", line 28, in build
#8 11.21     filename = self._hook.build_wheel(out_dir, config_settings, metadata_directory)
#8 11.21   File "/usr/local/lib/python3.8/site-packages/pep517/wrappers.py", line 208, in build_wheel
#8 11.21     return self._call_hook('build_wheel', {
#8 11.21   File "/usr/local/lib/python3.8/site-packages/pep517/wrappers.py", line 322, in _call_hook
#8 11.21     self._subprocess_runner(
#8 11.21   File "/usr/local/lib/python3.8/site-packages/pdm/builders/base.py", line 248, in subprocess_runner
#8 11.21     return log_subprocessor(cmd, cwd, extra_environ=env)
#8 11.21   File "/usr/local/lib/python3.8/site-packages/pdm/builders/base.py", line 87, in log_subprocessor
#8 11.21     raise BuildError(
#8 11.21 pdm.exceptions.BuildError: Call command ['/.venv/bin/python', '/usr/local/lib/python3.8/site-packages/pep517/in_process/_in_process.py', 'build_wheel', '/tmp/tmp59bbgt86'] return non-zero status(1). Make sure the package is PEP 517-compliant, or you can add `--no-isolation` to the command.
#8 11.22
#8 11.22 Traceback (most recent call last):
#8 11.22   File "/usr/local/bin/pdm", line 8, in <module>
#8 11.22     sys.exit(main())
#8 11.22   File "/usr/local/lib/python3.8/site-packages/pdm/core.py", line 254, in main
#8 11.22     return Core().main(args)
#8 11.22   File "/usr/local/lib/python3.8/site-packages/pdm/core.py", line 187, in main
#8 11.22     raise cast(Exception, err).with_traceback(traceback)
#8 11.22   File "/usr/local/lib/python3.8/site-packages/pdm/core.py", line 182, in main
#8 11.22     f(options.project, options)
#8 11.22   File "/usr/local/lib/python3.8/site-packages/pdm/cli/commands/install.py", line 61, in handle
#8 11.22     actions.do_sync(
#8 11.22   File "/usr/local/lib/python3.8/site-packages/pdm/cli/actions.py", line 219, in do_sync
#8 11.22     handler.synchronize()
#8 11.22   File "/usr/local/lib/python3.8/site-packages/pdm/installers/synchronizers.py", line 402, in synchronize
#8 11.22     raise InstallationError("Some package operations are not complete yet")
#8 11.22 pdm.exceptions.InstallationError: Some package operations are not complete yet

Actual behavior

Pdm 2.0.2 fails to properly install pycopg2. If you swap this line RUN pip3 install pdm==2.0.2 to RUN pip3 install pdm==1.15.4 it runs successfully.

Expected behavior

Pyscopg2 is successfully installed.

@samrensenhouse samrensenhouse added the 🐛 bug Something isn't working label Jul 21, 2022
@frostming
Copy link
Collaborator

Because PDM 2.0 chooses python3.9(yeah it does exist in the image) but PDM 1.15.4 chooses python3.8.

This is an unexpected behavior change though, will fix it in the next release. For now, you can use pdm use 3.8 to change that explicitly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants