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

Cannot build on Python 3.8 because the version of psycopg2 is old #48

Closed
niyalist opened this issue Aug 25, 2020 · 1 comment
Closed
Assignees

Comments

@niyalist
Copy link

niyalist commented Aug 25, 2020

Whth python 3.8, I found an error while building GTFSDB with zc.buildout. I think this is du to incompatibility of psycopg2, so updated version.conf and now it works. I also found some warnings caused by zc.buildout, but it somehow works well.

Error:

$ buildout install prod postgresql
/usr/local/lib/python3.8/site-packages/setuptools/distutils_patch.py:25: UserWarning: Distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools' objects directly or at least import Setuptools first.
warnings.warn(
Creating directory '/Users/XXX/gtfsdb/eggs'.
Creating directory '/Users/XXX/gtfsdb/bin'.
Creating directory '/Users/XXX/gtfsdb/parts'.
Creating directory '/Users/XXX/gtfsdb/develop-eggs'.
Develop: '/Users/XXX/gtfsdb/.'
Warning: 'classifiers' should be a list, got type 'tuple'
Getting distribution for 'zc.recipe.egg==2.0.7'.
WARNING: The easy_install command is deprecated and will be removed in a future version.
Got zc.recipe.egg 2.0.7.
Unused options for buildout: 'allowed-eggs-from-site-packages' 'app-egg-name' 'include-site-packages'.
Installing prod.
Getting distribution for 'psycopg2==2.7.7'.
WARNING: The easy_install command is deprecated and will be removed in a future version.
psycopg/psycopgmodule.c:689:18: error: incomplete definition of type 'struct _is'
while (interp->next)
~~~~~~^
/usr/local/Cellar/python@3.8/3.8.5/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/Cellar/python@3.8/3.8.5/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: Setup script exited with error: command 'clang' failed with exit status 1
An error occurred when trying to install /var/folders/b9/lqn5qty9425_wnngw1bz2n2r0000gn/T/tmp9xbfppb2get_dist/psycopg2-2.7.7.tar.gz. Look above this message for any errors that were output by easy_install.
While:
Installing prod.
Getting distribution for 'psycopg2==2.7.7'.

An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/zc/buildout/buildout.py", line 2174, in main
getattr(buildout, command)(args)
File "/usr/local/lib/python3.8/site-packages/zc/buildout/buildout.py", line 817, in install
installed_files = self[part]._call(recipe.install)
File "/usr/local/lib/python3.8/site-packages/zc/buildout/buildout.py", line 1603, in _call
return f()
File "/Users/XXX/gtfsdb/eggs/zc.recipe.egg-2.0.7-py3.8.egg/zc/recipe/egg/egg.py", line 227, in install
reqs, ws = self.working_set()
File "/Users/XXX/gtfsdb/eggs/zc.recipe.egg-2.0.7-py3.8.egg/zc/recipe/egg/egg.py", line 78, in working_set
ws = self._working_set(
File "/Users/XXX/gtfsdb/eggs/zc.recipe.egg-2.0.7-py3.8.egg/zc/recipe/egg/egg.py", line 161, in _working_set
ws = zc.buildout.easy_install.install(
File "/usr/local/lib/python3.8/site-packages/zc/buildout/easy_install.py", line 957, in install
return installer.install(specs, working_set)
File "/usr/local/lib/python3.8/site-packages/zc/buildout/easy_install.py", line 730, in install
for dist in self._get_dist(req, ws):
File "/usr/local/lib/python3.8/site-packages/zc/buildout/easy_install.py", line 574, in _get_dist
dists = [_move_to_eggs_dir_and_compile(dist, self._dest)]
File "/usr/local/lib/python3.8/site-packages/zc/buildout/easy_install.py", line 1745, in _move_to_eggs_dir_and_compile
[tmp_loc] = glob.glob(os.path.join(tmp_dest, '*'))
ValueError: not enough values to unpack (expected 1, got 0)
$

Quick Fix:
Fix "psycopg2 = 2.7.7" in versions.cfg into psycopg2 = 2.8.5

Environment:
macOS Catalina 10.15.6
Homebrew 2.4.13-97-g1b4e1ae
Python 3.8.5
zc.buildout 2.13.3

@fpurcell
Copy link
Member

Thanks @niyalist ... will take a look and let you know here.

BTW, versions.cfg is auto generated ... I check it in, in hopes of making for a repeatable build. I'll try updating psycopg2 and testing on a few versions of python, and will then commit an updated versions.cfg if there are no issues.

Current workaround for py 3.8: edit versions.cfg and remove pinned psycopg2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants